Skip to content

Commit 9bf3870

Browse files
committed
Fix crash for shapes with no orientable edges
We default to using the X axis as the edge orientation in this case, but the variable representing this axis was uninitialized.
1 parent dec8356 commit 9bf3870

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

lib/geometry/bodies.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,11 @@ def boundingBox(self) -> adsk.core.BoundingBox3D:
2121

2222

2323
def get_minimal_body(body: adsk.fusion.BRepBody) -> MinimalBody:
24+
origin = adsk.core.Point3D.create()
25+
target_x = adsk.core.Vector3D.create(x=1)
26+
target_y = adsk.core.Vector3D.create(y=1)
27+
target_z = adsk.core.Vector3D.create(z=1)
28+
2429
face = find_largest_planar_face(body)
2530
if face is None:
2631
return MinimalBody(body)
@@ -36,11 +41,6 @@ def get_minimal_body(body: adsk.fusion.BRepBody) -> MinimalBody:
3641
cross_orientation = orientation.crossProduct(normal)
3742
cross_orientation.normalize()
3843

39-
origin = adsk.core.Point3D.create()
40-
target_x = adsk.core.Vector3D.create(x=1)
41-
target_y = adsk.core.Vector3D.create(y=1)
42-
target_z = adsk.core.Vector3D.create(z=1)
43-
4444
transform = adsk.core.Matrix3D.create()
4545
transform.setToAlignCoordinateSystems(origin, orientation, cross_orientation, normal, origin, target_x, target_y, target_z)
4646

0 commit comments

Comments
 (0)