Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Python for 3ds max - Create random spheres
from MaxPlus import ClassIds
from MaxPlus import Point3
import random
# Define Sphere geometry object:
sphere_obj = Factory.CreateGeomObject(ClassIds.Sphere)
sphere_obj.ParameterBlock.Radius.Value = 5
sphere_obj.ParameterBlock.Segs.Value = 64
# Create a list of 10 sphere instanced objects:
spheres = []
for i in range(10):
spheres.append(Factory.CreateNode(sphere_obj))
# Move spheres to random positions
for s in spheres:
s.SetLocalPosition(Point3( random.randint(-50,50),
random.randint(-50,50),
random.randint(-50,50)))
scale = 5.0 * (random.randint(30,100)/100.0)
s.SetLocalScale(Point3(scale,scale,scale))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.