from TSsupport import rand, randint
from math import *
import trueSpace

doc = trueSpace.GetActiveDocument()
doc.ClearOutTxt()

#
# Blank script
#


first = doc.CurrentSelection()



       


thickness = 6
progress = 0
for particle in range (1, thickness +1):
     

     numberobjectshmm = 10
     distanceup = 20
     xs = 0
     zs = 0
     ys = 0
     scales = 100
     scalesrandom = 200
     secound = doc.Object("Sphere")
     scalinglooph = rand()*60
     xsc = scales 
     zsc = scales 
     ysc = scales
     windx = 0
     windz = 0
     blowx = 0
     blowz = 0
     position= 120
     for particle in range (1, numberobjectshmm +1):
         doc.CurrobjCopy()
         secound = doc.CurrentSelection()
         xs = rand()*position + windx
         zs = rand()*position + windz
         randint = 200
         ys = ys + rand()*10 + distanceup 
         secound.Position = (xs,zs,ys)
         randint = scalesrandom
         scaling = doc.CurrentSelection()
         secound.Rotate("x", rand()*40)
         secound.Rotate("y", rand()*40)
         secound.Rotate("z", rand()*40)
         xsc = xsc + scalinglooph +2
         zsc = zsc + scalinglooph +2
         ysc = ysc + scalinglooph + rand() + 5
         scaling.Scale = (xsc,zsc,ysc)
         randint = distanceup
         windx = windx + +blowx + rand()*distanceup 
         position = position + 80         
         


     



     

                    
    


     

# Group the Array
totalnew = + thickness *  numberobjectshmm +1
Objectsname = "Sphere"
for glueobject in range (1,totalnew): 
       next = doc.Object (Objectsname + "," + str(glueobject)) 
       group = doc.GroupAtCurrobj (next)
                                             
                

doc.Draw()
print "You made this many objects {"
print thickness * numberobjectshmm 
print "}"
trueSpace.Stop()


 


