From 9e58650477f4d6b048e79188594b68a00b7e5a31 Mon Sep 17 00:00:00 2001 From: tetektoza Date: Sat, 25 Oct 2025 14:10:37 +0200 Subject: [PATCH] BIM: Fix beam rotation when Base property is cleared (#24831) When a profile-based beam had its Base property cleared and the model was recomputed, the beam would rotate 90 degrees, changing its direction completely. Profile objects are always created in the XY plane with Width along X, height along Y and normal along Z. However, if Base is cleared, fallback code always used YZ plane orientation for beams. This resulted in a different orientation during cleaned Base property. Fix is to check if we are profile-based or not and if yes, use XY plane orientation, while we don't have this property then just use YZ plane orientation (preserving traditional horizontal behavior). --- src/Mod/BIM/ArchStructure.py | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/src/Mod/BIM/ArchStructure.py b/src/Mod/BIM/ArchStructure.py index 778f807203..885916efe1 100644 --- a/src/Mod/BIM/ArchStructure.py +++ b/src/Mod/BIM/ArchStructure.py @@ -1306,13 +1306,23 @@ class _Structure(ArchComponent.Component): # TODO use Part.Shape() rather than shape.copy() ... ? baseface = f.copy() elif length and width and height: + # check if this was a profil based arch structure + # profile-based structures should use XY plane orientation + use_profile_orientation = hasattr(obj, "Profile") and obj.Profile + if (length > height) and (IfcType in ["Beam", "Column"]): h2 = height / 2 or 0.5 w2 = width / 2 or 0.5 - v1 = Vector(0, -w2, -h2) - v4 = Vector(0, -w2, h2) - v3 = Vector(0, w2, h2) - v2 = Vector(0, w2, -h2) + if use_profile_orientation: + v1 = Vector(-w2, -h2, 0) + v2 = Vector(w2, -h2, 0) + v3 = Vector(w2, h2, 0) + v4 = Vector(-w2, h2, 0) + else: + v1 = Vector(0, -w2, -h2) + v2 = Vector(0, w2, -h2) + v3 = Vector(0, w2, h2) + v4 = Vector(0, -w2, h2) else: l2 = length / 2 or 0.5 w2 = width / 2 or 0.5