From 44c6e41fff528f22eac5e7c74b812a9921214da3 Mon Sep 17 00:00:00 2001 From: Youen Date: Tue, 18 Oct 2022 22:42:37 +0200 Subject: [PATCH] When creating the first step, use the current 3D view direction if available --- ahb_cmd_new_step.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) 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