From 1774455cf396be8668abd41294da05ca45502c04 Mon Sep 17 00:00:00 2001 From: Uwe Date: Fri, 24 Mar 2023 16:02:00 +0100 Subject: [PATCH] [FEM] improve recently added addition method - for the solvers the workflow should be that one can directly after adding a solver child to it via the toolbar Therefore select the added solver object --- src/Mod/Fem/femcommands/manager.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/Mod/Fem/femcommands/manager.py b/src/Mod/Fem/femcommands/manager.py index 57b2f07b4b..58890677a1 100644 --- a/src/Mod/Fem/femcommands/manager.py +++ b/src/Mod/Fem/femcommands/manager.py @@ -347,6 +347,7 @@ class CommandManager(object): def add_obj_on_gui_expand_noset_edit(self, objtype): # like add_obj_on_gui_noset_edit but the parent object # is expanded in the tree to see the added obj + # the added obj is also selected to enable direct additons to it FreeCAD.ActiveDocument.openTransaction( "Create Fem{}" .format(objtype) @@ -362,9 +363,13 @@ class CommandManager(object): # add the object FreeCADGui.doCommand( "addedObj = FemGui.getActiveAnalysis().addObject(ObjectsFem." - "make{}(FreeCAD.ActiveDocument))" + "make{}(FreeCAD.ActiveDocument))[0]" .format(objtype) ) + # select only added object + FreeCADGui.Selection.clearSelection() + FreeCADGui.doCommand("addedObjDocObj = FreeCAD.ActiveDocument.getObject(addedObj.Name)") + FreeCADGui.doCommand("FreeCADGui.Selection.addSelection(addedObjDocObj)") FreeCAD.ActiveDocument.recompute() def add_obj_on_gui_selobj_set_edit(self, objtype):