From 4ba5504e7af5309ba5c388867ca8b1cceecb6cf8 Mon Sep 17 00:00:00 2001 From: theo-vt Date: Wed, 18 Feb 2026 16:03:26 -0500 Subject: [PATCH] Remove dupplicate clone code causing crash --- src/Mod/PartDesign/Gui/Command.cpp | 40 ------------------------------ 1 file changed, 40 deletions(-) diff --git a/src/Mod/PartDesign/Gui/Command.cpp b/src/Mod/PartDesign/Gui/Command.cpp index 8c377d6694..008e5fb014 100644 --- a/src/Mod/PartDesign/Gui/Command.cpp +++ b/src/Mod/PartDesign/Gui/Command.cpp @@ -504,7 +504,6 @@ void CmdPartDesignClone::activated(int iMsg) Part::Feature::getClassTypeId() ); - App::DocumentObject* obj = nullptr; if (objs.size() == 1) { // As suggested in https://forum.freecad.org/viewtopic.php?f=3&t=25265&p=198547#p207336 // put the clone into its own new body. @@ -557,45 +556,6 @@ void CmdPartDesignClone::activated(int iMsg) copyVisual(cloneObj, "DisplayMode", obj); commitCommand(); } - - // As suggested in https://forum.freecad.org/viewtopic.php?f=3&t=25265&p=198547#p207336 - // put the clone into its own new body. - // This also fixes bug #3447 because the clone is a PD feature and thus - // requires a body where it is part of. - - openCommand(QT_TRANSLATE_NOOP("Command", "Create Clone")); - - auto objCmd = getObjectCmd(obj); - std::string cloneName = getUniqueObjectName("Clone", obj); - std::string bodyName = getUniqueObjectName("Body", obj); - - // Create body and clone - Gui::cmdAppDocument(obj, std::stringstream() << "addObject('PartDesign::Body','" << bodyName << "')"); - Gui::cmdAppDocument( - obj, - std::stringstream() << "addObject('PartDesign::FeatureBase','" << cloneName << "')" - ); - - auto bodyObj = obj->getDocument()->getObject(bodyName.c_str()); - auto cloneObj = obj->getDocument()->getObject(cloneName.c_str()); - - // In the first step set the group link and tip of the body - Gui::cmdAppObject(bodyObj, std::stringstream() << "Group = [" << getObjectCmd(cloneObj) << "]"); - Gui::cmdAppObject(bodyObj, std::stringstream() << "Tip = " << getObjectCmd(cloneObj)); - - // In the second step set the link of the base feature - Gui::cmdAppObject(cloneObj, std::stringstream() << "BaseFeature = " << objCmd); - Gui::cmdAppObject(cloneObj, std::stringstream() << "Placement = " << objCmd << ".Placement"); - Gui::cmdAppObject(cloneObj, std::stringstream() << "setEditorMode('Placement', 0)"); - - updateActive(); - copyVisual(cloneObj, "ShapeAppearance", obj); - copyVisual(cloneObj, "LineColor", obj); - copyVisual(cloneObj, "PointColor", obj); - copyVisual(cloneObj, "Transparency", obj); - copyVisual(cloneObj, "DisplayMode", obj); - - commitCommand(); } bool CmdPartDesignClone::isActive()