21 July 2013

Gh python Field

Testing the Gh Python component, it's a first attempt, more to come...soon the ghx file at www.co-de-it.com





copy and paste in the GH python component:


#code by davide del giudice www.co-de-it.com
# import library 

import rhinoscriptsyntax as rs

import math 

#create a list

myList= []
myList2= []

#start looping structure
for att in attractors:
    attLoc = rs.PointCoordinates(att)
for i in range (0,num):
    for j in range (0,num):

        #define the radius
        myZ= radius*math.sin(math.tan(j*(i)))+0.2
        #define center point
        myPoint= (spacing*i,spacing*j,myZ)
        #create the sphere
        myPt= rs.AddPoint (myPoint)
        #store the current sphere on the list
        myList.append(myPt)
        
        value= rs.Distance (myPt,attLoc)
        print value
        myZ2= myZ*value
        myPoint2= (spacing*i,spacing*j,myZ2)
        myPt2= rs.AddPoint (myPoint2)
        myList2.append(myPt2)

#return the list of spheres 
points= myList2

0 commenti: