diff --git a/src/slic3r/GUI/3DBed.cpp b/src/slic3r/GUI/3DBed.cpp index a5bbaeeab0..1595ffbc44 100644 --- a/src/slic3r/GUI/3DBed.cpp +++ b/src/slic3r/GUI/3DBed.cpp @@ -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 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; - for (const Vec2d& p : printable_area) { - bounding_box.merge({ p(0), p(1)}); - } - m_position = position - bounding_box.min; + m_position = position; m_bed_shape = printable_area; if ((position(0) != 0) || (position(1) != 0)) { Pointfs new_bed_shape; diff --git a/src/slic3r/GUI/PartPlate.cpp b/src/slic3r/GUI/PartPlate.cpp index df8255dc39..50e5bc014b 100644 --- a/src/slic3r/GUI/PartPlate.cpp +++ b/src/slic3r/GUI/PartPlate.cpp @@ -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 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; -// -// ModelObject* object = m_model->objects[obj_id]; -// ModelInstance* instance = object->instances[instance_id]; -// -// BoundingBoxf3 instance_box = bounding_box? *bounding_box: object->instance_convex_hull_bounding_box(instance_id); -// 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 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); -// -// if (plate_box.contains(instance_box)) -// { -// if (m_exclude_bounding_box.size() > 0) -// { -// int 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 -// if (intersection({ p }, { hull }).empty() == false) -// //if (m_exclude_bounding_box[index].intersects(instance_box)) -// { -// break; -// } -// } -// if (index >= m_exclude_bounding_box.size()) -// outside = false; -// } -// else -// outside = false; -// } -// -// return outside; + bool outside = true; + + ModelObject* object = m_model->objects[obj_id]; + ModelInstance* instance = object->instances[instance_id]; + + BoundingBoxf3 instance_box = bounding_box? *bounding_box: object->instance_convex_hull_bounding_box(instance_id); + 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 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); + + if (plate_box.contains(instance_box)) + { + if (m_exclude_bounding_box.size() > 0) + { + int 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 + if (intersection({ p }, { hull }).empty() == false) + //if (m_exclude_bounding_box[index].intersects(instance_box)) + { + break; + } + } + if (index >= m_exclude_bounding_box.size()) + outside = false; + } + else + outside = false; + } + + return outside; } //judge whether instance is intesected with plate or not diff --git a/src/slic3r/GUI/Plater.cpp b/src/slic3r/GUI/Plater.cpp index 2b84949f0a..fcac4bda99 100644 --- a/src/slic3r/GUI/Plater.cpp +++ b/src/slic3r/GUI/Plater.cpp @@ -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); 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); } }