mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-08 15:37:30 -06:00
Merge branch 'main' into enh-port-edit-gcode-dlg
# Conflicts: # src/slic3r/GUI/OG_CustomCtrl.cpp # src/slic3r/GUI/OG_CustomCtrl.hpp
This commit is contained in:
commit
f78d55eac5
265 changed files with 29219 additions and 7128 deletions
|
@ -3077,7 +3077,8 @@ static bool custom_gcode_sets_temperature(const std::string &gcode, const int mc
|
|||
void GCode::print_machine_envelope(GCodeOutputStream &file, Print &print)
|
||||
{
|
||||
const auto flavor = print.config().gcode_flavor.value;
|
||||
if (flavor == gcfMarlinLegacy || flavor == gcfMarlinFirmware) {
|
||||
if ((flavor == gcfMarlinLegacy || flavor == gcfMarlinFirmware || flavor == gcfRepRapFirmware) &&
|
||||
print.config().emit_machine_limits_to_gcode.value == true) {
|
||||
int factor = flavor == gcfRepRapFirmware ? 60 : 1; // RRF M203 and M566 are in mm/min
|
||||
file.write_format("M201 X%d Y%d Z%d E%d\n",
|
||||
int(print.config().machine_max_acceleration_x.values.front() + 0.5),
|
||||
|
@ -3120,7 +3121,6 @@ void GCode::print_machine_envelope(GCodeOutputStream &file, Print &print)
|
|||
print.config().machine_max_jerk_y.values.front() * factor,
|
||||
print.config().machine_max_jerk_z.values.front() * factor,
|
||||
print.config().machine_max_jerk_e.values.front() * factor);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -4515,6 +4515,58 @@ std::string GCode::extrude_loop(ExtrusionLoop loop, std::string description, dou
|
|||
|
||||
// extrude along the path
|
||||
std::string gcode;
|
||||
|
||||
// Port of "wipe inside before extruding an external perimeter" feature from super slicer
|
||||
if (m_config.wipe_before_external_loop.value && !paths.empty() && paths.front().size() > 1 && paths.back().size() > 1 && paths.front().role() == erExternalPerimeter) {
|
||||
const bool is_full_loop_ccw = loop.polygon().is_counter_clockwise();
|
||||
bool is_hole_loop = (loop.loop_role() & ExtrusionLoopRole::elrHole) != 0; // loop.make_counter_clockwise();
|
||||
const double nozzle_diam = EXTRUDER_CONFIG(nozzle_diameter);
|
||||
|
||||
// note: previous & next are inverted to extrude "in the opposite direction, and we are "rewinding"
|
||||
Point previous_point = paths.front().polyline.points[1];
|
||||
Point current_point = paths.front().polyline.points.front();
|
||||
Point next_point = paths.back().polyline.points.back();
|
||||
|
||||
// can happen if seam_gap is null
|
||||
if (next_point == current_point) {
|
||||
next_point = paths.back().polyline.points[paths.back().polyline.points.size() - 2];
|
||||
}
|
||||
|
||||
Point a = next_point; // second point
|
||||
Point b = previous_point; // second to last point
|
||||
if ((is_hole_loop ? !is_full_loop_ccw : is_full_loop_ccw)) {
|
||||
// swap points
|
||||
std::swap(a, b);
|
||||
}
|
||||
|
||||
double angle = current_point.ccw_angle(a, b) / 3;
|
||||
|
||||
// turn outwards if contour, turn inwwards if hole
|
||||
if (is_hole_loop ? !is_full_loop_ccw : is_full_loop_ccw) angle *= -1;
|
||||
|
||||
Vec2d current_pos = current_point.cast<double>();
|
||||
Vec2d next_pos = next_point.cast<double>();
|
||||
Vec2d vec_dist = next_pos - current_pos;
|
||||
double vec_norm = vec_dist.norm();
|
||||
// Offset distance is the minimum between half the nozzle diameter or half the line width for the upcomming perimeter
|
||||
// This is to mimimize potential instances where the de-retraction is performed on top of a neighbouring
|
||||
// thin perimeter due to arachne reducing line width.
|
||||
coordf_t dist = std::min(scaled(nozzle_diam) * 0.5, scaled(paths.front().width) * 0.5);
|
||||
|
||||
// FIXME Hiding the seams will not work nicely for very densely discretized contours!
|
||||
Point pt = (current_pos + vec_dist * (2 * dist / vec_norm)).cast<coord_t>();
|
||||
pt.rotate(angle, current_point);
|
||||
pt = (current_pos + vec_dist * (2 * dist / vec_norm)).cast<coord_t>();
|
||||
pt.rotate(angle, current_point);
|
||||
|
||||
// use extrude instead of travel_to_xy to trigger the unretract
|
||||
ExtrusionPath fake_path_wipe(Polyline{pt, current_point}, paths.front());
|
||||
fake_path_wipe.mm3_per_mm = 0;
|
||||
gcode += extrude_path(fake_path_wipe, "move inwards before retraction/seam", speed);
|
||||
}
|
||||
|
||||
|
||||
|
||||
bool is_small_peri = false;
|
||||
for (ExtrusionPaths::iterator path = paths.begin(); path != paths.end(); ++path) {
|
||||
// description += ExtrusionLoop::role_to_string(loop.loop_role());
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue