Browse Source

When creating the first step, use the current 3D view direction if available

master
Youen 2 years ago
parent
commit
44c6e41fff
  1. 8
      ahb_cmd_new_step.py

8
ahb_cmd_new_step.py

@ -22,7 +22,6 @@ class AHB_New_Step:
if len(Gui.Selection.getSelection()) > 1:
raise Exception("Please either select exactly one TechDraw view, or nothing at all")
prev_view = None if len(Gui.Selection.getSelection()) == 0 else Gui.Selection.getSelection()[0]
if prev_view is not None and prev_view.TypeId != 'TechDraw::DrawViewPart':
raise Exception("Selected object is not a TechDraw view")
@ -65,7 +64,12 @@ class AHB_New_Step:
view = doc.addObject('TechDraw::DrawViewPart', 'View')
view.Perspective = False
view.addProperty("App::PropertyString", "Assembly_handbook_PreviousStepView", "Assembly_handbook")
if prev_view is not None:
if prev_view is None:
try:
workbench.techDrawExtensions.setCurrentViewDirection(view)
except:
pass
else:
view.Assembly_handbook_PreviousStepView = prev_view.Name
view.X = prev_view.X
view.Y = prev_view.Y

Loading…
Cancel
Save