From 8b2bfaa3221f16eb6642f6aa48f1220648a8a3c5 Mon Sep 17 00:00:00 2001 From: Markus Lampert Date: Fri, 11 Dec 2020 19:17:02 -0800 Subject: [PATCH] Allow property container to become a child of a body when one is selected on creation. --- .../Path/PathScripts/PathPropertyContainerGui.py | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/Mod/Path/PathScripts/PathPropertyContainerGui.py b/src/Mod/Path/PathScripts/PathPropertyContainerGui.py index 3e376e6da2f0..c5c799d19c84 100644 --- a/src/Mod/Path/PathScripts/PathPropertyContainerGui.py +++ b/src/Mod/Path/PathScripts/PathPropertyContainerGui.py @@ -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())