From 345df4b3996f21ba61f2cb1c9a0ec755f55dbeba Mon Sep 17 00:00:00 2001 From: Roy-043 <70520633+Roy-043@users.noreply.github.com> Date: Fri, 20 Oct 2023 12:28:00 +0200 Subject: [PATCH] Draft: PlaneGui: minor fixes (#11115) Related issue: #5603. * An 'auto' WP should not be added to the history if the previous WP in the history is also 'auto'. * The `get_working_plane` function should only call `set_to_default` if the GUI is up. The axis of the returned WP should match global +Z if the GUI is not up. --- src/Mod/Draft/WorkingPlane.py | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/Mod/Draft/WorkingPlane.py b/src/Mod/Draft/WorkingPlane.py index d84839139f..424aef5377 100644 --- a/src/Mod/Draft/WorkingPlane.py +++ b/src/Mod/Draft/WorkingPlane.py @@ -1694,6 +1694,8 @@ class PlaneGui(PlaneBase): return if data == self._history["data_list"][-1]: return + if self.auto is True and self._history["data_list"][-1]["auto"] is True: + return max_len = 10 # Max. length of data_list. idx = self._history["idx"] @@ -1747,12 +1749,12 @@ def get_working_plane(update=True): return wp wp = PlaneGui() - wp._view = view - wp.set_to_default() - - if view is not None: - FreeCAD.draft_working_planes[0].append(view) - FreeCAD.draft_working_planes[1].append(wp) + if FreeCAD.GuiUp: + wp.set_to_default() + wp._view = view + if view is not None: + FreeCAD.draft_working_planes[0].append(view) + FreeCAD.draft_working_planes[1].append(wp) return wp