Merge branch 'tm_arrange_bugfixes'
This commit is contained in:
commit
624494eab6
@ -396,8 +396,6 @@ public:
|
|||||||
const PConfig& config() const { return m_pconf; }
|
const PConfig& config() const { return m_pconf; }
|
||||||
|
|
||||||
inline void preload(std::vector<Item>& fixeditems) {
|
inline void preload(std::vector<Item>& fixeditems) {
|
||||||
// Build the rtree for queries to work
|
|
||||||
|
|
||||||
for(unsigned idx = 0; idx < fixeditems.size(); ++idx) {
|
for(unsigned idx = 0; idx < fixeditems.size(); ++idx) {
|
||||||
Item& itm = fixeditems[idx];
|
Item& itm = fixeditems[idx];
|
||||||
itm.markAsFixedInBin(itm.binId());
|
itm.markAsFixedInBin(itm.binId());
|
||||||
@ -417,12 +415,9 @@ template<> std::function<double(const Item&)> AutoArranger<Box>::get_objfn()
|
|||||||
double score = std::get<0>(result);
|
double score = std::get<0>(result);
|
||||||
auto& fullbb = std::get<1>(result);
|
auto& fullbb = std::get<1>(result);
|
||||||
|
|
||||||
auto bin = m_bin;
|
double miss = Placer::overfit(fullbb, m_bin);
|
||||||
sl::offset(bin, -EPSILON * (m_bin.width() + m_bin.height()));
|
|
||||||
|
|
||||||
double miss = Placer::overfit(fullbb, bin);
|
|
||||||
miss = miss > 0? miss : 0;
|
miss = miss > 0? miss : 0;
|
||||||
score += miss*miss;
|
score += miss * miss;
|
||||||
|
|
||||||
return score;
|
return score;
|
||||||
};
|
};
|
||||||
@ -490,7 +485,7 @@ void _arrange(
|
|||||||
{
|
{
|
||||||
// Integer ceiling the min distance from the bed perimeters
|
// Integer ceiling the min distance from the bed perimeters
|
||||||
coord_t md = params.min_obj_distance;
|
coord_t md = params.min_obj_distance;
|
||||||
md = (md % 2) ? md / 2 + 1 : md / 2;
|
md = md / 2;
|
||||||
|
|
||||||
auto corrected_bin = bin;
|
auto corrected_bin = bin;
|
||||||
sl::offset(corrected_bin, md);
|
sl::offset(corrected_bin, md);
|
||||||
|
@ -1846,7 +1846,7 @@ void ModelInstance::transform_polygon(Polygon* polygon) const
|
|||||||
|
|
||||||
arrangement::ArrangePolygon ModelInstance::get_arrange_polygon() const
|
arrangement::ArrangePolygon ModelInstance::get_arrange_polygon() const
|
||||||
{
|
{
|
||||||
static const double SIMPLIFY_TOLERANCE_MM = 0.1;
|
// static const double SIMPLIFY_TOLERANCE_MM = 0.1;
|
||||||
|
|
||||||
Vec3d rotation = get_rotation();
|
Vec3d rotation = get_rotation();
|
||||||
rotation.z() = 0.;
|
rotation.z() = 0.;
|
||||||
@ -1860,11 +1860,11 @@ arrangement::ArrangePolygon ModelInstance::get_arrange_polygon() const
|
|||||||
|
|
||||||
// this may happen for malformed models, see:
|
// this may happen for malformed models, see:
|
||||||
// https://github.com/prusa3d/PrusaSlicer/issues/2209
|
// https://github.com/prusa3d/PrusaSlicer/issues/2209
|
||||||
if (!p.points.empty()) {
|
// if (!p.points.empty()) {
|
||||||
Polygons pp{p};
|
// Polygons pp{p};
|
||||||
pp = p.simplify(scaled<double>(SIMPLIFY_TOLERANCE_MM));
|
// pp = p.simplify(scaled<double>(SIMPLIFY_TOLERANCE_MM));
|
||||||
if (!pp.empty()) p = pp.front();
|
// if (!pp.empty()) p = pp.front();
|
||||||
}
|
// }
|
||||||
|
|
||||||
arrangement::ArrangePolygon ret;
|
arrangement::ArrangePolygon ret;
|
||||||
ret.poly.contour = std::move(p);
|
ret.poly.contour = std::move(p);
|
||||||
|
@ -804,6 +804,10 @@ bool GLVolumeCollection::check_outside_state(const DynamicPrintConfig* config, M
|
|||||||
BoundingBoxf3 print_volume(Vec3d(unscale<double>(bed_box_2D.min(0)), unscale<double>(bed_box_2D.min(1)), 0.0), Vec3d(unscale<double>(bed_box_2D.max(0)), unscale<double>(bed_box_2D.max(1)), config->opt_float("max_print_height")));
|
BoundingBoxf3 print_volume(Vec3d(unscale<double>(bed_box_2D.min(0)), unscale<double>(bed_box_2D.min(1)), 0.0), Vec3d(unscale<double>(bed_box_2D.max(0)), unscale<double>(bed_box_2D.max(1)), config->opt_float("max_print_height")));
|
||||||
// Allow the objects to protrude below the print bed
|
// Allow the objects to protrude below the print bed
|
||||||
print_volume.min(2) = -1e10;
|
print_volume.min(2) = -1e10;
|
||||||
|
print_volume.min(0) -= BedEpsilon;
|
||||||
|
print_volume.min(1) -= BedEpsilon;
|
||||||
|
print_volume.max(0) += BedEpsilon;
|
||||||
|
print_volume.max(1) += BedEpsilon;
|
||||||
|
|
||||||
ModelInstanceEPrintVolumeState state = ModelInstancePVS_Inside;
|
ModelInstanceEPrintVolumeState state = ModelInstancePVS_Inside;
|
||||||
|
|
||||||
|
@ -611,6 +611,8 @@ struct _3DScene
|
|||||||
static void point3_to_verts(const Vec3crd& point, double width, double height, GLVolume& volume);
|
static void point3_to_verts(const Vec3crd& point, double width, double height, GLVolume& volume);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static constexpr float BedEpsilon = EPSILON;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -4978,7 +4978,7 @@ void GLCanvas3D::_render_objects() const
|
|||||||
|
|
||||||
if (m_config != nullptr) {
|
if (m_config != nullptr) {
|
||||||
const BoundingBoxf3& bed_bb = wxGetApp().plater()->get_bed().get_bounding_box(false);
|
const BoundingBoxf3& bed_bb = wxGetApp().plater()->get_bed().get_bounding_box(false);
|
||||||
m_volumes.set_print_box((float)bed_bb.min(0), (float)bed_bb.min(1), 0.0f, (float)bed_bb.max(0), (float)bed_bb.max(1), (float)m_config->opt_float("max_print_height"));
|
m_volumes.set_print_box((float)bed_bb.min(0) - BedEpsilon, (float)bed_bb.min(1) - BedEpsilon, 0.0f, (float)bed_bb.max(0) + BedEpsilon, (float)bed_bb.max(1) + BedEpsilon, (float)m_config->opt_float("max_print_height"));
|
||||||
m_volumes.check_outside_state(m_config, nullptr);
|
m_volumes.check_outside_state(m_config, nullptr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user