mirror of
https://github.com/QIDITECH/QIDISlicer.git
synced 2026-01-30 23:48:44 +03:00
fix some bug
This commit is contained in:
@@ -389,24 +389,29 @@ BuildVolume::ObjectState BuildVolume::volume_state_bbox(const BoundingBoxf3 volu
|
|||||||
BuildVolume::ObjectState BuildVolume::check_outside(Polygon hull) const
|
BuildVolume::ObjectState BuildVolume::check_outside(Polygon hull) const
|
||||||
{
|
{
|
||||||
//y21
|
//y21
|
||||||
const Vec3d bed_offset = s_multiple_beds.get_bed_translation(s_multiple_beds.get_active_bed());
|
int beds_num = s_multiple_beds.get_number_of_beds();
|
||||||
if (m_exclude_bed_shape.size() > 0) {
|
for (int i = 0; i < beds_num; i++)
|
||||||
for (int i = 1; i < m_exclude_bed_shape.size(); i += 7) {
|
{
|
||||||
std::vector<Vec2d> tem_exclude_bed_shap;
|
const Vec3d bed_offset = s_multiple_beds.get_bed_translation(i);
|
||||||
for (int j = 1; j < 6; j++)
|
if (m_exclude_bed_shape.size() > 0) {
|
||||||
tem_exclude_bed_shap.push_back(Vec2d{ m_exclude_bed_shape[i + j].x()+ bed_offset.x(), m_exclude_bed_shape[i + j].y()+ bed_offset.y()});
|
for (int i = 1; i < m_exclude_bed_shape.size(); i += 7) {
|
||||||
BoundingBoxf tem_bboxf = get_extents(tem_exclude_bed_shap);
|
std::vector<Vec2d> tem_exclude_bed_shap;
|
||||||
auto tem_exclude_bboxf = BoundingBoxf3{to_3d(tem_bboxf.min, 0.), to_3d(tem_bboxf.max, m_max_print_height)};
|
for (int j = 1; j < 6; j++)
|
||||||
Slic3r::Polygon p = tem_exclude_bboxf.polygon(true); // instance convex hull is scaled, so we need to scale here
|
tem_exclude_bed_shap.push_back(Vec2d{ m_exclude_bed_shape[i + j].x() + bed_offset.x(), m_exclude_bed_shape[i + j].y() + bed_offset.y() });
|
||||||
if (intersection({p}, {hull}).empty() == false) {
|
BoundingBoxf tem_bboxf = get_extents(tem_exclude_bed_shap);
|
||||||
return ObjectState::Colliding;
|
auto tem_exclude_bboxf = BoundingBoxf3{ to_3d(tem_bboxf.min, 0.), to_3d(tem_bboxf.max, m_max_print_height) };
|
||||||
break;
|
Slic3r::Polygon p = tem_exclude_bboxf.polygon(true); // instance convex hull is scaled, so we need to scale here
|
||||||
}
|
if (intersection({ p }, { hull }).empty() == false) {
|
||||||
|
return ObjectState::Colliding;
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return ObjectState::Inside;
|
}
|
||||||
} else {
|
else {
|
||||||
return ObjectState::Inside;
|
return ObjectState::Inside;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
return ObjectState::Inside;
|
||||||
}
|
}
|
||||||
|
|
||||||
//B52
|
//B52
|
||||||
|
|||||||
@@ -384,6 +384,9 @@ public:
|
|||||||
// Whether or not this object is printable
|
// Whether or not this object is printable
|
||||||
bool printable { true };
|
bool printable { true };
|
||||||
|
|
||||||
|
//y21
|
||||||
|
bool in_exclude{ false };
|
||||||
|
|
||||||
// This vector holds position of selected support points for SLA. The data are
|
// This vector holds position of selected support points for SLA. The data are
|
||||||
// saved in mesh coordinates to allow using them for several instances.
|
// saved in mesh coordinates to allow using them for several instances.
|
||||||
// The format is (x, y, z, point_size, supports_island)
|
// The format is (x, y, z, point_size, supports_island)
|
||||||
|
|||||||
@@ -1544,21 +1544,22 @@ bool GLCanvas3D::check_volumes_outside_state(GLVolumeCollection& volumes, ModelI
|
|||||||
state = BuildVolume::ObjectState::Below;
|
state = BuildVolume::ObjectState::Below;
|
||||||
else {
|
else {
|
||||||
switch (build_volume.type()) {
|
switch (build_volume.type()) {
|
||||||
// B66
|
|
||||||
case BuildVolume::Type::Rectangle:
|
case BuildVolume::Type::Rectangle:
|
||||||
//FIXME this test does not evaluate collision of a build volume bounding box with non-convex objects.
|
//FIXME this test does not evaluate collision of a build volume bounding box with non-convex objects.
|
||||||
state = build_volume.volume_state_bbox(volume_bbox(*volume), true, &bed_idx);
|
state = build_volume.volume_state_bbox(volume_bbox(*volume), true, &bed_idx);
|
||||||
|
// B66 //y21
|
||||||
if (state == BuildVolume::ObjectState::Inside) {
|
if (state == BuildVolume::ObjectState::Inside) {
|
||||||
for (size_t i = 0; i < m_model->objects.size(); ++i) {
|
int obj_idx = volume->object_idx();
|
||||||
ModelObject * object = m_model->objects[i];
|
ModelObjectPtrs model_parts = wxGetApp().model().objects;
|
||||||
ModelInstance *instance = object->instances[0];
|
ModelObject* model_obj = model_parts[obj_idx];
|
||||||
Polygon hull = instance->convex_hull_2d();
|
ModelInstance* instance = model_obj->instances[0];
|
||||||
|
Polygon hull = instance->convex_hull_2d();
|
||||||
state = build_volume.check_outside(hull);
|
state = build_volume.check_outside(hull);
|
||||||
if (state != BuildVolume::ObjectState::Inside) {
|
if (state != BuildVolume::ObjectState::Inside) {
|
||||||
break;
|
model_obj->in_exclude = true;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
model_obj->in_exclude = false;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case BuildVolume::Type::Circle:
|
case BuildVolume::Type::Circle:
|
||||||
|
|||||||
@@ -1895,11 +1895,12 @@ void Plater::priv::object_list_changed()
|
|||||||
for (const ModelObject *object : wxGetApp().model().objects) {
|
for (const ModelObject *object : wxGetApp().model().objects) {
|
||||||
for (const ModelInstance *instance : object->instances) {
|
for (const ModelInstance *instance : object->instances) {
|
||||||
const auto it{s_multiple_beds.get_inst_map().find(instance->id())};
|
const auto it{s_multiple_beds.get_inst_map().find(instance->id())};
|
||||||
|
//y21
|
||||||
if (
|
if (
|
||||||
it != s_multiple_beds.get_inst_map().end()
|
(it != s_multiple_beds.get_inst_map().end()
|
||||||
&& it->second == bed_index
|
&& it->second == bed_index
|
||||||
&& instance->printable
|
&& instance->printable
|
||||||
&& instance->print_volume_state == ModelInstancePVS_Partly_Outside
|
&& instance->print_volume_state == ModelInstancePVS_Partly_Outside) || (object->in_exclude)
|
||||||
) {
|
) {
|
||||||
s_print_statuses[bed_index] = PrintStatus::outside;
|
s_print_statuses[bed_index] = PrintStatus::outside;
|
||||||
break;
|
break;
|
||||||
|
|||||||
Reference in New Issue
Block a user