mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-10 08:17:51 -06:00
optimize gcode generation
This commit is contained in:
parent
85882c3dde
commit
b47777e73e
2 changed files with 4 additions and 28 deletions
|
@ -3642,14 +3642,6 @@ std::string GCode::extrude_loop(ExtrusionLoop loop, std::string description, dou
|
|||
gcode += m_writer.extrude_to_xy(this->point_to_gcode(pt), 0,"move inwards before travel",true);
|
||||
}
|
||||
|
||||
//BBS: don't reset acceleration when printing first layer. During first layer, acceleration is always same value.
|
||||
if (!this->on_first_layer()) {
|
||||
// reset acceleration
|
||||
if (m_config.default_acceleration.value > 0)
|
||||
gcode += m_writer.set_acceleration((unsigned int)(m_config.default_acceleration.value + 0.5));
|
||||
if (m_config.default_jerk.value > 0)
|
||||
gcode += m_writer.set_jerk_xy(m_config.default_jerk.value);
|
||||
}
|
||||
return gcode;
|
||||
}
|
||||
|
||||
|
@ -3673,14 +3665,7 @@ std::string GCode::extrude_multi_path(ExtrusionMultiPath multipath, std::string
|
|||
}
|
||||
m_wipe.path.reverse();
|
||||
}
|
||||
//BBS: don't reset acceleration when printing first layer. During first layer, acceleration is always same value.
|
||||
if (!this->on_first_layer()) {
|
||||
// reset acceleration
|
||||
if (m_config.default_acceleration.value > 0)
|
||||
gcode += m_writer.set_acceleration((unsigned int)floor(m_config.default_acceleration.value + 0.5));
|
||||
if(m_config.default_jerk.value > 0)
|
||||
gcode += m_writer.set_jerk_xy(m_config.default_jerk.value);
|
||||
}
|
||||
|
||||
return gcode;
|
||||
}
|
||||
|
||||
|
@ -3705,15 +3690,7 @@ std::string GCode::extrude_path(ExtrusionPath path, std::string description, dou
|
|||
m_wipe.path = std::move(path.polyline);
|
||||
m_wipe.path.reverse();
|
||||
}
|
||||
//BBS: don't reset acceleration when printing first layer. During first layer, acceleration is always same value.
|
||||
if (!this->on_first_layer()){
|
||||
// reset acceleration
|
||||
if (m_config.default_acceleration.value > 0)
|
||||
gcode += m_writer.set_acceleration((unsigned int)floor(m_config.default_acceleration.value + 0.5));
|
||||
if(m_config.default_jerk.value > 0)
|
||||
gcode += m_writer.set_jerk_xy(m_config.default_jerk.value);
|
||||
|
||||
}
|
||||
return gcode;
|
||||
}
|
||||
|
||||
|
|
|
@ -177,14 +177,13 @@ std::string GCodeWriter::set_acceleration(unsigned int acceleration)
|
|||
// Use M204 P, we don't want to override travel acc by M204 S (which is deprecated anyway).
|
||||
gcode << "M204 P" << acceleration;
|
||||
} else if (FLAVOR_IS(gcfKlipper) && this->config.accel_to_decel_enable) {
|
||||
gcode << "SET_VELOCITY_LIMIT ACCEL_TO_DECEL=" << acceleration * this->config.accel_to_decel_factor / 100;
|
||||
gcode << "SET_VELOCITY_LIMIT ACCEL=" << acceleration
|
||||
<< " ACCEL_TO_DECEL=" << acceleration * this->config.accel_to_decel_factor / 100;
|
||||
if (GCodeWriter::full_gcode_comment)
|
||||
gcode << " ; adjust ACCEL_TO_DECEL";
|
||||
gcode << "\nM204 S" << acceleration;
|
||||
// Set max accel to decel to half of acceleration
|
||||
} else
|
||||
gcode << "M204 S" << acceleration;
|
||||
|
||||
|
||||
//BBS
|
||||
if (GCodeWriter::full_gcode_comment) gcode << " ; adjust acceleration";
|
||||
gcode << "\n";
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue