mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-05-16 18:12:10 +00:00
ENH: config: add filament_maps in partplate
Change-Id: I1183830788e703f1d33a8a4b620b58b822283dd4 (cherry picked from commit b0e3ab037e3f5af0851539af5ac15b8f96daf548)
This commit is contained in:
@@ -180,6 +180,8 @@ void PartPlate::init()
|
||||
|
||||
m_print_index = -1;
|
||||
m_print = nullptr;
|
||||
|
||||
m_config.option<ConfigOptionEnum<FilamentMapMode>>("filament_map_mode", true);
|
||||
}
|
||||
|
||||
BedType PartPlate::get_bed_type(bool load_from_project) const
|
||||
@@ -3172,6 +3174,53 @@ void PartPlate::print() const
|
||||
return;
|
||||
}
|
||||
|
||||
FilamentMapMode PartPlate::get_filament_map_mode()
|
||||
{
|
||||
return m_config.option<ConfigOptionEnum<FilamentMapMode>>("filament_map_mode", true)->value;
|
||||
}
|
||||
|
||||
void PartPlate::set_filament_map_mode(FilamentMapMode& mode)
|
||||
{
|
||||
m_config.option<ConfigOptionEnum<FilamentMapMode>>("filament_map_mode", true)->value = mode;
|
||||
}
|
||||
|
||||
std::vector<int> PartPlate::get_filament_maps()
|
||||
{
|
||||
std::vector<int>& filament_maps = m_config.option<ConfigOptionInts>("filament_map", true)->values;
|
||||
|
||||
return filament_maps;
|
||||
}
|
||||
|
||||
void PartPlate::set_filament_maps(std::vector<int>& f_maps)
|
||||
{
|
||||
std::vector<int>& filament_maps = m_config.option<ConfigOptionInts>("filament_map", true)->values;
|
||||
|
||||
filament_maps = f_maps;
|
||||
}
|
||||
|
||||
void PartPlate::set_filament_count(int filament_count)
|
||||
{
|
||||
std::vector<int>& filament_maps = m_config.option<ConfigOptionInts>("filament_map", true)->values;
|
||||
filament_maps.resize(filament_count, 1);
|
||||
}
|
||||
|
||||
void PartPlate::on_filament_added()
|
||||
{
|
||||
std::vector<int>& filament_maps = m_config.option<ConfigOptionInts>("filament_map", true)->values;
|
||||
filament_maps.push_back(1);
|
||||
}
|
||||
|
||||
|
||||
void PartPlate::on_filament_deleted(int filament_count, int filament_id)
|
||||
{
|
||||
std::vector<int>& filament_maps = m_config.option<ConfigOptionInts>("filament_map", true)->values;
|
||||
|
||||
filament_maps.erase(filament_maps.begin()+filament_id);
|
||||
|
||||
update_first_layer_print_sequence_when_delete_filament(filament_id);
|
||||
}
|
||||
|
||||
|
||||
/* PartPlate List related functions*/
|
||||
PartPlateList::PartPlateList(int width, int depth, int height, Plater* platerObj, Model* modelObj, PrinterTechnology tech)
|
||||
:m_plate_width(width), m_plate_depth(depth), m_plate_height(height), m_plater(platerObj), m_model(modelObj), printer_technology(tech),
|
||||
@@ -3607,8 +3656,10 @@ void PartPlateList::reset(bool do_init)
|
||||
|
||||
//m_plate_list.clear();
|
||||
|
||||
if (do_init)
|
||||
if (do_init) {
|
||||
init();
|
||||
m_plate_list[0]->set_filament_count(m_filament_count);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
@@ -3620,6 +3671,8 @@ void PartPlateList::reinit()
|
||||
|
||||
init();
|
||||
|
||||
m_plate_list[0]->set_filament_count(m_filament_count);
|
||||
|
||||
//reset plate 0's position
|
||||
Vec2d pos = compute_shape_position(0, m_plate_cols);
|
||||
m_plate_list[0]->set_shape(m_shape, m_exclude_areas, pos, m_height_to_lid, m_height_to_rod);
|
||||
@@ -3668,6 +3721,8 @@ int PartPlateList::create_plate(bool adjust_position)
|
||||
m_print_index++;
|
||||
}
|
||||
|
||||
plate->set_filament_count(m_filament_count);
|
||||
|
||||
plate->set_index(new_index);
|
||||
Vec2d pos = compute_shape_position(new_index, cols);
|
||||
plate->set_shape(m_shape, m_exclude_areas, pos, m_height_to_lid, m_height_to_rod);
|
||||
@@ -5385,7 +5440,7 @@ int PartPlateList::store_to_3mf_structure(PlateDataPtrs& plate_data_list, bool w
|
||||
return ret;
|
||||
}
|
||||
|
||||
int PartPlateList::load_from_3mf_structure(PlateDataPtrs& plate_data_list)
|
||||
int PartPlateList::load_from_3mf_structure(PlateDataPtrs& plate_data_list, int filament_count)
|
||||
{
|
||||
int ret = 0;
|
||||
|
||||
@@ -5395,6 +5450,7 @@ int PartPlateList::load_from_3mf_structure(PlateDataPtrs& plate_data_list)
|
||||
return -1;
|
||||
}
|
||||
clear(true, true);
|
||||
set_filament_count(filament_count);
|
||||
for (unsigned int i = 0; i < (unsigned int)plate_data_list.size(); ++i)
|
||||
{
|
||||
int index = create_plate(false);
|
||||
@@ -5736,5 +5792,35 @@ void PartPlateList::load_cali_textures()
|
||||
PartPlateList::is_load_cali_texture = true;
|
||||
}
|
||||
|
||||
void PartPlateList::set_filament_count(int filament_count)
|
||||
{
|
||||
m_filament_count = filament_count;
|
||||
for (unsigned int i = 0; i < (unsigned int)m_plate_list.size(); ++i)
|
||||
{
|
||||
m_plate_list[i]->set_filament_count(filament_count);
|
||||
}
|
||||
BOOST_LOG_TRIVIAL(info) << boost::format("%1%: filament_count=%2%")% __FUNCTION__ %filament_count;
|
||||
}
|
||||
|
||||
void PartPlateList::on_filament_added(int filament_count)
|
||||
{
|
||||
m_filament_count++;
|
||||
for (unsigned int i = 0; i < (unsigned int)m_plate_list.size(); ++i)
|
||||
{
|
||||
m_plate_list[i]->on_filament_added();
|
||||
}
|
||||
BOOST_LOG_TRIVIAL(info) << boost::format("%1%: filament_count=%2%")% __FUNCTION__ %filament_count;
|
||||
}
|
||||
|
||||
void PartPlateList::on_filament_deleted(int filament_count, int filament_id)
|
||||
{
|
||||
m_filament_count--;
|
||||
for (unsigned int i = 0; i < (unsigned int)m_plate_list.size(); ++i)
|
||||
{
|
||||
m_plate_list[i]->on_filament_deleted(filament_count, filament_id);
|
||||
}
|
||||
BOOST_LOG_TRIVIAL(info) << boost::format("%1%: filament_count=%2%, filament_id=%3%")% __FUNCTION__ %filament_count %filament_id;
|
||||
}
|
||||
|
||||
}//end namespace GUI
|
||||
}//end namespace slic3r
|
||||
|
||||
Reference in New Issue
Block a user