Arch: Use the smallest face as profile when discovering extrusions in IFC objects - thanks @geometrygym
This commit is contained in:
@@ -1253,13 +1253,14 @@ def getExtrusionData(shape):
|
||||
if round(f[1].getAngle(faces[pair[0]][1]),4) != 1.5708:
|
||||
ok = False
|
||||
if ok:
|
||||
valids.append([faces[pair[0]][0],faces[pair[1]][0].CenterOfMass.sub(faces[pair[0]][0].CenterOfMass)])
|
||||
for v in valids:
|
||||
# prefer vertical extrusions
|
||||
if v[1].getAngle(FreeCAD.Vector(0,0,1)) < 0.0001:
|
||||
return v
|
||||
# otherwise return the first found
|
||||
# prefer the face with the lowest z
|
||||
if faces[pair[0]][0].CenterOfMass.z < faces[pair[1]][0].CenterOfMass.z:
|
||||
valids.append([faces[pair[0]][0],faces[pair[1]][0].CenterOfMass.sub(faces[pair[0]][0].CenterOfMass)])
|
||||
else:
|
||||
valids.append([faces[pair[1]][0],faces[pair[0]][0].CenterOfMass.sub(faces[pair[1]][0].CenterOfMass)])
|
||||
if valids:
|
||||
# sort by smallest area
|
||||
valids.sort(key=lambda v: v[0].Area)
|
||||
return valids[0]
|
||||
return None
|
||||
|
||||
|
||||
Reference in New Issue
Block a user