Revert "wip"

This reverts commit 35d8c101fb.
This commit is contained in:
SoftFever 2023-04-08 10:45:42 +08:00
parent 1dec3fe9cb
commit 0d20f13196
3 changed files with 35 additions and 40 deletions

View file

@ -233,11 +233,7 @@ bool Bed3D::set_shape(const Pointfs& printable_area, const double printable_heig
//BBS: add part plate logic, apply position to bed shape //BBS: add part plate logic, apply position to bed shape
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << boost::format(":current position {%1%,%2%}, new position {%3%, %4%}") % m_position.x() % m_position.y() % position.x() % position.y(); BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << boost::format(":current position {%1%,%2%}, new position {%3%, %4%}") % m_position.x() % m_position.y() % position.x() % position.y();
BoundingBoxf bounding_box; m_position = position;
for (const Vec2d& p : printable_area) {
bounding_box.merge({ p(0), p(1)});
}
m_position = position - bounding_box.min;
m_bed_shape = printable_area; m_bed_shape = printable_area;
if ((position(0) != 0) || (position(1) != 0)) { if ((position(0) != 0) || (position(1) != 0)) {
Pointfs new_bed_shape; Pointfs new_bed_shape;

View file

@ -1718,40 +1718,39 @@ bool PartPlate::contain_instance_totally(int obj_id, int instance_id) const
//check whether instance is outside the plate or not //check whether instance is outside the plate or not
bool PartPlate::check_outside(int obj_id, int instance_id, BoundingBoxf3* bounding_box) bool PartPlate::check_outside(int obj_id, int instance_id, BoundingBoxf3* bounding_box)
{ {
return m_plater->get_current_canvas3D()->check_volumes_outside_state(); bool outside = true;
// bool outside = true;
// ModelObject* object = m_model->objects[obj_id];
// ModelObject* object = m_model->objects[obj_id]; ModelInstance* instance = object->instances[instance_id];
// ModelInstance* instance = object->instances[instance_id];
// BoundingBoxf3 instance_box = bounding_box? *bounding_box: object->instance_convex_hull_bounding_box(instance_id);
// BoundingBoxf3 instance_box = bounding_box? *bounding_box: object->instance_convex_hull_bounding_box(instance_id); Polygon hull = instance->convex_hull_2d();
// Polygon hull = instance->convex_hull_2d(); Vec3d up_point(m_origin.x() + m_width + Slic3r::BuildVolume::SceneEpsilon, m_origin.y() + m_depth + Slic3r::BuildVolume::SceneEpsilon, m_origin.z() + m_height + Slic3r::BuildVolume::SceneEpsilon);
// Vec3d up_point(m_origin.x() + m_width + Slic3r::BuildVolume::SceneEpsilon, m_origin.y() + m_depth + Slic3r::BuildVolume::SceneEpsilon, m_origin.z() + m_height + Slic3r::BuildVolume::SceneEpsilon); Vec3d low_point(m_origin.x() - Slic3r::BuildVolume::SceneEpsilon, m_origin.y() - Slic3r::BuildVolume::SceneEpsilon, m_origin.z() - Slic3r::BuildVolume::SceneEpsilon);
// Vec3d low_point(m_origin.x() - Slic3r::BuildVolume::SceneEpsilon, m_origin.y() - Slic3r::BuildVolume::SceneEpsilon, m_origin.z() - Slic3r::BuildVolume::SceneEpsilon); BoundingBoxf3 plate_box(low_point, up_point);
// BoundingBoxf3 plate_box(low_point, up_point);
// if (plate_box.contains(instance_box))
// if (plate_box.contains(instance_box)) {
// { if (m_exclude_bounding_box.size() > 0)
// if (m_exclude_bounding_box.size() > 0) {
// { int index;
// int index; for (index = 0; index < m_exclude_bounding_box.size(); index ++)
// for (index = 0; index < m_exclude_bounding_box.size(); index ++) {
// { Polygon p = m_exclude_bounding_box[index].polygon(true); // instance convex hull is scaled, so we need to scale here
// Polygon p = m_exclude_bounding_box[index].polygon(true); // instance convex hull is scaled, so we need to scale here if (intersection({ p }, { hull }).empty() == false)
// if (intersection({ p }, { hull }).empty() == false) //if (m_exclude_bounding_box[index].intersects(instance_box))
// //if (m_exclude_bounding_box[index].intersects(instance_box)) {
// { break;
// break; }
// } }
// } if (index >= m_exclude_bounding_box.size())
// if (index >= m_exclude_bounding_box.size()) outside = false;
// outside = false; }
// } else
// else outside = false;
// outside = false; }
// }
// return outside;
// return outside;
} }
//judge whether instance is intesected with plate or not //judge whether instance is intesected with plate or not

View file

@ -7001,7 +7001,7 @@ void Plater::priv::set_bed_shape(const Pointfs& shape, const Pointfs& exclude_ar
partplate_list.set_shapes(shape, exclude_areas, custom_texture, height_to_lid, height_to_rod); partplate_list.set_shapes(shape, exclude_areas, custom_texture, height_to_lid, height_to_rod);
Vec2d new_shape_position = partplate_list.get_current_shape_position(); Vec2d new_shape_position = partplate_list.get_current_shape_position();
// if (shape_position != new_shape_position) if (shape_position != new_shape_position)
bed.set_shape(shape, printable_height, custom_model, force_as_custom, new_shape_position); bed.set_shape(shape, printable_height, custom_model, force_as_custom, new_shape_position);
} }
} }