forked from youen/assembly_handbook
When creating the first step, use the current 3D view direction if available
This commit is contained in:
parent
1338f7d989
commit
44c6e41fff
@ -22,7 +22,6 @@ class AHB_New_Step:
|
|||||||
if len(Gui.Selection.getSelection()) > 1:
|
if len(Gui.Selection.getSelection()) > 1:
|
||||||
raise Exception("Please either select exactly one TechDraw view, or nothing at all")
|
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]
|
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':
|
if prev_view is not None and prev_view.TypeId != 'TechDraw::DrawViewPart':
|
||||||
raise Exception("Selected object is not a TechDraw view")
|
raise Exception("Selected object is not a TechDraw view")
|
||||||
@ -65,7 +64,12 @@ class AHB_New_Step:
|
|||||||
view = doc.addObject('TechDraw::DrawViewPart', 'View')
|
view = doc.addObject('TechDraw::DrawViewPart', 'View')
|
||||||
view.Perspective = False
|
view.Perspective = False
|
||||||
view.addProperty("App::PropertyString", "Assembly_handbook_PreviousStepView", "Assembly_handbook")
|
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.Assembly_handbook_PreviousStepView = prev_view.Name
|
||||||
view.X = prev_view.X
|
view.X = prev_view.X
|
||||||
view.Y = prev_view.Y
|
view.Y = prev_view.Y
|
||||||
|
Loading…
Reference in New Issue
Block a user