How can I plot the vertex, edge and face numbers of a datastructure in Rhino


#1

User question:

How can I plot the vertex, edge and face numbers of a datastructure in Rhino?

Answer:

For all of the CAD packages in compas, such as compas_rhino and compas_blender, the recommended way to visualise the indices of the vertices, edges or faces is via the Artist objects (NetworkArtist, MeshArtist, …).

These can be imported like so:

from compas_rhino.helpers import MeshArtist
from compas_blender.helpers import MeshArtist

The Artist is then easily made by handing over the datastructure:

meshartist = MeshArtist(mesh=mesh, layer='MeshArtist')
meshartist = MeshArtist(mesh=mesh, layer=1)

You can then plot a variety of things to the layer linked with the Artist.

meshartist.draw_vertices()
meshartist.draw_vertexlabels()
meshartist.draw_edges()
meshartist.draw_edgelabels()
meshartist.draw_faces()
meshartist.draw_facelabels()

You can clear anything that was drawn/plotted with:

meshartist.clear_vertices()
meshartist.clear_vertexlabels()

# Similarly for edges and faces.

You can also plot or clear specific vertices, edges or faces with the keys argument:

meshartist.clear_edges(keys=[(0, 4)])
meshartist.clear_edgelabels(keys=[(5, 4)])