Skip to content

Commit

Permalink
Revert "Make sure the `m_extrusion_quality_estimator.set_current_obje…
Browse files Browse the repository at this point in the history
…ct()` is called after regional config has been applied (SoftFever#7946)"

This reverts commit d13d4a4.
  • Loading branch information
Noisyfox committed Jan 9, 2025
1 parent c3294e5 commit 13b668f
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 16 deletions.
26 changes: 12 additions & 14 deletions src/libslic3r/GCode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4196,6 +4196,9 @@ LayerResult GCode::process_layer(
}
}

if (m_config.enable_overhang_speed && !m_config.overhang_speed_classic)
m_extrusion_quality_estimator.set_current_object(&instance_to_print.print_object);

// When starting a new object, use the external motion planner for the first travel move.
const Point &offset = instance_to_print.print_object.instances()[instance_to_print.instance_id].shift;
std::pair<const PrintObject*, Point> this_object_copy(&instance_to_print.print_object, offset);
Expand Down Expand Up @@ -4296,10 +4299,10 @@ LayerResult GCode::process_layer(

has_insert_timelapse_gcode = true;
}
gcode += this->extrude_infill(instance_to_print.print_object, by_region_specific, false);
gcode += this->extrude_perimeters(instance_to_print.print_object, by_region_specific);
gcode += this->extrude_infill(print, by_region_specific, false);
gcode += this->extrude_perimeters(print, by_region_specific);
} else {
gcode += this->extrude_perimeters(instance_to_print.print_object, by_region_specific);
gcode += this->extrude_perimeters(print, by_region_specific);
if (!has_wipe_tower && need_insert_timelapse_gcode_for_traditional && !has_insert_timelapse_gcode && has_infill(by_region_specific)) {
gcode += this->retract(false, false, LiftType::NormalLift);

Expand All @@ -4316,10 +4319,10 @@ LayerResult GCode::process_layer(

has_insert_timelapse_gcode = true;
}
gcode += this->extrude_infill(instance_to_print.print_object, by_region_specific, false);
gcode += this->extrude_infill(print,by_region_specific, false);
}
// ironing
gcode += this->extrude_infill(instance_to_print.print_object, by_region_specific, true);
gcode += this->extrude_infill(print,by_region_specific, true);
}

if (this->config().gcode_label_objects) {
Expand Down Expand Up @@ -4914,14 +4917,12 @@ std::string GCode::extrude_path(ExtrusionPath path, std::string description, dou
}

// Extrude perimeters: Decide where to put seams (hide or align seams).
std::string GCode::extrude_perimeters(const PrintObject& print_object, const std::vector<ObjectByExtruder::Island::Region>& by_region)
std::string GCode::extrude_perimeters(const Print &print, const std::vector<ObjectByExtruder::Island::Region> &by_region)
{
std::string gcode;
for (const ObjectByExtruder::Island::Region &region : by_region)
if (! region.perimeters.empty()) {
m_config.apply(print_object.print()->get_print_region(&region - &by_region.front()).config());
if (m_config.enable_overhang_speed && !m_config.overhang_speed_classic)
m_extrusion_quality_estimator.set_current_object(&print_object);
m_config.apply(print.get_print_region(&region - &by_region.front()).config());

for (const ExtrusionEntity* ee : region.perimeters)
gcode += this->extrude_entity(*ee, "perimeter", -1., region.perimeters);
Expand All @@ -4930,7 +4931,7 @@ std::string GCode::extrude_perimeters(const PrintObject& print_object, const std
}

// Chain the paths hierarchically by a greedy algorithm to minimize a travel distance.
std::string GCode::extrude_infill(const PrintObject &print_object, const std::vector<ObjectByExtruder::Island::Region> &by_region, bool ironing)
std::string GCode::extrude_infill(const Print &print, const std::vector<ObjectByExtruder::Island::Region> &by_region, bool ironing)
{
std::string gcode;
ExtrusionEntitiesPtr extrusions;
Expand All @@ -4943,10 +4944,7 @@ std::string GCode::extrude_infill(const PrintObject &print_object, const std::ve
if ((ee->role() == erIroning) == ironing)
extrusions.emplace_back(ee);
if (! extrusions.empty()) {
m_config.apply(print_object.print()->get_print_region(&region - &by_region.front()).config());
if (m_config.enable_overhang_speed && !m_config.overhang_speed_classic)
m_extrusion_quality_estimator.set_current_object(&print_object);

m_config.apply(print.get_print_region(&region - &by_region.front()).config());
chain_and_reorder_extrusion_entities(extrusions, &m_last_pos);
for (const ExtrusionEntity *fill : extrusions) {
auto *eec = dynamic_cast<const ExtrusionEntityCollection*>(fill);
Expand Down
4 changes: 2 additions & 2 deletions src/libslic3r/GCode.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -445,8 +445,8 @@ class GCode {
// For sequential print, the instance of the object to be printing has to be defined.
const size_t single_object_instance_idx);

std::string extrude_perimeters(const PrintObject &print_object, const std::vector<ObjectByExtruder::Island::Region>& by_region);
std::string extrude_infill(const PrintObject &print_object, const std::vector<ObjectByExtruder::Island::Region>& by_region, bool ironing);
std::string extrude_perimeters(const Print& print, const std::vector<ObjectByExtruder::Island::Region>& by_region);
std::string extrude_infill(const Print& print, const std::vector<ObjectByExtruder::Island::Region>& by_region, bool ironing);
std::string extrude_support(const ExtrusionEntityCollection& support_fills);

// BBS
Expand Down

0 comments on commit 13b668f

Please sign in to comment.