diff --git a/CHANGELOG.md b/CHANGELOG.md index e7cc2f97bbdc..07b9f4f1e127 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -53,6 +53,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 * Fixed `compas_ghpython.artists.VolMeshArtist.draw` and `compas_ghpython.artists.VolMeshArtist.draw_cells`. * Fixed `compas_rhino.artists.VolMeshArtist.draw` and `compas_rhino.artists.VolMeshArtist.draw_cells`. * Improved error messages when artist instance cannot be created. +* Fixed exception when calculating geometry of `compas.datastructures.Part` without features. ### Removed diff --git a/src/compas/datastructures/assembly/part.py b/src/compas/datastructures/assembly/part.py index c733954ffdf1..bc9a1a24c2c3 100644 --- a/src/compas/datastructures/assembly/part.py +++ b/src/compas/datastructures/assembly/part.py @@ -144,13 +144,15 @@ def frame(self, frame): def geometry(self): # TODO: this is a temp solution # TODO: add memoization or some other kind of caching - A = Mesh.from_shape(self.shape) - for shape, operation in self.features: - A.quads_to_triangles() - B = Mesh.from_shape(shape) - B.quads_to_triangles() - A = Part.operations[operation](A.to_vertices_and_faces(), B.to_vertices_and_faces()) - geometry = Shape(*A) + if self.features: + A = self.shape.to_vertices_and_faces(triangulated=True) + for shape, operation in self.features: + B = shape.to_vertices_and_faces(triangulated=True) + A = Part.operations[operation](A, B) + geometry = Shape(*A) + else: + geometry = Shape(*self.shape.to_vertices_and_faces()) + T = Transformation.from_frame_to_frame(Frame.worldXY(), self.frame) geometry.transform(T) return geometry