Skip to content

Commit ef56a18

Browse files
committed
added missing property and method in RhinoBrep implementation
1 parent dc7abd3 commit ef56a18

File tree

3 files changed

+21
-0
lines changed

3 files changed

+21
-0
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1111

1212
* Added `TOL.update()` method for explicit global state modification.
1313
* Added `TOL.temporary()` context manager for scoped changes.
14+
* Added missing implementation of `Brep.to_polygons()` in `compas_rhino.geometry.RhinoBrep`.
1415

1516
### Changed
1617

1718
* Changed `Tolerance` class to no longer use singleton pattern. `Tolerance()` now creates independent instances instead of returning the global `TOL`.
1819
* Renamed `Tolerance.units` to `Tolerance.unit` to better reflect the documented properties. Left `units` with deprecation warning.
20+
* Fixed `NotImplementedErorr` when calling `BrepLoop.vertices`.
1921

2022
### Removed
2123

src/compas_rhino/geometry/brep/brep.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -890,6 +890,16 @@ def to_viewmesh(self, linear_deflection: float = 0.001):
890890
"""
891891
return _join_meshes(self.to_meshes()), []
892892

893+
def to_polygons(self):
894+
"""Convert the faces of this Brep shape to polygons.
895+
896+
Returns
897+
-------
898+
list[:class:`~compas.geometry.Polygon`]
899+
900+
"""
901+
return [face.to_polygon() for face in self.faces]
902+
893903
def to_step(self, filepath):
894904
if not (filepath.endswith(".step") or filepath.endswith(".stp")):
895905
raise ValueError("Attempted to export STEP but file ends with {} extension".format(filepath.split(".")[-1]))

src/compas_rhino/geometry/brep/loop.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,15 @@ def __from_data__(cls, data, builder):
102102
def edges(self):
103103
return [RhinoBrepEdge(trim.Edge) for trim in self._loop.Trims]
104104

105+
@property
106+
def vertices(self):
107+
assert self.trims
108+
109+
vertices = [self.trims[0].start_vertex]
110+
for trim in self.trims:
111+
vertices.append(trim.end_vertex)
112+
return vertices
113+
105114
@property
106115
def trims(self):
107116
return self._trims

0 commit comments

Comments
 (0)