Skip to content

Commit

Permalink
ENH: large object with size close to bed could arrange into bed
Browse files Browse the repository at this point in the history
Change large object's inflation to (bedsize-objectsize)/2 when it could actually be placed into bed but couldn't with default inflation.
JIRA: STUDIO-1536

Change-Id: Ibf8ed066ee20a9a7b1c604371a9e030c94711080
(cherry picked from commit 093bad1a1765f05d909984d24a113e125870d55b)
  • Loading branch information
miaoxin authored and lanewei120 committed Dec 15, 2022
1 parent 41c310b commit ad22dec
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions src/slic3r/GUI/Jobs/ArrangeJob.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -534,7 +534,18 @@ void ArrangeJob::process()
}

// do not inflate brim_width. Objects are allowed to have overlapped brim.
std::for_each(m_selected.begin(), m_selected.end(), [&](auto& ap) {ap.inflation = params.min_obj_distance / 2; });
Points bedpts = get_bed_shape(*m_plater->config());
BoundingBox bedbb = Polygon(bedpts).bounding_box();
std::for_each(m_selected.begin(), m_selected.end(), [&](ArrangePolygon &ap) {
ap.inflation = params.min_obj_distance / 2;
BoundingBox apbb = ap.poly.contour.bounding_box();
coord_t diffx = bedbb.size().x() - apbb.size().x();
coord_t diffy = bedbb.size().y() - apbb.size().y();
if (diffx > 0 && diffy > 0) {
coord_t min_diff = std::min(diffx, diffy);
ap.inflation = std::min(min_diff / 2, ap.inflation);
}
});
// For occulusion regions, inflation should be larger to prevent genrating brim on them.
// However, extrusion cali regions are exceptional, since we can allow brim overlaps them.
// 屏蔽区域只需要膨胀brim宽度,防止brim长过去;挤出标定区域不需要膨胀,brim可以长过去。
Expand All @@ -551,7 +562,6 @@ void ArrangeJob::process()
partplate_list.preprocess_exclude_areas(params.excluded_regions, 1, scaled_exclusion_gap);

// shrink bed by moving to center by dist
Points bedpts = get_bed_shape(*m_plater->config());
auto shrinkFun = [](Points& bedpts, double dist, int direction) {
#define SGN(x) ((x)>=0?1:-1)
Point center = Polygon(bedpts).bounding_box().center();
Expand Down

0 comments on commit ad22dec

Please sign in to comment.