mirror of
https://git.mirrors.martin98.com/https://github.com/SoftFever/OrcaSlicer.git
synced 2025-08-12 02:09:03 +08:00
parent
099ed10144
commit
f5d82ee906
@ -4616,13 +4616,13 @@ std::string GCode::set_extruder(unsigned int extruder_id, double print_z)
|
|||||||
return gcode;
|
return gcode;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline std::string polygon_to_string(const Polygon &polygon) {
|
inline std::string polygon_to_string(const Polygon &polygon, const Vec3d& offset) {
|
||||||
std::ostringstream gcode;
|
std::ostringstream gcode;
|
||||||
gcode << "[";
|
gcode << "[";
|
||||||
for (const Point &p : polygon.points) {
|
for (const Point &p : polygon.points) {
|
||||||
gcode << "[" << unscaled(p.x()) << "," << unscaled(p.y()) << "],";
|
gcode << "[" << unscaled(p.x()) - offset.x() << "," << unscaled(p.y()) - offset.y() << "],";
|
||||||
}
|
}
|
||||||
gcode << "[" << unscaled(polygon.points.front().x()) << "," << unscaled(polygon.points.front().y()) << "]";
|
gcode << "[" << unscaled(polygon.points.front().x()) - offset.x() << "," << unscaled(polygon.points.front().y()) - offset.y() << "]";
|
||||||
gcode << "]";
|
gcode << "]";
|
||||||
return gcode.str();
|
return gcode.str();
|
||||||
}
|
}
|
||||||
@ -4638,9 +4638,10 @@ std::string GCode::set_object_info(Print* print) {
|
|||||||
inst.id = inst_id++;
|
inst.id = inst_id++;
|
||||||
if (this->config().exclude_object && print->config().gcode_flavor.value == gcfKlipper) {
|
if (this->config().exclude_object && print->config().gcode_flavor.value == gcfKlipper) {
|
||||||
auto bbox = inst.get_bounding_box();
|
auto bbox = inst.get_bounding_box();
|
||||||
|
auto center = bbox.center() - print->get_plate_origin();
|
||||||
gcode << "EXCLUDE_OBJECT_DEFINE NAME=" << get_instance_name(object, inst)
|
gcode << "EXCLUDE_OBJECT_DEFINE NAME=" << get_instance_name(object, inst)
|
||||||
<< " CENTER=" << bbox.center().x() << "," << bbox.center().y()
|
<< " CENTER=" << center.x() << "," << center.y()
|
||||||
<< " POLYGON=" << polygon_to_string(inst.get_convex_hull_2d()) << "\n";
|
<< " POLYGON=" << polygon_to_string(inst.get_convex_hull_2d(), print->get_plate_origin()) << "\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user