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