Skip to content

Commit

Permalink
SPE-2578: Fix avoid crossing perimeters (#13445, #13478, #12432, #13669
Browse files Browse the repository at this point in the history
…):

- Turn off external motion planner when the instance is the same for layer
change.
- Properly set the instance shift for travel_to_first_position. Affects
  simple rectangular layer change.
  • Loading branch information
SachCZ authored and lukasmatena committed Dec 2, 2024
1 parent c7d9e55 commit 9aed420
Showing 1 changed file with 19 additions and 2 deletions.
21 changes: 19 additions & 2 deletions src/libslic3r/GCode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2583,7 +2583,13 @@ LayerResult GCodeGenerator::process_layer(
*layers[instance_to_print.object_layer_to_print_id].layer());
this->set_origin(unscale(first_instance->shift));

m_avoid_crossing_perimeters.use_external_mp_once = true;
const GCode::PrintObjectInstance next_instance{
&instances_to_print.front().print_object,
int(instances_to_print.front().instance_id)
};
if (m_current_instance != next_instance) {
m_avoid_crossing_perimeters.use_external_mp_once = true;
}
}

gcode += this->change_layer(previous_layer_z, print_z, result.spiral_vase_enable, first_point.head<2>(), first_layer); // this will increase m_layer_index
Expand Down Expand Up @@ -2677,12 +2683,23 @@ LayerResult GCodeGenerator::process_layer(
}

if (!this->m_moved_to_first_layer_point) {
gcode += this->travel_to_first_position(first_point, print_z, ExtrusionRole::Mixed, [this]() {
const Point shift{first_instance->shift};
this->set_origin(unscale(shift));

const GCode::PrintObjectInstance next_instance{
&instances_to_print.front().print_object,
int(instances_to_print.front().instance_id)
};
if (m_current_instance != next_instance) {
m_avoid_crossing_perimeters.use_external_mp_once = true;
}
gcode += this->travel_to_first_position(first_point - to_3d(shift, 0), print_z, ExtrusionRole::Mixed, [this]() {
if (m_writer.multiple_extruders) {
return std::string{""};
}
return m_label_objects.maybe_change_instance(m_writer);
});
this->set_origin({0, 0});
}

if (!extruder_extrusions.skirt.empty()) {
Expand Down

0 comments on commit 9aed420

Please sign in to comment.