custom_axes4.py 1.0 KB

123456789101112131415161718192021222324252627282930313233
  1. """Create individual axes to each separate object in a scene.
  2. Access any element to change its size and color"""
  3. from vedo import *
  4. settings.use_depth_peeling = True
  5. # Create a bunch of objects
  6. s1 = Sphere(pos=(10, 0, 0), r=1, c='r')
  7. s2 = Sphere(pos=( 0,10, 0), r=2, c='g')
  8. s3 = Sphere(pos=( 0, 0,10), r=3, c='b')
  9. pt = Point([-4,-4,-4], c='k')
  10. # Build individual axes for each object.
  11. # A new Assembly object is returned:
  12. axes1 = Axes(s1, c='r')
  13. axes2 = Axes(s2, c='g')
  14. axes3 = Axes(s3, c='b', number_of_divisions=10)
  15. # axes3 is an Assembly (group of Meshes).
  16. # Unpack it and scale the 7th label getting it by its name,
  17. # make it 5 times bigger big and fuchsia:
  18. # Print all element names in axes3:
  19. #for m in axes3.get_meshes(): print(m.name)
  20. axes3['xNumericLabel 7'].scale(5).c('fuchsia')
  21. # By specifiyng axes in show(), new axes are
  22. # created which span the whole bounding box.
  23. # Options are passed through a dictionary
  24. show(pt, s1, s2, s3, axes1, axes2, axes3, __doc__,
  25. viewup='z',
  26. axes=dict(c='black', number_of_divisions=10, yzgrid=False),
  27. ).close()