mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-13 01:37:53 -06:00
wip
This commit is contained in:
parent
094611a17c
commit
35d8c101fb
4 changed files with 43 additions and 39 deletions
|
@ -233,7 +233,11 @@ 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();
|
||||
m_position = position;
|
||||
BoundingBoxf bounding_box;
|
||||
for (const Vec2d& p : printable_area) {
|
||||
bounding_box.merge({ p(0), p(1)});
|
||||
}
|
||||
m_position = position - bounding_box.min;
|
||||
m_bed_shape = printable_area;
|
||||
if ((position(0) != 0) || (position(1) != 0)) {
|
||||
Pointfs new_bed_shape;
|
||||
|
|
|
@ -56,7 +56,6 @@ void BedShape::append_option_line(ConfigOptionsGroupShp optgroup, Parameter para
|
|||
def.max = 1073.5;
|
||||
def.label = get_option_label(param);
|
||||
def.tooltip = L("Distance of the 0,0 G-code coordinate from the front left corner of the rectangle.");
|
||||
def.readonly = true;
|
||||
key = "rect_origin";
|
||||
break;
|
||||
case Parameter::Diameter:
|
||||
|
@ -192,9 +191,9 @@ void BedShapePanel::build_panel(const ConfigOptionPoints& default_pt, const Conf
|
|||
BedShape::append_option_line(optgroup, BedShape::Parameter::RectOrigin);
|
||||
activate_options_page(optgroup);
|
||||
|
||||
// optgroup = init_shape_options_page(BedShape::get_name(BedShape::PageType::Circle));
|
||||
// BedShape::append_option_line(optgroup, BedShape::Parameter::Diameter);
|
||||
// activate_options_page(optgroup);
|
||||
optgroup = init_shape_options_page(BedShape::get_name(BedShape::PageType::Circle));
|
||||
BedShape::append_option_line(optgroup, BedShape::Parameter::Diameter);
|
||||
activate_options_page(optgroup);
|
||||
|
||||
optgroup = init_shape_options_page(BedShape::get_name(BedShape::PageType::Custom));
|
||||
|
||||
|
|
|
@ -1718,39 +1718,40 @@ 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)
|
||||
{
|
||||
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;
|
||||
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;
|
||||
}
|
||||
|
||||
//judge whether instance is intesected with plate or not
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue