Difference between revisions of "workshop01G5:Codefarm"

From CECO
Jump to: navigation, search
 
(3 intermediate revisions by 2 users not shown)
Line 5: Line 5:
 
<div style="float:left; width: 160px; height 30px; border: 1px solid #aaa; margin-right:10px; " align="center">[[workshop01G5:Group|'''Group 5''']]</div>
 
<div style="float:left; width: 160px; height 30px; border: 1px solid #aaa; margin-right:10px; " align="center">[[workshop01G5:Group|'''Group 5''']]</div>
  
<div style="float:left; width: 160px; height 30px; border: 1px solid #aaa; margin-right:10px;" align="center">[[workshop01G5:Objectives|'''Objectives''']]</div>
+
<div style="float:left; width: 160px; height 30px; border: 1px solid #aaa; margin-right:10px;" align="center">[[workshop01G5:Past Experiments|'''Past Experiments''']]</div>
  
<div style="float:left; width: 160px; height 30px; border: 1px solid #aaa; margin-right:10px;" align="center">[[workshop01G5:Prototypes|'''Prototypes''']]</div>
+
<div style="float:left; width: 160px; height 30px; border: 1px solid #aaa; margin-right:10px;" align="center">[[workshop01G5:Present to Future|'''Present to Future''']]</div>
  
 
<div style="float:left; width: 160px; height 30px; border: 1px solid #aaa; margin-right:10px;" align="center">[[workshop01G5:Codefarm|'''Code Farm''']]</div>
 
<div style="float:left; width: 160px; height 30px; border: 1px solid #aaa; margin-right:10px;" align="center">[[workshop01G5:Codefarm|'''Code Farm''']]</div>
Line 18: Line 18:
  
 
import rhinoscriptsyntax as rs
 
import rhinoscriptsyntax as rs
 +
 
import random  
 
import random  
import math
+
 
 
import scriptcontext
 
import scriptcontext
  
Line 41: Line 42:
 
             print rs.AddPoint(strPt)
 
             print rs.AddPoint(strPt)
 
strPts=[]
 
strPts=[]
 +
 
strPt1=rs.AddPoint((0,0,0))
 
strPt1=rs.AddPoint((0,0,0))
 +
 
vec1=rs.VectorCreate((1,0,0),(0,0,0))
 
vec1=rs.VectorCreate((1,0,0),(0,0,0))
 +
 
strPt=rs.PointAdd(strPt1,vec1)
 
strPt=rs.PointAdd(strPt1,vec1)
 +
 
generation(3,strPt)
 
generation(3,strPt)
 +
 
print strPts[3]
 
print strPts[3]
 +
 +
 +
[[Image:Group5-cellar automata diagram.jpg|900px]]

Latest revision as of 14:35, 4 October 2013



cell generation

import rhinoscriptsyntax as rs

import random

import scriptcontext


def generation(x,strPt):

   #have a line so i can use "escape" key
   scriptcontext.escape_test()
   if x==0: return
   else:
       for i in range (0,100):
           #define the direction the starting point will grow
           point=[(0,1,0),(1,0,0),(-1,0,0),(0,-1,0)]
           rnd=random.choice(point)
           vec=rs.VectorCreate(rnd,(0,0,0))
           strPt=rs.PointAdd(strPt,vec)
           strPts.append(strPt)
           #form a volume based on the point
           rs.AddCircle(strPt,0.5)
           print rs.AddPoint(strPt)

strPts=[]

strPt1=rs.AddPoint((0,0,0))

vec1=rs.VectorCreate((1,0,0),(0,0,0))

strPt=rs.PointAdd(strPt1,vec1)

generation(3,strPt)

print strPts[3]


Group5-cellar automata diagram.jpg