@@ -21,40 +21,25 @@ class BoxArtist(RhinoArtist, ShapeArtist):
2121 def __init__ (self , box , layer = None , ** kwargs ):
2222 super (BoxArtist , self ).__init__ (shape = box , layer = layer , ** kwargs )
2323
24- def draw (self , show_vertices = False , show_edges = False , show_faces = True , join_faces = True ):
24+ def draw (self , color = None ):
2525 """Draw the box associated with the artist.
2626
2727 Parameters
2828 ----------
29- show_vertices : bool, optional
30- Default is ``False``.
31- show_edges : bool, optional
32- Default is ``False``.
33- show_faces : bool, optional
34- Default is ``True``.
35- join_faces : bool, optional
36- Default is ``True``.
29+ color : tuple of float, optional
30+ The RGB color of the box.
3731
3832 Returns
3933 -------
4034 list
4135 The GUIDs of the objects created in Rhino.
4236 """
37+ color = color or self .color
4338 vertices = [list (vertex ) for vertex in self .shape .vertices ]
44- guids = []
45- if show_vertices :
46- points = [{'pos' : point , 'color' : self .color , 'name' : self .shape .name } for point in vertices ]
47- guids += compas_rhino .draw_points (points , layer = self .layer , clear = False , redraw = False )
48- if show_edges :
49- edges = self .shape .edges
50- lines = [{'start' : vertices [i ], 'end' : vertices [j ], 'color' : self .color , 'name' : self .shape .name } for i , j in edges ]
51- guids += compas_rhino .draw_lines (lines , layer = self .layer , clear = False , redraw = False )
52- if show_faces :
53- faces = self .shape .faces
54- if join_faces :
55- guid = compas_rhino .draw_mesh (vertices , faces , layer = self .layer , name = self .shape .name , color = self .color , disjoint = True )
56- guids .append (guid )
57- else :
58- polygons = [{'points' : [vertices [index ] for index in face ], 'color' : self .color , 'name' : self .shape .name } for face in faces ]
59- guids += compas_rhino .draw_faces (polygons , layer = self .layer , clear = False , redraw = False )
60- return guids
39+ polygons = [{'points' : [vertices [index ] for index in face ]} for face in self .shape .faces ]
40+ guids = compas_rhino .draw_faces (polygons , clear = False , redraw = False )
41+ guid = compas_rhino .rs .JoinMeshes (guids , delete_input = True )
42+ compas_rhino .rs .ObjectLayer (guid , self .layer )
43+ compas_rhino .rs .ObjectName (guid , self .shape .name )
44+ compas_rhino .rs .ObjectColor (guid , color )
45+ return [guid ]
0 commit comments