Skip to content

Commit 50a4eca

Browse files
committed
add join function to draw_breps
1 parent 75072d9 commit 50a4eca

File tree

1 file changed

+13
-4
lines changed

1 file changed

+13
-4
lines changed

src/compas_rhino/utilities/drawing.py

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838

3939
try:
4040
from Rhino.Geometry import MeshNgon
41+
from Rhino.Geometry import Brep
4142
except ImportError:
4243
MeshNgon = False
4344

@@ -421,7 +422,7 @@ def draw_polylines(polylines, **kwargs):
421422

422423

423424
@wrap_drawfunc
424-
def draw_breps(faces, srf=None, u=10, v=10, trim=True, tangency=True, spacing=0.1, flex=1.0, pull=1.0, **kwargs):
425+
def draw_breps(faces, srf=None, u=10, v=10, trim=True, tangency=True, spacing=0.1, flex=1.0, pull=1.0, join=False, **kwargs):
425426
"""Draw polygonal faces as Breps, and optionally set individual name, color,
426427
and layer properties.
427428
@@ -443,6 +444,8 @@ def draw_breps(faces, srf=None, u=10, v=10, trim=True, tangency=True, spacing=0.
443444
spacing : float, optional
444445
flex : float, optional
445446
pull : float, optional
447+
join : bool, optional
448+
Join the individual faces as polysurfaces. Default is False.
446449
447450
Returns
448451
-------
@@ -462,7 +465,7 @@ def draw_breps(faces, srf=None, u=10, v=10, trim=True, tangency=True, spacing=0.
462465
})
463466
464467
"""
465-
guids = []
468+
breps = []
466469
for f in iter(faces):
467470
points = f['points']
468471
name = f.get('name', '')
@@ -486,8 +489,14 @@ def draw_breps(faces, srf=None, u=10, v=10, trim=True, tangency=True, spacing=0.
486489
TOL)
487490
else:
488491
brep = Brep.CreatePatch(geo, u, v, TOL)
489-
if not brep:
490-
continue
492+
if brep:
493+
breps.append(brep)
494+
495+
if join:
496+
breps = Brep.JoinBreps(breps, TOL)
497+
498+
guids = []
499+
for brep in breps:
491500
guid = add_brep(brep)
492501
if not guid:
493502
continue

0 commit comments

Comments
 (0)