Last active
October 4, 2020 13:50
-
-
Save CGLion/2adb6bcebdbcacfd9383511dc7f459e4 to your computer and use it in GitHub Desktop.
Python for 3ds max - Create random spheres
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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