[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>
This commit is contained in:
paul
2026-02-05 19:36:16 +08:00
committed by GitHub
parent 27587b9cd2
commit 45a8650b7d

View File

@@ -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()")