Part: Auto-add primitives to active Part

Modified DlgPrimitives.cpp to allow auto adding the newly created object to active Std_Part.
Works with: box, cylinder, sphere, cone, torus, tube, primitives.
This commit is contained in:
carlopav
2021-09-26 22:34:32 +02:00
committed by wmayer
parent 57ce37d867
commit 263f2e91da
3 changed files with 44 additions and 0 deletions

View File

@@ -53,6 +53,9 @@ class CommandTube:
tube = FreeCAD.ActiveDocument.addObject("Part::FeaturePython","Tube")
Shapes.TubeFeature(tube)
vp = ViewProviderShapes.ViewProviderTube(tube.ViewObject)
activePart = FreeCADGui.activeView().getActiveObject('part')
if activePart:
activePart.addObject(tube)
FreeCAD.ActiveDocument.recompute()
vp.startDefaultEditMode(tube.ViewObject)