From 3c048904ffa2372c4670344a33664764fce33fc8 Mon Sep 17 00:00:00 2001 From: wmayer Date: Sat, 22 Sep 2018 13:59:34 +0200 Subject: [PATCH] fixes 0003447: False PartDesign migration request --- src/Mod/PartDesign/Gui/Command.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/Mod/PartDesign/Gui/Command.cpp b/src/Mod/PartDesign/Gui/Command.cpp index 712beb50d110..0e9fcef57d7c 100644 --- a/src/Mod/PartDesign/Gui/Command.cpp +++ b/src/Mod/PartDesign/Gui/Command.cpp @@ -319,11 +319,18 @@ CmdPartDesignClone::CmdPartDesignClone() void CmdPartDesignClone::activated(int iMsg) { Q_UNUSED(iMsg); + std::string BodyName = getUniqueObjectName("Body"); std::string FeatName = getUniqueObjectName("Clone"); std::vector objs = getSelection().getObjectsOfType (Part::Feature::getClassTypeId()); if (objs.size() == 1) { + // As suggested in https://forum.freecadweb.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("Create Clone"); + doCommand(Command::Doc,"App.ActiveDocument.addObject('PartDesign::Body','%s')", + BodyName.c_str()); doCommand(Command::Doc,"App.ActiveDocument.addObject('PartDesign::FeatureBase','%s')", FeatName.c_str()); doCommand(Command::Doc,"App.ActiveDocument.ActiveObject.BaseFeature = App.ActiveDocument.%s", @@ -331,6 +338,8 @@ void CmdPartDesignClone::activated(int iMsg) doCommand(Command::Doc,"App.ActiveDocument.ActiveObject.Placement = App.ActiveDocument.%s.Placement", objs.front()->getNameInDocument()); doCommand(Command::Doc,"App.ActiveDocument.ActiveObject.setEditorMode('Placement',0)"); + doCommand(Command::Doc,"App.ActiveDocument.%s.Group = [App.ActiveDocument.%s]", + BodyName.c_str(), FeatName.c_str()); updateActive(); doCommand(Command::Doc,"App.ActiveDocument.ActiveObject.ViewObject.DiffuseColor = App.ActiveDocument.%s.ViewObject.DiffuseColor", objs.front()->getNameInDocument());