diff --git a/ahb_cmd_new_step.py b/ahb_cmd_new_step.py index 622b7bc..59ffa3c 100644 --- a/ahb_cmd_new_step.py +++ b/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