diff --git a/CHANGELOG.md b/CHANGELOG.md index 04471f399bfb..8d4cc59d766a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,11 +11,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 * Added `TOL.update()` method for explicit global state modification. * Added `TOL.temporary()` context manager for scoped changes. +* Added missing implementation of `Brep.to_polygons()` in `compas_rhino.geometry.RhinoBrep`. ### Changed * Changed `Tolerance` class to no longer use singleton pattern. `Tolerance()` now creates independent instances instead of returning the global `TOL`. * Renamed `Tolerance.units` to `Tolerance.unit` to better reflect the documented properties. Left `units` with deprecation warning. +* Fixed `NotImplementedErorr` when calling `BrepLoop.vertices`. ### Removed diff --git a/src/compas_rhino/geometry/brep/brep.py b/src/compas_rhino/geometry/brep/brep.py index dd3b27718990..977206d97e05 100644 --- a/src/compas_rhino/geometry/brep/brep.py +++ b/src/compas_rhino/geometry/brep/brep.py @@ -890,6 +890,16 @@ def to_viewmesh(self, linear_deflection: float = 0.001): """ return _join_meshes(self.to_meshes()), [] + def to_polygons(self): + """Convert the faces of this Brep shape to polygons. + + Returns + ------- + list[:class:`~compas.geometry.Polygon`] + + """ + return [face.to_polygon() for face in self.faces] + def to_step(self, filepath): if not (filepath.endswith(".step") or filepath.endswith(".stp")): raise ValueError("Attempted to export STEP but file ends with {} extension".format(filepath.split(".")[-1])) diff --git a/src/compas_rhino/geometry/brep/loop.py b/src/compas_rhino/geometry/brep/loop.py index 65a9c35c8fce..8bc7af3f23d9 100644 --- a/src/compas_rhino/geometry/brep/loop.py +++ b/src/compas_rhino/geometry/brep/loop.py @@ -102,6 +102,15 @@ def __from_data__(cls, data, builder): def edges(self): return [RhinoBrepEdge(trim.Edge) for trim in self._loop.Trims] + @property + def vertices(self): + assert self.trims + + vertices = [self.trims[0].start_vertex] + for trim in self.trims: + vertices.append(trim.end_vertex) + return vertices + @property def trims(self): return self._trims