compas icon indicating copy to clipboard operation
compas copied to clipboard

`Mesh` parameter `vertextext` does not get passed

Open ricardoavelino opened this issue 2 years ago • 2 comments

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:

image

I am using compas version 1.14.0.

Could you give me some light in how to add vertex texts to the current plotter?

ricardoavelino avatar Feb 15 '22 18:02 ricardoavelino

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()

tomvanmele avatar Feb 22 '22 08:02 tomvanmele

Thanks. That will work for now!

ricardoavelino avatar Feb 22 '22 17:02 ricardoavelino