Skip to content

Commit a566338

Browse files
authored
Merge pull request #875 from compas-dev/fix-draw-breps
Makes no sense user has to do this...
2 parents f70798d + b166934 commit a566338

File tree

2 files changed

+6
-12
lines changed

2 files changed

+6
-12
lines changed

CHANGELOG.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1919
* Fixed a bug in `compas.numerical.dr_numpy` when using numpy array as inputs.
2020
* Allowed for varying repository file structures in `compas.robots.GithubPackageMeshLoader`.
2121
* Fixed data schema of `compas.geometry.Polyline`, `compas.geometry.Polygon`, `compas.geometry.Pointcloud`.
22-
23-
### Fixed
24-
2522
* Fixed `Configuration.from_data` to be backward-compatible with JSON data generated before `compas 1.3.0`.
23+
* Changed `compas_rhino.drawing.draw_breps` to assume provided polygon is closed and automatically add missing corner to polycurve constructor.
2624

2725
### Removed
2826

src/compas_rhino/utilities/drawing.py

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -476,12 +476,8 @@ def draw_breps(faces, srf=None, u=10, v=10, trim=True, tangency=True, spacing=0.
476476
477477
Draw convert each mesh face to brep dict schema:
478478
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)
479+
>>> vertices = mesh.vertices_attributes('xyz')
480+
>>> breps = [{'points': mesh.face_coordinates(face)} for face in mesh.faces()]
485481
486482
Draw brep faces as one joined brep.
487483
@@ -494,17 +490,17 @@ def draw_breps(faces, srf=None, u=10, v=10, trim=True, tangency=True, spacing=0.
494490
name = f.get('name', '')
495491
color = f.get('color')
496492
layer = f.get('layer')
497-
corners = [Point3d(*point) for point in points]
493+
corners = [Point3d(*point) for point in points + points[:1]]
498494
pcurve = PolylineCurve(corners)
499495
geo = List[GeometryBase](1)
500496
geo.Add(pcurve)
501497
p = len(points)
502-
if p == 4:
498+
if p == 3:
503499
brep = Brep.CreateFromCornerPoints(Point3d(*points[0]),
504500
Point3d(*points[1]),
505501
Point3d(*points[2]),
506502
TOL)
507-
elif p == 5:
503+
elif p == 4:
508504
brep = Brep.CreateFromCornerPoints(Point3d(*points[0]),
509505
Point3d(*points[1]),
510506
Point3d(*points[2]),

0 commit comments

Comments
 (0)