From a837f710d33ec9f2d61b7915bd22aea4d72ac0d1 Mon Sep 17 00:00:00 2001 From: Roy-043 Date: Wed, 10 Apr 2024 11:23:59 +0200 Subject: [PATCH] Arch: Fix several Arch_Wall issues * The Placement of Draft Line base objects was not adjusted to account for the current working plane. Forum topic: https://forum.freecad.org/viewtopic.php?t=86780 * Continue mode checkbox did not behave correctly because its value was based on FreeCADGui.draftToolBar.continueMode, which does not update as the parameter is changed. Will update other Arch code later. * There was an issue with Draft Line based walls and continue mode. A Draft Line is selected after creation and the next command call would also use that line because of that. Resulting in 2 walls using the same line and an interuption of continue mode. * setUseSketch changed the wrong parameter. --- src/Mod/Arch/ArchWall.py | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/src/Mod/Arch/ArchWall.py b/src/Mod/Arch/ArchWall.py index 8df05640a9..b1070b8faa 100644 --- a/src/Mod/Arch/ArchWall.py +++ b/src/Mod/Arch/ArchWall.py @@ -450,7 +450,11 @@ class _CommandWall: FreeCADGui.doCommand('base.Placement = wp.get_placement()') FreeCADGui.doCommand('base.addGeometry(trace)') else: - FreeCADGui.doCommand('base=Draft.makeLine(trace)') + FreeCADGui.doCommand('base=Draft.make_line(trace)') + # The created line should not stay selected as this causes an issue in continue mode. + # Two walls would then be created based on the same line. + FreeCADGui.Selection.clearSelection() + FreeCADGui.doCommand('base.Placement = wp.get_placement()') FreeCADGui.doCommand('FreeCAD.ActiveDocument.recompute()') FreeCADGui.doCommand('wall = Arch.makeWall(base,width='+str(self.Width)+',height='+str(self.Height)+',align="'+str(self.Align)+'")') FreeCADGui.doCommand('wall.Normal = wp.axis') @@ -544,9 +548,8 @@ class _CommandWall: value4.setObjectName("ContinueCmd") value4.setLayoutDirection(QtCore.Qt.RightToLeft) label4.setBuddy(value4) - if hasattr(FreeCADGui,"draftToolBar"): - value4.setChecked(FreeCADGui.draftToolBar.continueMode) - self.continueCmd = FreeCADGui.draftToolBar.continueMode + self.continueCmd = params.get_param("ContinueMode") + value4.setChecked(self.continueCmd) grid.addWidget(label4,5,0,1,1) grid.addWidget(value4,5,1,1,1) @@ -616,13 +619,12 @@ class _CommandWall: """ self.continueCmd = bool(i) - if hasattr(FreeCADGui,"draftToolBar"): - FreeCADGui.draftToolBar.continueMode = bool(i) + params.set_param("ContinueMode", bool(i)) def setUseSketch(self,i): - """Simple callback to set if walls should join their base sketches when possible.""" + """Simple callback to set if walls should based on sketches.""" - params.set_param_arch("joinWallSketches",bool(i)) + params.set_param_arch("WallSketches",bool(i)) def createFromGUI(self): """Callback to create wall by using the _CommandWall.taskbox()"""