mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-06 22:47:32 -06:00
Fix tree support bed exclusion area calculation (#9633)
Fix tree support bed exclusion area calculation (SoftFever/OrcaSlicer#9624)
This commit is contained in:
parent
c93e321ef0
commit
4ae4634976
4 changed files with 26 additions and 46 deletions
|
@ -548,19 +548,11 @@ std::vector<size_t> Print::layers_sorted_for_object(float start, float end, std:
|
|||
StringObjectException Print::sequential_print_clearance_valid(const Print &print, Polygons *polygons, std::vector<std::pair<Polygon, float>>* height_polygons)
|
||||
{
|
||||
StringObjectException single_object_exception;
|
||||
auto print_config = print.config();
|
||||
Pointfs excluse_area_points = print_config.bed_exclude_area.values;
|
||||
Polygons exclude_polys;
|
||||
Polygon exclude_poly;
|
||||
const auto& print_config = print.config();
|
||||
Polygons exclude_polys = get_bed_excluded_area(print_config);
|
||||
const Vec3d print_origin = print.get_plate_origin();
|
||||
for (int i = 0; i < excluse_area_points.size(); i++) {
|
||||
auto pt = excluse_area_points[i];
|
||||
exclude_poly.points.emplace_back(scale_(pt.x() + print_origin.x()), scale_(pt.y() + print_origin.y()));
|
||||
if (i % 4 == 3) { // exclude areas are always rectangle
|
||||
exclude_polys.push_back(exclude_poly);
|
||||
exclude_poly.points.clear();
|
||||
}
|
||||
}
|
||||
std::for_each(exclude_polys.begin(), exclude_polys.end(),
|
||||
[&print_origin](Polygon& p) { p.translate(scale_(print_origin.x()), scale_(print_origin.y())); });
|
||||
|
||||
std::map<ObjectID, Polygon> map_model_object_to_convex_hull;
|
||||
struct print_instance_info
|
||||
|
@ -887,19 +879,11 @@ static StringObjectException layered_print_cleareance_valid(const Print &print,
|
|||
if (print_instances_ordered.size() < 1)
|
||||
return {};
|
||||
|
||||
auto print_config = print.config();
|
||||
Pointfs excluse_area_points = print_config.bed_exclude_area.values;
|
||||
Polygons exclude_polys;
|
||||
Polygon exclude_poly;
|
||||
const auto& print_config = print.config();
|
||||
Polygons exclude_polys = get_bed_excluded_area(print_config);
|
||||
const Vec3d print_origin = print.get_plate_origin();
|
||||
for (int i = 0; i < excluse_area_points.size(); i++) {
|
||||
auto pt = excluse_area_points[i];
|
||||
exclude_poly.points.emplace_back(scale_(pt.x() + print_origin.x()), scale_(pt.y() + print_origin.y()));
|
||||
if (i % 4 == 3) { // exclude areas are always rectangle
|
||||
exclude_polys.push_back(exclude_poly);
|
||||
exclude_poly.points.clear();
|
||||
}
|
||||
}
|
||||
std::for_each(exclude_polys.begin(), exclude_polys.end(),
|
||||
[&print_origin](Polygon& p) { p.translate(scale_(print_origin.x()), scale_(print_origin.y())); });
|
||||
|
||||
std::map<const PrintInstance*, Polygon> map_model_object_to_convex_hull;
|
||||
// sequential_print_horizontal_clearance_valid
|
||||
|
|
|
@ -8154,22 +8154,27 @@ Points get_bed_shape(const PrintConfig &cfg)
|
|||
|
||||
Points get_bed_shape(const SLAPrinterConfig &cfg) { return to_points(make_counter_clockwise(cfg.printable_area.values)); }
|
||||
|
||||
Polygons get_bed_excluded_area(const PrintConfig& cfg)
|
||||
{
|
||||
const Pointfs exclude_area_points = cfg.bed_exclude_area.values;
|
||||
|
||||
Polygon exclude_poly;
|
||||
for (int i = 0; i < exclude_area_points.size(); i++) {
|
||||
auto pt = exclude_area_points[i];
|
||||
exclude_poly.points.emplace_back(scale_(pt.x()), scale_(pt.y()));
|
||||
}
|
||||
|
||||
exclude_poly.make_counter_clockwise();
|
||||
|
||||
return {exclude_poly};
|
||||
}
|
||||
|
||||
Polygon get_bed_shape_with_excluded_area(const PrintConfig& cfg)
|
||||
{
|
||||
Polygon bed_poly;
|
||||
bed_poly.points = get_bed_shape(cfg);
|
||||
|
||||
Points excluse_area_points = to_points(cfg.bed_exclude_area.values);
|
||||
Polygons exclude_polys;
|
||||
Polygon exclude_poly;
|
||||
for (int i = 0; i < excluse_area_points.size(); i++) {
|
||||
auto pt = excluse_area_points[i];
|
||||
exclude_poly.points.emplace_back(pt);
|
||||
if (i % 4 == 3) { // exclude areas are always rectangle
|
||||
exclude_polys.push_back(exclude_poly);
|
||||
exclude_poly.points.clear();
|
||||
}
|
||||
}
|
||||
Polygons exclude_polys = get_bed_excluded_area(cfg);
|
||||
auto tmp = diff({ bed_poly }, exclude_polys);
|
||||
if (!tmp.empty()) bed_poly = tmp[0];
|
||||
return bed_poly;
|
||||
|
|
|
@ -1738,6 +1738,7 @@ bool is_XL_printer(const PrintConfig &cfg);
|
|||
Points get_bed_shape(const DynamicPrintConfig &cfg);
|
||||
Points get_bed_shape(const PrintConfig &cfg);
|
||||
Points get_bed_shape(const SLAPrinterConfig &cfg);
|
||||
Slic3r::Polygons get_bed_excluded_area(const PrintConfig& cfg);
|
||||
Slic3r::Polygon get_bed_shape_with_excluded_area(const PrintConfig& cfg);
|
||||
bool has_skirt(const DynamicPrintConfig& cfg);
|
||||
float get_real_skirt_dist(const DynamicPrintConfig& cfg);
|
||||
|
|
|
@ -458,17 +458,7 @@ void ArrangeJob::prepare()
|
|||
auto& print = wxGetApp().plater()->get_partplate_list().get_current_fff_print();
|
||||
auto print_config = print.config();
|
||||
bed_poly.points = get_bed_shape(*m_plater->config());
|
||||
Pointfs excluse_area_points = print_config.bed_exclude_area.values;
|
||||
Polygons exclude_polys;
|
||||
Polygon exclude_poly;
|
||||
for (int i = 0; i < excluse_area_points.size(); i++) {
|
||||
auto pt = excluse_area_points[i];
|
||||
exclude_poly.points.emplace_back(scale_(pt.x()), scale_(pt.y()));
|
||||
if (i % 4 == 3) { // exclude areas are always rectangle
|
||||
exclude_polys.push_back(exclude_poly);
|
||||
exclude_poly.points.clear();
|
||||
}
|
||||
}
|
||||
Polygons exclude_polys = get_bed_excluded_area(print_config);
|
||||
bed_poly = diff({ bed_poly }, exclude_polys)[0];
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue