flag_labels1.py 896 B

12345678910111213141516171819202122232425262728
  1. """Hover mouse onto an object
  2. to pop a flag-style label"""
  3. from vedo import *
  4. b = Mesh(dataurl + "bunny.obj")
  5. b.color("purple5").legend("Bugs the bunny")
  6. c = Cube(side=0.1).y(-0.02).compute_normals()
  7. c.alpha(0.8).lighting("off").lw(1).legend("The Cube box")
  8. cap = c.caption(
  9. "2d caption for a cube\nwith face indices",
  10. point=[0.044, 0.03, -0.04],
  11. size=(0.3, 0.06),
  12. font="VictorMono",
  13. alpha=1,
  14. )
  15. # create a new object made of polygonal text labels to indicate the cell numbers
  16. flabs = c.labels("id", on="cells", font="Theemim", scale=0.02, c="k")
  17. vlabs = c.clone().clean().labels2d(font="ComicMono", scale=3, bc="orange7")
  18. # create a custom entry to the legend
  19. lbox = LegendBox([b, c], font="Bongas", width=0.25, bg='blue6')
  20. with Plotter(axes=11, bg2="linen") as plt:
  21. plt.add(b, c, cap, flabs, vlabs, lbox, __doc__)
  22. plt.add_hint(b, "My fave bunny")
  23. plt.show()