mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-23 06:33:57 -06:00
Cut: Fix crashing in programming cut. Also fixes the cut z offset.
This commit is contained in:
parent
018b2744db
commit
28e2995a01
4 changed files with 7 additions and 24 deletions
|
@ -653,11 +653,5 @@ const ModelObjectPtrs& Cut::perform_with_groove(const Groove& groove, const Tran
|
|||
return m_model.objects;
|
||||
}
|
||||
|
||||
ModelObjectPtrs Cut::cut_horizontal(const ModelObject *object, size_t instance_idx, double z, ModelObjectCutAttributes attributes)
|
||||
{
|
||||
Cut cut(object, instance_idx, Geometry::translation_transform(z * Vec3d::UnitZ()), attributes);
|
||||
return cut.perform_with_plane();
|
||||
}
|
||||
|
||||
} // namespace Slic3r
|
||||
|
||||
|
|
|
@ -63,8 +63,6 @@ public:
|
|||
const ModelObjectPtrs& perform_by_contour(std::vector<Part> parts, int dowels_count);
|
||||
const ModelObjectPtrs& perform_with_groove(const Groove& groove, const Transform3d& rotation_m, bool keep_as_parts = false);
|
||||
|
||||
static ModelObjectPtrs cut_horizontal(const ModelObject *object, size_t instance_idx, double z, ModelObjectCutAttributes attributes);
|
||||
|
||||
}; // namespace Cut
|
||||
|
||||
|
||||
|
|
|
@ -8426,23 +8426,12 @@ void Plater::cut_horizontal(size_t obj_idx, size_t instance_idx, double z, Model
|
|||
return;
|
||||
|
||||
wxBusyCursor wait;
|
||||
const auto new_objects = Cut::cut_horizontal(object, instance_idx, z, attributes);
|
||||
|
||||
remove(obj_idx);
|
||||
p->load_model_objects(new_objects);
|
||||
const Vec3d instance_offset = object->instances[instance_idx]->get_offset();
|
||||
Cut cut(object, instance_idx, Geometry::translation_transform(z * Vec3d::UnitZ() - instance_offset), attributes);
|
||||
const auto new_objects = cut.perform_with_plane();
|
||||
|
||||
// now process all updates of the 3d scene
|
||||
update();
|
||||
|
||||
// Update InfoItems in ObjectList after update() to use of a correct value of the GLCanvas3D::is_sinking(),
|
||||
// which is updated after a view3D->reload_scene(false, flags & (unsigned int)UpdateParams::FORCE_FULL_SCREEN_REFRESH) call
|
||||
for (size_t idx = 0; idx < p->model.objects.size(); idx++)
|
||||
wxGetApp().obj_list()->update_info_items(idx);
|
||||
|
||||
Selection& selection = p->get_selection();
|
||||
size_t last_id = p->model.objects.size() - 1;
|
||||
for (size_t i = 0; i < new_objects.size(); ++i)
|
||||
selection.add_object((unsigned int)(last_id - i), i == 0);
|
||||
apply_cut_object_to_model(obj_idx, new_objects);
|
||||
}
|
||||
|
||||
void Plater::_calib_pa_tower(const Calib_Params& params) {
|
||||
|
|
|
@ -143,7 +143,9 @@ static void cut_model(Model &model, double z, ModelObjectCutAttributes attribute
|
|||
|
||||
auto* object = model.objects[0];
|
||||
|
||||
const auto new_objects = Cut::cut_horizontal(object, instance_idx, z, attributes);
|
||||
const Vec3d instance_offset = object->instances[instance_idx]->get_offset();
|
||||
Cut cut(object, instance_idx, Geometry::translation_transform(z * Vec3d::UnitZ() - instance_offset), attributes);
|
||||
const auto new_objects = cut.perform_with_plane();
|
||||
model.delete_object(obj_idx);
|
||||
|
||||
for (ModelObject *model_object : new_objects) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue