demoSphereBorg.py

demoSphereBorg.py
1 '''
2  Demonstrates creating objects, object instancing, and object translation.
3 '''
4 
5 import MaxPlus
6 
7 
8 def CreateBorg(obj, n, sz):
9  for i in xrange(n):
10  for j in xrange(n):
11  for k in xrange(n):
12  name = "element_{0}_{1}_{2}".format(i, j, k)
13  node = MaxPlus.Factory.CreateNode(obj, name)
14  pt = MaxPlus.Point3(i * sz, j * sz, k * sz)
15  node.Move(pt)
16 
17 
18 def main():
19  obj = MaxPlus.Factory.CreateGeomObject(MaxPlus.ClassIds.Sphere)
20  obj.ParameterBlock.Radius.Value = 2.0
21  CreateBorg(obj, 4, 5.0)
22 
23 if __name__ == "__main__":
24  main()