From 0a19329a2deee35fbc5900857fde2d048374aea7 Mon Sep 17 00:00:00 2001 From: looooo Date: Sat, 20 Jun 2020 10:02:43 +0200 Subject: [PATCH] put gears into container if a container is active --- freecad/gears/commands.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/freecad/gears/commands.py b/freecad/gears/commands.py index 28d4dc7..a2c124f 100644 --- a/freecad/gears/commands.py +++ b/freecad/gears/commands.py @@ -52,6 +52,16 @@ class BaseCommand(object): obj = FreeCAD.ActiveDocument.addObject("Part::FeaturePython", cls.NAME) cls.GEAR_FUNCTION(obj) ViewProviderGear(obj.ViewObject) + + # borrowed from threaded profiles + # puts the gear into an active container + body = Gui.ActiveDocument.ActiveView.getActiveObject("pdbody") + part = Gui.ActiveDocument.ActiveView.getActiveObject("part") + + if body: + body.Group += [obj] + elif part: + part.Group += [obj] return obj def GetResources(self):