diff --git a/src/libslic3r/Print.cpp b/src/libslic3r/Print.cpp index b663f48976..702214eca5 100644 --- a/src/libslic3r/Print.cpp +++ b/src/libslic3r/Print.cpp @@ -382,12 +382,12 @@ std::vector Print::object_extruders() const { std::vector 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 Print::object_extruders() const } } } -#endif sort_remove_duplicates(extruders); return extruders; } diff --git a/src/libslic3r/PrintObject.cpp b/src/libslic3r/PrintObject.cpp index 0efc1a5421..30b267c151 100644 --- a/src/libslic3r/PrintObject.cpp +++ b/src/libslic3r/PrintObject.cpp @@ -139,6 +139,9 @@ PrintBase::ApplyStatus PrintObject::set_instances(PrintInstances &&instances) std::vector> PrintObject::all_regions() const { std::vector> out; + if(!m_shared_regions) + return out; + out.reserve(m_shared_regions->all_regions.size()); for (const std::unique_ptr ®ion : m_shared_regions->all_regions) out.emplace_back(*region.get()); @@ -3010,10 +3013,11 @@ std::vector PrintObject::object_extruders() const { std::vector 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 volume_extruders = mv->get_extruders(); @@ -3022,7 +3026,6 @@ std::vector PrintObject::object_extruders() const extruders.push_back(extruder - 1); } } -#endif sort_remove_duplicates(extruders); return extruders; } diff --git a/src/slic3r/GUI/PartPlate.cpp b/src/slic3r/GUI/PartPlate.cpp index 99ec73a42a..1bc2b55adf 100644 --- a/src/slic3r/GUI/PartPlate.cpp +++ b/src/slic3r/GUI/PartPlate.cpp @@ -1359,6 +1359,9 @@ std::vector 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,26 +1395,53 @@ std::vector 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) + obj_support_intf_extr = support_intf_extr_opt->getInt(); + if (obj_support_intf_extr != 0) + plate_extruders.push_back(obj_support_intf_extr); + else if (glb_support_intf_extr != 0) + plate_extruders.push_back(glb_support_intf_extr); - int obj_support_intf_extr = 0; - const ConfigOption* support_intf_extr_opt = mo->config.option("support_interface_filament"); - if (support_intf_extr_opt != nullptr) - obj_support_intf_extr = support_intf_extr_opt->getInt(); - if (obj_support_intf_extr != 0) - plate_extruders.push_back(obj_support_intf_extr); - else if (glb_support_intf_extr != 0) - plate_extruders.push_back(glb_support_intf_extr); + int obj_support_extr = 0; + const ConfigOption* support_extr_opt = mo->config.option("support_filament"); + if (support_extr_opt != nullptr) + obj_support_extr = support_extr_opt->getInt(); + if (obj_support_extr != 0) + 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 = 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); - int obj_support_extr = 0; - const ConfigOption* support_extr_opt = mo->config.option("support_filament"); - if (support_extr_opt != nullptr) - obj_support_extr = support_extr_opt->getInt(); - if (obj_support_extr != 0) - plate_extruders.push_back(obj_support_extr); - else if (glb_support_extr != 0) - plate_extruders.push_back(glb_support_extr); } if (conside_custom_gcode) { @@ -1441,6 +1471,10 @@ std::vector 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 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); } }