mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-07 23:17:35 -06:00
Properly find used extruders when infill/wall_filament is set (#6335)
This commit is contained in:
parent
ef5bae9910
commit
8ed2911db8
3 changed files with 88 additions and 25 deletions
|
@ -382,12 +382,12 @@ std::vector<unsigned int> Print::object_extruders() const
|
|||
{
|
||||
std::vector<unsigned int> extruders;
|
||||
extruders.reserve(m_print_regions.size() * m_objects.size() * 3);
|
||||
// BBS
|
||||
#if 0
|
||||
|
||||
//Orca: Collect extruders from all regions.
|
||||
for (const PrintObject *object : m_objects)
|
||||
for (const PrintRegion ®ion : object->all_regions())
|
||||
region.collect_object_printing_extruders(*this, extruders);
|
||||
#else
|
||||
|
||||
for (const PrintObject* object : m_objects) {
|
||||
const ModelObject* mo = object->model_object();
|
||||
for (const ModelVolume* mv : mo->volumes) {
|
||||
|
@ -410,7 +410,6 @@ std::vector<unsigned int> Print::object_extruders() const
|
|||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
sort_remove_duplicates(extruders);
|
||||
return extruders;
|
||||
}
|
||||
|
|
|
@ -139,6 +139,9 @@ PrintBase::ApplyStatus PrintObject::set_instances(PrintInstances &&instances)
|
|||
std::vector<std::reference_wrapper<const PrintRegion>> PrintObject::all_regions() const
|
||||
{
|
||||
std::vector<std::reference_wrapper<const PrintRegion>> out;
|
||||
if(!m_shared_regions)
|
||||
return out;
|
||||
|
||||
out.reserve(m_shared_regions->all_regions.size());
|
||||
for (const std::unique_ptr<Slic3r::PrintRegion> ®ion : m_shared_regions->all_regions)
|
||||
out.emplace_back(*region.get());
|
||||
|
@ -3010,10 +3013,11 @@ std::vector<unsigned int> PrintObject::object_extruders() const
|
|||
{
|
||||
std::vector<unsigned int> extruders;
|
||||
extruders.reserve(this->all_regions().size() * 3);
|
||||
#if 0
|
||||
|
||||
//Orca: Collect extruders from all regions.
|
||||
for (const PrintRegion ®ion : this->all_regions())
|
||||
region.collect_object_printing_extruders(*this->print(), extruders);
|
||||
#else
|
||||
|
||||
const ModelObject* mo = this->model_object();
|
||||
for (const ModelVolume* mv : mo->volumes) {
|
||||
std::vector<int> volume_extruders = mv->get_extruders();
|
||||
|
@ -3022,7 +3026,6 @@ std::vector<unsigned int> PrintObject::object_extruders() const
|
|||
extruders.push_back(extruder - 1);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
sort_remove_duplicates(extruders);
|
||||
return extruders;
|
||||
}
|
||||
|
|
|
@ -1359,6 +1359,9 @@ std::vector<int> PartPlate::get_extruders(bool conside_custom_gcode) const
|
|||
const DynamicPrintConfig& glb_config = wxGetApp().preset_bundle->prints.get_edited_preset().config;
|
||||
int glb_support_intf_extr = glb_config.opt_int("support_interface_filament");
|
||||
int glb_support_extr = glb_config.opt_int("support_filament");
|
||||
int glb_wall_extr = glb_config.opt_int("wall_filament");
|
||||
int glb_sparse_infill_extr = glb_config.opt_int("sparse_infill_filament");
|
||||
int glb_solid_infill_extr = glb_config.opt_int("solid_infill_filament");
|
||||
bool glb_support = glb_config.opt_bool("enable_support");
|
||||
glb_support |= glb_config.opt_int("raft_layers") > 0;
|
||||
|
||||
|
@ -1392,9 +1395,7 @@ std::vector<int> PartPlate::get_extruders(bool conside_custom_gcode) const
|
|||
else
|
||||
obj_support = glb_support;
|
||||
|
||||
if (!obj_support)
|
||||
continue;
|
||||
|
||||
if (obj_support) {
|
||||
int obj_support_intf_extr = 0;
|
||||
const ConfigOption* support_intf_extr_opt = mo->config.option("support_interface_filament");
|
||||
if (support_intf_extr_opt != nullptr)
|
||||
|
@ -1414,6 +1415,35 @@ std::vector<int> PartPlate::get_extruders(bool conside_custom_gcode) const
|
|||
plate_extruders.push_back(glb_support_extr);
|
||||
}
|
||||
|
||||
int obj_wall_extr = 1;
|
||||
const ConfigOption* wall_opt = mo->config.option("wall_filament");
|
||||
if (wall_opt != nullptr)
|
||||
obj_wall_extr = wall_opt->getInt();
|
||||
if (obj_wall_extr != 1)
|
||||
plate_extruders.push_back(obj_wall_extr);
|
||||
else if (glb_wall_extr != 1)
|
||||
plate_extruders.push_back(glb_wall_extr);
|
||||
|
||||
int obj_sparse_infill_extr = 1;
|
||||
const ConfigOption* sparse_infill_opt = mo->config.option("sparse_infill_filament");
|
||||
if (sparse_infill_opt != nullptr)
|
||||
obj_sparse_infill_extr = sparse_infill_opt->getInt();
|
||||
if (obj_sparse_infill_extr != 1)
|
||||
plate_extruders.push_back(obj_sparse_infill_extr);
|
||||
else if (glb_sparse_infill_extr != 1)
|
||||
plate_extruders.push_back(glb_sparse_infill_extr);
|
||||
|
||||
int obj_solid_infill_extr = 1;
|
||||
const ConfigOption* solid_infill_opt = mo->config.option("solid_infill_filament");
|
||||
if (solid_infill_opt != nullptr)
|
||||
obj_solid_infill_extr = solid_infill_opt->getInt();
|
||||
if (obj_solid_infill_extr != 1)
|
||||
plate_extruders.push_back(obj_solid_infill_extr);
|
||||
else if (glb_solid_infill_extr != 1)
|
||||
plate_extruders.push_back(glb_solid_infill_extr);
|
||||
|
||||
}
|
||||
|
||||
if (conside_custom_gcode) {
|
||||
//BBS
|
||||
int nums_extruders = 0;
|
||||
|
@ -1441,6 +1471,10 @@ std::vector<int> PartPlate::get_extruders_under_cli(bool conside_custom_gcode, D
|
|||
// if 3mf file
|
||||
int glb_support_intf_extr = full_config.opt_int("support_interface_filament");
|
||||
int glb_support_extr = full_config.opt_int("support_filament");
|
||||
int glb_wall_extr = full_config.opt_int("wall_filament");
|
||||
int glb_sparse_infill_extr = full_config.opt_int("sparse_infill_filament");
|
||||
int glb_solid_infill_extr = full_config.opt_int("solid_infill_filament");
|
||||
|
||||
bool glb_support = full_config.opt_bool("enable_support");
|
||||
glb_support |= full_config.opt_int("raft_layers") > 0;
|
||||
|
||||
|
@ -1502,6 +1536,33 @@ std::vector<int> PartPlate::get_extruders_under_cli(bool conside_custom_gcode, D
|
|||
plate_extruders.push_back(obj_support_extr);
|
||||
else if (glb_support_extr != 0)
|
||||
plate_extruders.push_back(glb_support_extr);
|
||||
|
||||
int obj_wall_extr = 1;
|
||||
const ConfigOption* wall_opt = object->config.option("wall_filament");
|
||||
if (wall_opt != nullptr)
|
||||
obj_wall_extr = wall_opt->getInt();
|
||||
if (obj_wall_extr != 1)
|
||||
plate_extruders.push_back(obj_wall_extr);
|
||||
else if (glb_wall_extr != 1)
|
||||
plate_extruders.push_back(glb_wall_extr);
|
||||
|
||||
int obj_sparse_infill_extr = 1;
|
||||
const ConfigOption* sparse_infill_opt = object->config.option("sparse_infill_filament");
|
||||
if (sparse_infill_opt != nullptr)
|
||||
obj_sparse_infill_extr = sparse_infill_opt->getInt();
|
||||
if (obj_sparse_infill_extr != 1)
|
||||
plate_extruders.push_back(obj_sparse_infill_extr);
|
||||
else if (glb_sparse_infill_extr != 1)
|
||||
plate_extruders.push_back(glb_sparse_infill_extr);
|
||||
|
||||
int obj_solid_infill_extr = 1;
|
||||
const ConfigOption* solid_infill_opt = object->config.option("solid_infill_filament");
|
||||
if (solid_infill_opt != nullptr)
|
||||
obj_solid_infill_extr = solid_infill_opt->getInt();
|
||||
if (obj_solid_infill_extr != 1)
|
||||
plate_extruders.push_back(obj_solid_infill_extr);
|
||||
else if (glb_solid_infill_extr != 1)
|
||||
plate_extruders.push_back(glb_solid_infill_extr);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue