Skip to content

Commit

Permalink
Allow property container to become a child of a body when one is sele…
Browse files Browse the repository at this point in the history
…cted on creation.
  • Loading branch information
mlampert committed Jan 27, 2021
1 parent cbaa1ba commit 8b2bfaa
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion src/Mod/Path/PathScripts/PathPropertyContainerGui.py
Expand Up @@ -327,7 +327,19 @@ def IsActive(self):
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())
Expand Down

0 comments on commit 8b2bfaa

Please sign in to comment.