mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-08 23:46:24 -06:00
ENH: fix z hop error issue
This is fix for z hop issue that z hop of layer change is always spiral list even when set to normal lift Signed-off-by: salt.wei <salt.wei@bambulab.com> Change-Id: I7b235a640b0538bedfe4cef61ca24108c1ba7246
This commit is contained in:
parent
c4136f7641
commit
4b63bf453c
2 changed files with 23 additions and 16 deletions
|
@ -3016,8 +3016,11 @@ std::string GCode::change_layer(coordf_t print_z, bool lazy_raise)
|
||||||
//BBS
|
//BBS
|
||||||
//coordf_t z = print_z + m_config.z_offset.value; // in unscaled coordinates
|
//coordf_t z = print_z + m_config.z_offset.value; // in unscaled coordinates
|
||||||
coordf_t z = print_z; // in unscaled coordinates
|
coordf_t z = print_z; // in unscaled coordinates
|
||||||
if (EXTRUDER_CONFIG(retract_when_changing_layer) && m_writer.will_move_z(z))
|
if (EXTRUDER_CONFIG(retract_when_changing_layer) && m_writer.will_move_z(z)) {
|
||||||
gcode += this->retract();
|
LiftType lift_type = this->to_lift_type(m_config.z_hop_type);
|
||||||
|
//BBS: force to use SpiralLift when change layer if lift type is auto
|
||||||
|
gcode += this->retract(false, false, m_config.z_hop_type == ZHopType::zhtAuto? LiftType::SpiralLift : lift_type);
|
||||||
|
}
|
||||||
|
|
||||||
if (!lazy_raise) {
|
if (!lazy_raise) {
|
||||||
std::ostringstream comment;
|
std::ostringstream comment;
|
||||||
|
@ -3728,6 +3731,22 @@ std::string GCode::travel_to(const Point &point, ExtrusionRole role, std::string
|
||||||
return gcode;
|
return gcode;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//BBS
|
||||||
|
LiftType GCode::to_lift_type(ZHopType z_hop_type) {
|
||||||
|
switch (z_hop_type)
|
||||||
|
{
|
||||||
|
case ZHopType::zhtNormal:
|
||||||
|
return LiftType::NormalLift;
|
||||||
|
case ZHopType::zhtSlope:
|
||||||
|
return LiftType::LazyLift;
|
||||||
|
case ZHopType::zhtSpiral:
|
||||||
|
return LiftType::SpiralLift;
|
||||||
|
default:
|
||||||
|
// if no corresponding lift type, use normal lift
|
||||||
|
return LiftType::NormalLift;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
bool GCode::needs_retraction(const Polyline &travel, ExtrusionRole role, LiftType& lift_type)
|
bool GCode::needs_retraction(const Polyline &travel, ExtrusionRole role, LiftType& lift_type)
|
||||||
{
|
{
|
||||||
if (travel.length() < scale_(EXTRUDER_CONFIG(retraction_minimum_travel))) {
|
if (travel.length() < scale_(EXTRUDER_CONFIG(retraction_minimum_travel))) {
|
||||||
|
@ -3764,20 +3783,6 @@ bool GCode::needs_retraction(const Polyline &travel, ExtrusionRole role, LiftTyp
|
||||||
return false;
|
return false;
|
||||||
};
|
};
|
||||||
|
|
||||||
auto to_lift_type = [](ZHopType z_hop_type) {
|
|
||||||
if (z_hop_type == ZHopType::zhtNormal)
|
|
||||||
return LiftType::NormalLift;
|
|
||||||
|
|
||||||
if (z_hop_type == ZHopType::zhtSlope)
|
|
||||||
return LiftType::LazyLift;
|
|
||||||
|
|
||||||
if (z_hop_type == ZHopType::zhtSpiral)
|
|
||||||
return LiftType::SpiralLift;
|
|
||||||
|
|
||||||
// if no corresponding lift type, use normal lift
|
|
||||||
return LiftType::NormalLift;
|
|
||||||
};
|
|
||||||
|
|
||||||
float max_z_hop = 0.f;
|
float max_z_hop = 0.f;
|
||||||
for (int i = 0; i < m_config.z_hop.size(); i++)
|
for (int i = 0; i < m_config.z_hop.size(); i++)
|
||||||
max_z_hop = std::max(max_z_hop, (float)m_config.z_hop.get_at(i));
|
max_z_hop = std::max(max_z_hop, (float)m_config.z_hop.get_at(i));
|
||||||
|
|
|
@ -395,6 +395,8 @@ private:
|
||||||
std::string extrude_support(const ExtrusionEntityCollection &support_fills);
|
std::string extrude_support(const ExtrusionEntityCollection &support_fills);
|
||||||
|
|
||||||
std::string travel_to(const Point &point, ExtrusionRole role, std::string comment);
|
std::string travel_to(const Point &point, ExtrusionRole role, std::string comment);
|
||||||
|
// BBS
|
||||||
|
LiftType to_lift_type(ZHopType z_hop_type);
|
||||||
// BBS: detect lift type in needs_retraction
|
// BBS: detect lift type in needs_retraction
|
||||||
bool needs_retraction(const Polyline& travel, ExtrusionRole role, LiftType& lift_type);
|
bool needs_retraction(const Polyline& travel, ExtrusionRole role, LiftType& lift_type);
|
||||||
std::string retract(bool toolchange = false, bool is_last_retraction = false, LiftType lift_type = LiftType::SpiralLift);
|
std::string retract(bool toolchange = false, bool is_last_retraction = false, LiftType lift_type = LiftType::SpiralLift);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue