Kami – CLASS 07 converting from skeletal to class code

04 CLASS stacked spheres

import math
import rhinoscriptsyntax as rs

class Ring():
def __init__(self):
self.makeringofSpheres()
def makeringofSpheres(self):
pi = math.pi
dblTwistAngle = 0.0
for z in rs.frange(0.0, 5.0, 0.5):
dblTwistAngle = dblTwistAngle + (pi/30)
#this is for the twisting as it loops upwards
for a in rs.frange(0.0, 2*pi, (pi/15)):
x = 5 * math.sin(a + dblTwistAngle)
y = 5 * math.cos(a + dblTwistAngle)
rs.AddSphere([x,y,z], 0.5) #the center and radius
#this is for the first ring of spheres

r = Ring()
r.makeringofSpheres()

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s