Allow property container to become a child of a body when one is selected on creation.

This commit is contained in:
Markus Lampert
2020-12-11 19:17:02 -08:00
parent cbaa1bab85
commit 8b2bfaa322

View File

@@ -327,7 +327,19 @@ class PropertyContainerCreateCommand(object):
return not FreeCAD.ActiveDocument is None
def Activated(self):
Create()
sel = FreeCADGui.Selection.getSelectionEx()
obj = Create()
body = None
if sel:
if 'PartDesign::Body' == sel[0].Object.TypeId:
body = sel[0].Object
elif hasattr(sel[0].Object, 'getParentGeoFeatureGroup'):
body = sel[0].Object.getParentGeoFeatureGroup()
if body:
obj.Label = 'Attributes'
group = body.Group
group.append(obj)
body.Group = group
if FreeCAD.GuiUp:
FreeCADGui.addCommand('Path_PropertyContainer', PropertyContainerCreateCommand())