ENH: use print volume to clip tree support

So tree supports won't go outside the bed.

Known issue:
1. moving won't trigger support re-calculating, so if you want to
  clip the supports in a different way after moving, you need to change
  the support settings (eg change threshold angle to 31 degrees).
2. clipping with the occlusion region is not complete, and an error
  message of "outside toolpath" will still be popped because we use
  convex hull to detection confliction.

Jira: STUDIO-2036

Change-Id: I643b14618eb18ffa9825072c44f677e51b0ff937
(cherry picked from commit a6217824dc0f490027e16f80f810d176dec6004b)
This commit is contained in:
Arthur Tang 2022-12-15 13:03:53 +08:00 committed by Lane.Wei
parent b144aae5bd
commit c07dcffe16
4 changed files with 38 additions and 17 deletions

View file

@ -4793,6 +4793,26 @@ Points get_bed_shape(const PrintConfig &cfg)
Points get_bed_shape(const SLAPrinterConfig &cfg) { return to_points(cfg.printable_area.values); }
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();
}
}
auto tmp = diff({ bed_poly }, exclude_polys);
if (!tmp.empty()) bed_poly = tmp[0];
return bed_poly;
}
} // namespace Slic3r
#include <cereal/types/polymorphic.hpp>