def mesh_draw_edges(mesh, keys=None, color=None): """Draw a selection of edges of the mesh. Parameters ---------- keys : list A list of edge keys (as uv pairs) identifying which edges to draw. Default is to draw all edges. Notes ----- All edges are named using the following template: ``"{}.edge.{}-{}".fromat(self.mesh.attributes['name'], u, v)``. Examples -------- >>> mesh_draw_edges(mesh) >>> mesh_draw_edges(mesh, keys=mesh.edges_on_boundary()) """ artist = MeshArtist(mesh) return artist.draw_edges(keys, color)
from compas.datastructures import Mesh from compas.datastructures import mesh_subdivide from compas_ghpython.artists import MeshArtist # make a control mesh mesh = Mesh.from_polyhedron(6) # set default vertex attributes mesh.update_default_vertex_attributes({'is_fixed': False}) # make an artist for drawing artist = MeshArtist(mesh) # draw the control mesh into outputs P, L P = artist.draw_vertices() L = artist.draw_edges() # keep some of the vertices fixed and make a subd mesh (using catmullclark) for key, value in zip(range(len(is_fixed)), is_fixed): mesh.set_vertex_attribute(key, 'is_fixed', value) fixed = mesh.vertices_where({'is_fixed': True}) subd = mesh_subdivide(mesh, scheme='catmullclark', k=k, fixed=fixed) # pass the new mesh to the artist artist.mesh = subd # draw the result into output M M = artist.draw_mesh()