From aa4a71b55b95d57aee0d4b3a1cc78b9f27e4e95e Mon Sep 17 00:00:00 2001 From: paul <40677073+paullee0@users.noreply.github.com> Date: Wed, 18 Feb 2026 18:49:33 +0800 Subject: [PATCH] [ArchWall] Fix Regression: sortSketchWidth only in addon (#27676) * [ArchWall] Fix Regression: sortSketchWidth only in addon Regression was introduced when get_width() method uses ArchSketchObject.sortSketchWidth() function in below lines. https://github.com/FreeCAD/FreeCAD/blob/468269b9a6ea58cd8b0f9d8579b711c530db83b2/src/Mod/BIM/ArchWall.py#L1668-L1673 if not lwidths: if obj.OverrideWidth: if obj.Base and obj.Base.isDerivedFrom("Sketcher::SketchObject"): lwidths = ArchSketchObject.sortSketchWidth( obj.Base, obj.OverrideWidth, obj.ArchSketchEdges ) ArchSketchObject.sortSketchWidth() function is not in the FC core ArchSketchObject.py module and this results in error. This function would only exist when the external add-on is present and loaded. Previously, a try/exception test was used; now hasattr() is used in this fix to test the presence of the required function before it is used. * [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/ArchWall.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/Mod/BIM/ArchWall.py b/src/Mod/BIM/ArchWall.py index 466d17a061..9844497f12 100644 --- a/src/Mod/BIM/ArchWall.py +++ b/src/Mod/BIM/ArchWall.py @@ -1667,7 +1667,11 @@ class _Wall(ArchComponent.Component): ) if not lwidths: if obj.OverrideWidth: - if obj.Base and obj.Base.isDerivedFrom("Sketcher::SketchObject"): + if ( + obj.Base + and obj.Base.isDerivedFrom("Sketcher::SketchObject") + and hasattr(ArchSketchObject, "sortSketchWidth") + ): lwidths = ArchSketchObject.sortSketchWidth( obj.Base, obj.OverrideWidth, obj.ArchSketchEdges )