Handling brim offset in SLA without the need to slice the object

This commit is contained in:
tamasmeszaros 2023-02-20 14:10:23 +01:00
parent 3c5ecd4a8f
commit 333d0727ef

View file

@ -141,18 +141,32 @@ void ArrangeJob::prepare_selected() {
} }
// If the selection was empty arrange everything // If the selection was empty arrange everything
if (m_selected.empty()) m_selected.swap(m_unselected); if (m_selected.empty())
m_selected.swap(m_unselected);
// The strides have to be removed from the fixed items. For the // The strides have to be removed from the fixed items. For the
// arrangeable (selected) items bed_idx is ignored and the // arrangeable (selected) items bed_idx is ignored and the
// translation is irrelevant. // translation is irrelevant.
for (auto &p : m_unselected) p.translation(X) -= p.bed_idx * stride; for (auto &p : m_unselected)
p.translation(X) -= p.bed_idx * stride;
} }
static void update_arrangepoly_slaprint(arrangement::ArrangePolygon &ret, static void update_arrangepoly_slaprint(arrangement::ArrangePolygon &ret,
const SLAPrintObject &po, const SLAPrintObject &po,
const ModelInstance &inst) const ModelInstance &inst)
{ {
// The 1.1 multiplier is a safety gap, as the offset might be bigger
// in sharp edges of a polygon, depending on clipper's offset algorithm
coord_t pad_infl = 0;
{
double infl = po.config().pad_enable.getBool() * (
po.config().pad_brim_size.getFloat() +
po.config().pad_around_object.getBool() *
po.config().pad_object_gap.getFloat() );
pad_infl = scaled(1.1 * infl);
}
auto laststep = po.last_completed_step(); auto laststep = po.last_completed_step();
if (laststep < slaposCount && laststep > slaposSupportTree) { if (laststep < slaposCount && laststep > slaposSupportTree) {
@ -181,15 +195,9 @@ static void update_arrangepoly_slaprint(arrangement::ArrangePolygon &ret,
polys.emplace_back(its_convex_hull_2d_above(smesh.its, trafo_instance, zlvl)); polys.emplace_back(its_convex_hull_2d_above(smesh.its, trafo_instance, zlvl));
ret.poly.contour = Geometry::convex_hull(polys); ret.poly.contour = Geometry::convex_hull(polys);
ret.poly.holes = {}; ret.poly.holes = {};
// The 1.1 multiplier is a safety gap, as the offset might be bigger
// in sharp edges of a polygon, depending on clipper's offset algorithm
coord_t infl = 1.1 * scaled(po.config().pad_brim_size.getFloat() +
po.config().pad_around_object.getBool() *
po.config().pad_object_gap.getFloat());
ret.inflation = infl;
} }
ret.inflation = pad_infl;
} }
static coord_t brim_offset(const PrintObject &po, const ModelInstance &inst) static coord_t brim_offset(const PrintObject &po, const ModelInstance &inst)