#241 big lift-z for the move to object on first layer (2*first_layer_height)

can be disable if no z-lift is used for the extruder of the current object.
can be enable with no z-lift by using random value for z-lift and retract_lift_above to 9999
This commit is contained in:
supermerill 2020-05-16 00:26:50 +02:00
parent 226626e1f9
commit 75b8d01e45
3 changed files with 18 additions and 0 deletions

View File

@ -2332,6 +2332,14 @@ void GCode::process_layer(
gcode += std::string("; printing object ") + instance_to_print.print_object.model_object()->name
+ " id:" + std::to_string(std::find(this->m_ordered_objects.begin(), this->m_ordered_objects.end(), &instance_to_print.print_object) - this->m_ordered_objects.begin())
+ " copy " + std::to_string(instance_to_print.instance_id) + "\n";
//if first layer, ask for a bigger lift for travel to object, to be on the safe side
if (layer.id() == 0 && print.config().retract_lift.get_at(extruder_id) != 0) {
//get biggest first layer height and set extra lift for first travel, to be safe.
double extra_lift_value = 0;
for (const PrintObject* obj : print.objects())
extra_lift_value = std::max(extra_lift_value, obj->config().first_layer_height.get_abs_value(print.config().nozzle_diameter.get_at(0)));
m_writer.set_extra_lift(extra_lift_value * 2);
}
// 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);

View File

@ -503,6 +503,12 @@ std::string GCodeWriter::lift()
if (m_pos.z() >= above && (below == 0 || m_pos.z() <= below))
target_lift = this->config.retract_lift.get_at(m_extruder->id());
}
if (this->extra_lift > 0) {
target_lift += this->extra_lift;
this->extra_lift = 0;
}
// compare against epsilon because travel_to_z() does math on it
// and subtracting layer_height from retract_lift might not give
// exactly zero

View File

@ -69,6 +69,7 @@ public:
std::string unlift();
Vec3d get_position() const { return m_pos; }
void set_extra_lift(double extra_zlift) { this->extra_lift = extra_zlift; }
private:
// Extruders are sorted by their ID, so that binary search is possible.
std::vector<Extruder> m_extruders;
@ -87,6 +88,9 @@ private:
std::string _travel_to_z(double z, const std::string &comment);
std::string _retract(double length, double restart_extra, const std::string &comment);
// if positive, it's set, and the next lift wil have this extra lift
double extra_lift = 0;
};
} /* namespace Slic3r */