ENH: using shared area for fillbeds when obj is small
when obj is small, it uses the full build volume to compute the empty cell we need to use the shared one jira: STUDIO-9583 Change-Id: I4cc183df38e054a7b94579637a49168c2fb77992 (cherry picked from commit fea423cdad4ee1a24c077cfeed99962e89953d5b)
This commit is contained in:
parent
8bafed6e0a
commit
06d483ee46
|
@ -7590,7 +7590,7 @@ static Points to_points(const std::vector<Vec2d> &dpts)
|
||||||
return pts;
|
return pts;
|
||||||
}
|
}
|
||||||
|
|
||||||
static Polygon get_shared_poly(const std::vector<Pointfs>& extruder_polys)
|
Polygon get_shared_poly(const std::vector<Pointfs>& extruder_polys)
|
||||||
{
|
{
|
||||||
Polygon result;
|
Polygon result;
|
||||||
for (int index = 0; index < extruder_polys.size(); index++)
|
for (int index = 0; index < extruder_polys.size(); index++)
|
||||||
|
|
|
@ -1529,6 +1529,7 @@ private:
|
||||||
static PrintAndCLIConfigDef s_def;
|
static PrintAndCLIConfigDef s_def;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Polygon get_shared_poly(const std::vector<Pointfs>& extruder_polys);
|
||||||
Points get_bed_shape(const DynamicPrintConfig &cfg, bool use_share = true);
|
Points get_bed_shape(const DynamicPrintConfig &cfg, bool use_share = true);
|
||||||
Points get_bed_shape(const PrintConfig &cfg, bool use_share = false);
|
Points get_bed_shape(const PrintConfig &cfg, bool use_share = false);
|
||||||
Points get_bed_shape(const SLAPrinterConfig &cfg);
|
Points get_bed_shape(const SLAPrinterConfig &cfg);
|
||||||
|
|
|
@ -2479,6 +2479,32 @@ const BoundingBox PartPlate::get_bounding_box_crd()
|
||||||
return plate_shape.bounding_box();
|
return plate_shape.bounding_box();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
BoundingBoxf3 PartPlate::get_build_volume(bool use_share)
|
||||||
|
{
|
||||||
|
auto eps=Slic3r::BuildVolume::SceneEpsilon;
|
||||||
|
Vec3d up_point;
|
||||||
|
Vec3d low_point;
|
||||||
|
if (use_share && !m_extruder_areas.empty()) {
|
||||||
|
Polygon bed_poly = get_shared_poly(m_extruder_areas);
|
||||||
|
BoundingBox bbox = bed_poly.bounding_box();
|
||||||
|
|
||||||
|
up_point = Vec3d(unscale_(bbox.max.x()) + eps, unscale_(bbox.max.y()) + eps, m_origin.z() + m_height + eps);
|
||||||
|
low_point = Vec3d(unscale_(bbox.min.x()) - eps, unscale_(bbox.min.y()) - eps, m_origin.z() - eps);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
up_point = Vec3d(m_origin.x() + m_width + eps, m_origin.y() + m_depth + eps, m_origin.z() + m_height + eps);
|
||||||
|
low_point = Vec3d(m_origin.x() - eps, m_origin.y() - eps, m_origin.z() - eps);
|
||||||
|
if (m_raw_shape.size() > 0) {
|
||||||
|
up_point.x() += m_raw_shape[0].x();
|
||||||
|
up_point.y() += m_raw_shape[0].y();
|
||||||
|
low_point.x() += m_raw_shape[0].x();
|
||||||
|
low_point.y() += m_raw_shape[0].y();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
BoundingBoxf3 plate_box(low_point, up_point);
|
||||||
|
return plate_box;
|
||||||
|
}
|
||||||
|
|
||||||
bool PartPlate::contains(const Vec3d& point) const
|
bool PartPlate::contains(const Vec3d& point) const
|
||||||
{
|
{
|
||||||
return m_bounding_box.contains(point);
|
return m_bounding_box.contains(point);
|
||||||
|
|
|
@ -383,20 +383,7 @@ public:
|
||||||
const BoundingBoxf3& get_bounding_box(bool extended = false) { return extended ? m_extended_bounding_box : m_bounding_box; }
|
const BoundingBoxf3& get_bounding_box(bool extended = false) { return extended ? m_extended_bounding_box : m_bounding_box; }
|
||||||
const BoundingBox get_bounding_box_crd();
|
const BoundingBox get_bounding_box_crd();
|
||||||
BoundingBoxf3 get_plate_box() {return get_build_volume();}
|
BoundingBoxf3 get_plate_box() {return get_build_volume();}
|
||||||
BoundingBoxf3 get_build_volume()
|
BoundingBoxf3 get_build_volume(bool use_share = false);
|
||||||
{
|
|
||||||
auto eps=Slic3r::BuildVolume::SceneEpsilon;
|
|
||||||
Vec3d up_point = Vec3d(m_origin.x() + m_width + eps, m_origin.y() + m_depth + eps, m_origin.z() + m_height + eps);
|
|
||||||
Vec3d low_point = Vec3d(m_origin.x() - eps, m_origin.y() - eps, m_origin.z() - eps);
|
|
||||||
if (m_raw_shape.size() > 0) {
|
|
||||||
up_point.x() += m_raw_shape[0].x();
|
|
||||||
up_point.y() += m_raw_shape[0].y();
|
|
||||||
low_point.x() += m_raw_shape[0].x();
|
|
||||||
low_point.y() += m_raw_shape[0].y();
|
|
||||||
}
|
|
||||||
BoundingBoxf3 plate_box(low_point, up_point);
|
|
||||||
return plate_box;
|
|
||||||
}
|
|
||||||
|
|
||||||
const std::vector<BoundingBoxf3>& get_exclude_areas() { return m_exclude_bounding_box; }
|
const std::vector<BoundingBoxf3>& get_exclude_areas() { return m_exclude_bounding_box; }
|
||||||
|
|
||||||
|
|
|
@ -15052,7 +15052,7 @@ void Plater::clone_selection()
|
||||||
std::vector<Vec2f> Plater::get_empty_cells(const Vec2f step)
|
std::vector<Vec2f> Plater::get_empty_cells(const Vec2f step)
|
||||||
{
|
{
|
||||||
PartPlate* plate = wxGetApp().plater()->get_partplate_list().get_curr_plate();
|
PartPlate* plate = wxGetApp().plater()->get_partplate_list().get_curr_plate();
|
||||||
BoundingBoxf3 build_volume = plate->get_build_volume();
|
BoundingBoxf3 build_volume = plate->get_build_volume(true);
|
||||||
Vec2d vmin(build_volume.min.x(), build_volume.min.y()), vmax(build_volume.max.x(), build_volume.max.y());
|
Vec2d vmin(build_volume.min.x(), build_volume.min.y()), vmax(build_volume.max.x(), build_volume.max.y());
|
||||||
BoundingBoxf bbox(vmin, vmax);
|
BoundingBoxf bbox(vmin, vmax);
|
||||||
std::vector<Vec2f> cells;
|
std::vector<Vec2f> cells;
|
||||||
|
|
Loading…
Reference in New Issue