File: custom_axes4.py

package info (click to toggle)
vedo 2025.5.3-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 10,404 kB
  • sloc: python: 64,792; javascript: 1,932; xml: 437; sh: 139; makefile: 6
file content (33 lines) | stat: -rw-r--r-- 1,073 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
"""Create individual axes to each separate object in a scene.
Access any element to change its size and color"""
from vedo import *

settings.use_depth_peeling = True

# Create a bunch of objects
s1 = Sphere(pos=(10, 0, 0), r=1, c='r')
s2 = Sphere(pos=( 0,10, 0), r=2, c='g')
s3 = Sphere(pos=( 0, 0,10), r=3, c='b')
pt = Point([-4,-4,-4], c='k')

# Build individual axes for each object.
#  A new Assembly object is returned:
axes1 = Axes(s1, c='r')
axes2 = Axes(s2, c='g')
axes3 = Axes(s3, c='b', number_of_divisions=10)

# axes3 is an Assembly (group of Meshes).
# Unpack it and scale the 7th label getting it by its name,
# make it 5 times bigger big and fuchsia:

# Print all element names in axes3:
#for m in axes3.get_meshes(): print(m.name)
axes3['xNumericLabel 7'].scale(5).c('fuchsia')

# By specifiyng axes in show(), new axes are
#  created which span the whole bounding box.
#  Options are passed through a dictionary
show(pt, s1, s2, s3, axes1, axes2, axes3, __doc__,
     viewup='z',
     axes=dict(c='black', number_of_divisions=10, yzgrid=False),
).close()