BIM: fix Height and Width inversion for rectangular pipes

This commit is contained in:
Roy-043
2025-07-07 00:09:21 +02:00
committed by Yorik van Havre
parent a47fc30873
commit 08aef89fc3

View File

@@ -100,6 +100,17 @@ class _ArchPipe(ArchComponent.Component):
ArchComponent.Component.onDocumentRestored(self,obj)
self.setProperties(obj)
if obj.ProfileType == "Rectangle" and FreeCAD.ActiveDocument.getProgramVersion().split()[0] <= "1.1R42474":
# in older versions Height and Width are inverted
obj.Height, obj.Width = obj.Width, obj.Height
FreeCAD.ActiveDocument.recompute()
FreeCAD.Console.PrintWarning(
"v1.1, "
+ obj.Label
+ ", "
+ translate("Arch", "corrected 'Height' and 'Width' properties")
+ "\n"
)
def loads(self,state):
@@ -164,7 +175,7 @@ class _ArchPipe(ArchComponent.Component):
v1 = obj.Base.Placement.multVec(obj.Base.Points[1])-w.Vertexes[0].Point
else:
v1 = w.Vertexes[1].Point-w.Vertexes[0].Point
v2 = DraftGeomUtils.getNormal(p)
#v2 = DraftGeomUtils.getNormal(p)
#rot = FreeCAD.Rotation(v2,v1)
# rotate keeping up vector
if v1.getAngle(FreeCAD.Vector(0,0,1)) > 0.01:
@@ -175,6 +186,7 @@ class _ArchPipe(ArchComponent.Component):
v1x = v1.cross(v1y)
rot = FreeCAD.Rotation(v1x,v1y,v1,"ZYX")
p.rotate(w.Vertexes[0].Point,rot.Axis,math.degrees(rot.Angle))
p.rotate(w.Vertexes[0].Point,v1,90)
shapes = []
try:
if p.Faces:
@@ -379,7 +391,7 @@ class _ArchPipeConnector(ArchComponent.Component):
# move and rotate the profile to the first point
delta = point.add(v1)-p.CenterOfMass
p.translate(delta)
vp = DraftGeomUtils.getNormal(p)
#vp = DraftGeomUtils.getNormal(p)
#rot = FreeCAD.Rotation(vp,v1)
# rotate keeping up vector
if v1.getAngle(FreeCAD.Vector(0,0,1)) > 0.01: