compas
compas copied to clipboard
`Mesh` parameter `vertextext` does not get passed
The Mesh
parameter vertextext
does not get passed to the plotter. Therefore, the code below that should write the vertex key in the vertices does not work as expected.
Code:
from compas.datastructures import Mesh
from compas_plotters import Plotter
p = [(0, 0, 0), (10, 0, 0), (10, 10, 0), (0, 10, 0)]
lines = [(p[0], p[1]), (p[1], p[2]), (p[2], p[3]), (p[3], p[0])]
mesh = Mesh.from_lines(lines)
plotter = Plotter()
plotter.add(mesh, vertextext={key: key for key in mesh.vertices()})
plotter.show()
Result:

I am using compas version 1.14.0
.
Could you give me some light in how to add vertex texts to the current plotter?
yes, the labeling functionality is indeed not fully updated yet. will try to fix asap. in the meantime, something like this should work...
from compas.datastructures import Mesh
from compas_plotters.plotter import Plotter
mesh = Mesh.from_meshgrid(10, 10)
plotter = Plotter()
plotter.fontsize = 6
artist = plotter.add(mesh, vertexsize=30)
artist.draw_vertexlabels()
plotter.zoom_extents()
plotter.show()
Thanks. That will work for now!