put gears into container if a container is active

This commit is contained in:
looooo
2020-06-20 10:02:43 +02:00
parent 23bd463fdc
commit 0a19329a2d

View File

@@ -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):