Skip to content

Commit ecb6ccf

Browse files
committed
Merge remote-tracking branch 'origin/main' into main
2 parents 946a47d + 0b27903 commit ecb6ccf

File tree

2 files changed

+10
-7
lines changed

2 files changed

+10
-7
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
5353
* Fixed `compas_ghpython.artists.VolMeshArtist.draw` and `compas_ghpython.artists.VolMeshArtist.draw_cells`.
5454
* Fixed `compas_rhino.artists.VolMeshArtist.draw` and `compas_rhino.artists.VolMeshArtist.draw_cells`.
5555
* Improved error messages when artist instance cannot be created.
56+
* Fixed exception when calculating geometry of `compas.datastructures.Part` without features.
5657
* Fixed bug in `compas_rhino.conversions.RhinoCurve.to_compas`.
5758
* Fixed bug in `compas_rhino.conversions.RhinoSurface.to_compas`.
5859

src/compas/datastructures/assembly/part.py

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -144,13 +144,15 @@ def frame(self, frame):
144144
def geometry(self):
145145
# TODO: this is a temp solution
146146
# TODO: add memoization or some other kind of caching
147-
A = Mesh.from_shape(self.shape)
148-
for shape, operation in self.features:
149-
A.quads_to_triangles()
150-
B = Mesh.from_shape(shape)
151-
B.quads_to_triangles()
152-
A = Part.operations[operation](A.to_vertices_and_faces(), B.to_vertices_and_faces())
153-
geometry = Shape(*A)
147+
if self.features:
148+
A = self.shape.to_vertices_and_faces(triangulated=True)
149+
for shape, operation in self.features:
150+
B = shape.to_vertices_and_faces(triangulated=True)
151+
A = Part.operations[operation](A, B)
152+
geometry = Shape(*A)
153+
else:
154+
geometry = Shape(*self.shape.to_vertices_and_faces())
155+
154156
T = Transformation.from_frame_to_frame(Frame.worldXY(), self.frame)
155157
geometry.transform(T)
156158
return geometry

0 commit comments

Comments
 (0)