From 45a8650b7dcc401e67b821663cc5b5edab074b09 Mon Sep 17 00:00:00 2001 From: paul <40677073+paullee0@users.noreply.github.com> Date: Thu, 5 Feb 2026 19:36:16 +0800 Subject: [PATCH] [BimWall] Fix Regression check ArchSketchLock (#27324) * [BimWall] Fix Regression check ArchSketchLock Github Discussion / Fix Regression: Fix #24595 (https://github.com/FreeCAD/FreeCAD/pull/24595#issuecomment-3763092751) (and incorporate comments in previous PR, to be abandoned, https://github.com/FreeCAD/FreeCAD/pull/26985) Regression and Fix: - When external SketchArch Add-on is installed, and ArchSketchLock is False (not pressed), the BimWall.Arch_Wall() tool with BaseLine select 'Sketch' return error - This PR fix the said regression * [BimWall] Fix Regression check ArchSketchLock (rev. 1) (Update following comment at - https://github.com/FreeCAD/FreeCAD/pull/27324#pullrequestreview-3750099100) Github Discussion / Fix Regression: - Fix https://github.com/FreeCAD/FreeCAD/pull/24595#issuecomment-3763092751 - (and incorporate comments in previous PR, to be abandoned, https://github.com/FreeCAD/FreeCAD/pull/26985 Regression and Fix: - When external SketchArch Add-on is installed, and ArchSketchLock is False (not pressed), the BimWall.Arch_Wall() tool with BaseLine select 'Sketch' return error - This PR fix the said regression * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> --- src/Mod/BIM/bimcommands/BimWall.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/Mod/BIM/bimcommands/BimWall.py b/src/Mod/BIM/bimcommands/BimWall.py index 2e706e27e3..4c908310bd 100644 --- a/src/Mod/BIM/bimcommands/BimWall.py +++ b/src/Mod/BIM/bimcommands/BimWall.py @@ -273,22 +273,27 @@ class Arch_Wall: elif self.baseline_mode == WallBaselineMode.SKETCH: import ArchSketchObject - if not hasattr(ArchSketchObject, "makeArchSketch"): + # Check ArchSketchLock and makeArchSketch() here + useArchSketch = hasattr(ArchSketchObject, "makeArchSketch") and getattr( + FreeCAD, "ArchSketchLock", True + ) + + if not useArchSketch: # Regular path without SketchArch add-on installed. Execute creation command with a # suggested name. FreeCAD will ensure uniqueness. FreeCADGui.doCommand( "base = FreeCAD.ActiveDocument.addObject('Sketcher::SketchObject', 'WallTrace')" ) + user_label = translate("BimWall", "Wall Trace") + # Set the user-facing, translated label. + FreeCADGui.doCommand(f"base.Label = {repr(user_label)}") else: # Use ArchSketch if SketchArch add-on is present FreeCADGui.doCommand("import ArchSketchObject") FreeCADGui.doCommand("base = ArchSketchObject.makeArchSketch()") - user_label = translate("BimWall", "Wall Trace") # Apply placement and geometry using the correctly identified object name. FreeCADGui.doCommand(f"base.Placement = {placement_str}") - # Set the user-facing, translated label. - FreeCADGui.doCommand(f"base.Label = {repr(user_label)}") FreeCADGui.doCommand(f"base.addGeometry(trace)") FreeCADGui.doCommand("FreeCAD.ActiveDocument.recompute()")