@@ -23,25 +23,63 @@ class MeshArtist(GHArtist, MeshArtist):
2323 A COMPAS mesh.
2424 """
2525
26- def __init__ (self , mesh , ** kwargs ):
26+ def __init__ (self ,
27+ mesh ,
28+ show_mesh = False ,
29+ show_vertices = True ,
30+ show_edges = True ,
31+ show_faces = True ,
32+ ** kwargs ):
2733 super (MeshArtist , self ).__init__ (mesh = mesh , ** kwargs )
34+ self .show_mesh = show_mesh
35+ self .show_vertices = show_vertices
36+ self .show_edges = show_edges
37+ self .show_faces = show_faces
2838
29- def draw (self , color = None ):
30- """Draw the mesh as a RhinoMesh .
39+ def draw (self , vertices = None , edges = None , faces = None , vertexcolor = None , edgecolor = None , facecolor = None , color = None , join_faces = False ):
40+ """Draw the mesh using the chosen visualisation settings .
3141
3242 Parameters
3343 ----------
44+ vertices : list, optional
45+ A list of vertices to draw.
46+ Default is ``None``, in which case all vertices are drawn.
47+ edges : list, optional
48+ A list of edges to draw.
49+ The default is ``None``, in which case all edges are drawn.
50+ faces : list, optional
51+ A selection of faces to draw.
52+ The default is ``None``, in which case all faces are drawn.
53+ vertexcolor : tuple or dict of tuple, optional
54+ The color specififcation for the vertices.
55+ The default color is the value of ``~MeshArtist.default_vertexcolor``.
56+ edgecolor : tuple or dict of tuple, optional
57+ The color specififcation for the edges.
58+ The default color is the value of ``~MeshArtist.default_edgecolor``.
59+ facecolor : tuple or dict of tuple, optional
60+ The color specififcation for the faces.
61+ The default color is the value of ``~MeshArtist.default_facecolor``.
3462 color : tuple, optional
3563 The color of the mesh.
3664 Default is the value of ``~MeshArtist.default_color``.
65+ join_faces : bool, optional
66+ Join the faces into 1 mesh.
67+ Default is ``False``, in which case the faces are drawn as individual meshes.
3768
3869 Returns
3970 -------
4071 :class:`Rhino.Geometry.Mesh`
4172 """
42- color = color or self .default_color
43- vertices , faces = self .mesh .to_vertices_and_faces ()
44- return compas_ghpython .draw_mesh (vertices , faces , color )
73+ geometry = []
74+ if self .show_mesh :
75+ geometry .append (self .draw_mesh (color = color ))
76+ if self .show_vertices :
77+ geometry .extend (self .draw_vertices (vertices = vertices , color = vertexcolor ))
78+ if self .show_edges :
79+ geometry .extend (self .draw_edges (edges = edges , color = edgecolor ))
80+ if self .show_faces :
81+ geometry .extend (self .draw_faces (faces = faces , color = facecolor , join_faces = join_faces ))
82+ return geometry
4583
4684 def draw_mesh (self , color = None ):
4785 """Draw the mesh as a RhinoMesh.
@@ -63,7 +101,10 @@ def draw_mesh(self, color=None):
63101 The mesh should be a valid Rhino Mesh object, which means it should have only triangular or quadrilateral faces.
64102 Faces with more than 4 vertices will be triangulated on-the-fly.
65103 """
66- return self .draw (color )
104+ color = color or self .default_color
105+ print (self .default_color )
106+ vertices , faces = self .mesh .to_vertices_and_faces ()
107+ return compas_ghpython .draw_mesh (vertices , faces , color )
67108
68109 def draw_vertices (self , vertices = None , color = None ):
69110 """Draw a selection of vertices.
0 commit comments