Skip to content

Commit 6e357c5

Browse files
committed
changelog, init, example
1 parent 50a4eca commit 6e357c5

File tree

3 files changed

+31
-4
lines changed

3 files changed

+31
-4
lines changed

CHANGELOG.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
2525
* Changed directory where ghuser components are installed.
2626
* Added ghuser components directory to those removed by the `clean` task.
2727
* Clean up the ghuser directory before building ghuser components.
28+
* Exposed function `draw_breps` in `compas_rhino.utilities`; example added.
29+
* Added `join` flag to function `draw_breps` in `compas_rhino.utilities`
2830

2931
### Removed
3032

@@ -217,9 +219,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
217219
* Fixed bug regarding a repeated call to `RobotModel.add_joint`.
218220
* Fixed bug in `compas_blender.RobotModelArtist.update`.
219221
* Fixed bug in `compas.datastructures.mesh_slice_plane`.
220-
* Fixed bug where initialising a `compas_blender.artists.Robotmodelartist` would create a new collection for each mesh and then also not put the mesh iton the created collection.
221-
* Changed the initialisation of `compas_blender.artists.Robotmodelartist` to include a `collection`-parameter instead of a `layer`-parameter to be more consistent with Blender's nomenclature.
222-
* Used a utility function from `compas_blender.utilities` to create the collection if none exists instead of using a new call to a bpy-method.
222+
* Fixed bug where initialising a `compas_blender.artists.Robotmodelartist` would create a new collection for each mesh and then also not put the mesh iton the created collection.
223+
* Changed the initialisation of `compas_blender.artists.Robotmodelartist` to include a `collection`-parameter instead of a `layer`-parameter to be more consistent with Blender's nomenclature.
224+
* Used a utility function from `compas_blender.utilities` to create the collection if none exists instead of using a new call to a bpy-method.
223225

224226
### Removed
225227

src/compas_rhino/utilities/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,7 @@
179179
draw_lines,
180180
draw_geodesics,
181181
draw_polylines,
182+
draw_breps,
182183
draw_faces,
183184
draw_cylinders,
184185
draw_pipes,
@@ -275,6 +276,7 @@
275276
'draw_lines',
276277
'draw_geodesics',
277278
'draw_polylines',
279+
'draw_breps',
278280
'draw_faces',
279281
'draw_cylinders',
280282
'draw_pipes',

src/compas_rhino/utilities/drawing.py

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@
3838

3939
try:
4040
from Rhino.Geometry import MeshNgon
41-
from Rhino.Geometry import Brep
4241
except ImportError:
4342
MeshNgon = False
4443

@@ -73,6 +72,7 @@
7372
'draw_lines',
7473
'draw_geodesics',
7574
'draw_polylines',
75+
'draw_breps',
7676
'draw_faces',
7777
'draw_cylinders',
7878
'draw_pipes',
@@ -464,6 +464,29 @@ def draw_breps(faces, srf=None, u=10, v=10, trim=True, tangency=True, spacing=0.
464464
Optional('layer', default=None): str,
465465
})
466466
467+
Examples
468+
--------
469+
Using a compas Mesh as an example:
470+
471+
>>> from compas.datastructures import Mesh
472+
>>> from compas.geometry import Box, Frame
473+
>>> from compas_rhino.utilities import draw_breps
474+
>>> box = Box(Frame.worldXY(), 1.0, 2.0, 3.0)
475+
>>> mesh = Mesh.from_shape(box)
476+
477+
Draw convert each mesh face to brep dict schema:
478+
479+
>>> vertices = [mesh.vertex_attributes(vertex, 'xyz') for vertex in mesh.vertices()]
480+
>>> breps = []
481+
>>> for face in mesh.faces():
482+
>>> face = {'points' : [vertices[vertex] for vertex in mesh.face_vertices(face)]}
483+
>>> face['points'].append(face['points'][0])
484+
>>> breps.append(face)
485+
486+
Draw brep faces as one joined brep.
487+
488+
>>> guids = draw_breps(breps, join=True)
489+
467490
"""
468491
breps = []
469492
for f in iter(faces):

0 commit comments

Comments
 (0)