-
Notifications
You must be signed in to change notification settings - Fork 32
Python_CreateGeometricObjects
dstoeckel edited this page Mar 16, 2015
·
2 revisions
The following example creates a simple box with given color:
# specify dimensions of the new box
size = 3
v1 = Vector3(0.)
v2 = Vector3(size, 0, 0)
v3 = Vector3(0, size, 0)
v4 = Vector3(0, 0, size)
# create a red box
colored_box = Box(v1, v2, v3, v4)
colored_box.setColor(ColorRGBA(1, 0, 0, 0.8))
# create a representation for the box
r = Representation()
r.insert(colored_box)
# add the representation to the main control
getMainControl().insert(r)
# update the representation
getMainControl().update(r)
Here a sphere is created:
# specify radius and position (center) of the sphere
r = 4
pos = Vector3(0.)
# create a sphere with given radius and center
s = Sphere()
s.setRadius(r)
s.setPosition(pos)
color = ColorRGBA(1, 0, 0, 0.8)
s.setColor(color)
# create/update the representation for the box
r = Representation()
r.insert(s)
getMainControl().insert(r)
getMainControl().update(r)
The examples are intended for usage within BALLView.