Merge branch 'main' into dev/bbl-network-upd

This commit is contained in:
Noisyfox
2025-05-05 15:21:17 +08:00
committed by GitHub
189 changed files with 5887 additions and 347 deletions

View File

@@ -14,6 +14,7 @@ BuildVolume::BuildVolume(const std::vector<Vec2d> &printable_area, const double
assert(printable_height >= 0);
m_polygon = Polygon::new_scale(printable_area);
assert(m_polygon.is_counter_clockwise());
// Calcuate various metrics of the input polygon.
m_convex_hull = Geometry::convex_hull(m_polygon.points);

View File

@@ -1410,4 +1410,14 @@ ExPolygons variable_offset_inner_ex(const ExPolygon &expoly, const std::vector<s
return output;
}
Pointfs make_counter_clockwise(const Pointfs& pointfs)
{
Pointfs ps = pointfs;
if (Polygon::new_scale(pointfs).is_clockwise()) {
std::reverse(ps.begin(), ps.end());
}
return ps;
}
}

View File

@@ -661,6 +661,8 @@ Polygons variable_offset_outer(const ExPolygon &expoly, const std::vector<std::
ExPolygons variable_offset_outer_ex(const ExPolygon &expoly, const std::vector<std::vector<float>> &deltas, double miter_limit = 2.);
ExPolygons variable_offset_inner_ex(const ExPolygon &expoly, const std::vector<std::vector<float>> &deltas, double miter_limit = 2.);
Pointfs make_counter_clockwise(const Pointfs& pointfs);
} // namespace Slic3r
#endif // slic3r_ClipperUtils_hpp_

View File

@@ -4337,16 +4337,18 @@ LayerResult GCode::process_layer(
for (ObjectByExtruder::Island &island : instance_to_print.object_by_extruder.islands) {
const auto& by_region_specific = is_anything_overridden ? island.by_region_per_copy(by_region_per_copy_cache, static_cast<unsigned int>(instance_to_print.instance_id), extruder_id, print_wipe_extrusions != 0) : island.by_region;
//BBS: add brim by obj by extruder
if (this->m_objsWithBrim.find(instance_to_print.print_object.id()) != this->m_objsWithBrim.end() && !print_wipe_extrusions) {
this->set_origin(0., 0.);
m_avoid_crossing_perimeters.use_external_mp();
for (const ExtrusionEntity* ee : print.m_brimMap.at(instance_to_print.print_object.id()).entities) {
gcode += this->extrude_entity(*ee, "brim", m_config.support_speed.value);
if (first_layer) {
if (this->m_objsWithBrim.find(instance_to_print.print_object.id()) != this->m_objsWithBrim.end() && !print_wipe_extrusions) {
this->set_origin(0., 0.);
m_avoid_crossing_perimeters.use_external_mp();
for (const ExtrusionEntity* ee : print.m_brimMap.at(instance_to_print.print_object.id()).entities) {
gcode += this->extrude_entity(*ee, "brim", m_config.support_speed.value);
}
m_avoid_crossing_perimeters.use_external_mp(false);
// Allow a straight travel move to the first object point.
m_avoid_crossing_perimeters.disable_once();
this->m_objsWithBrim.erase(instance_to_print.print_object.id());
}
m_avoid_crossing_perimeters.use_external_mp(false);
// Allow a straight travel move to the first object point.
m_avoid_crossing_perimeters.disable_once();
this->m_objsWithBrim.erase(instance_to_print.print_object.id());
}
// 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;

View File

@@ -831,7 +831,7 @@ void GCodeProcessor::apply_config(const DynamicPrintConfig& config)
const ConfigOptionPoints* printable_area = config.option<ConfigOptionPoints>("printable_area");
if (printable_area != nullptr)
m_result.printable_area = printable_area->values;
m_result.printable_area = make_counter_clockwise(printable_area->values);
//BBS: add bed_exclude_area
const ConfigOptionPoints* bed_exclude_area = config.option<ConfigOptionPoints>("bed_exclude_area");

View File

@@ -8117,15 +8117,15 @@ Points get_bed_shape(const DynamicPrintConfig &config)
return {};
}
return to_points(bed_shape_opt->values);
return to_points(make_counter_clockwise(bed_shape_opt->values));
}
Points get_bed_shape(const PrintConfig &cfg)
{
return to_points(cfg.printable_area.values);
return to_points(make_counter_clockwise(cfg.printable_area.values));
}
Points get_bed_shape(const SLAPrinterConfig &cfg) { return to_points(cfg.printable_area.values); }
Points get_bed_shape(const SLAPrinterConfig &cfg) { return to_points(make_counter_clockwise(cfg.printable_area.values)); }
Polygon get_bed_shape_with_excluded_area(const PrintConfig& cfg)
{

View File

@@ -676,9 +676,9 @@ CustomGCode::Info CalibPressureAdvancePattern::generate_custom_gcodes(const Dyna
/* Draw a line at slightly slower accel and speed in order to trick gcode writer to force update acceleration and speed.
* We do this since several tests may be generated by their own gcode writers which are
* not aware about their neighbours updating acceleration/speed */
gcode << m_writer.set_print_acceleration(accel - 10);
gcode << m_writer.set_print_acceleration(std::max<int>(1, accel - 1));
gcode << move_to(Vec2d(m_starting_point.x(), m_starting_point.y()), m_writer, "Move to starting point", zhop_height, layer_height);
gcode << draw_line(m_writer, Vec2d(m_starting_point.x(), m_starting_point.y() + frame_size_y()), line_width(), height_layer(), speed_adjust(speed_perimeter() - 10), "Accel/flow trick line");
gcode << draw_line(m_writer, Vec2d(m_starting_point.x(), m_starting_point.y() + frame_size_y()), line_width(), height_layer(), speed_adjust(std::max<int>(1, speed_perimeter() - 1)), "Accel/flow trick line");
gcode << m_writer.set_print_acceleration(accel);
}