Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
10 changes: 10 additions & 0 deletions src/compas_rhino/geometry/brep/brep.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]))
Expand Down
9 changes: 9 additions & 0 deletions src/compas_rhino/geometry/brep/loop.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading