20070831
Option Explicit 'OPTION EXPLICIT forces you to declare variables with the DIM or REDIM statement 'OPTION EXPLICIT should always be the first line in the code 'Script written by Charles Portelli 'Script version Wednesday, August 29, 2007 3:05:53 PM
'Using the apostrophe allows for comments to be added in to the code 'Comments are usefull because they allow us to add notes to the code 'that do not affect the execution of the code
'GLOBAL Variables = variables that are used through out the code 'Always declare you global variables in the begining '-------------------------------------------- Dim axiom : axiom = "abc" 'declaring the axiom Dim numberOfGenerations : numberofgenerations = 6 'declaring the number of generations
ReDim rules(2,1) 'declaring the rules rules(0,0) = "a" 'A -> B the letter A gets replaced with the letter B rules(0,1) = "b" rules(1,0) = "b" 'B -> A the letter B gets replaced with the letter A rules(1,1) = "a" rules(2,0) = "c" 'C -> AA the letter C gets replaced with the letters AA rules(2,1) = "aa" '--------------------------------------------
Call Main() 'this tells the computer to go to the MAIN SUB hence Call Main
Sub Main()
Dim i,j 'this is where you declare you local variables Dim arrPoint, x,y,z x=0 : y=0 : z=0
'perform the string replacement for each generation For j=0 To numberOfGenerations rhino.print axiom 'print the axiom in the command line 'draw each generation For i=1 To len(axiom) 'for every letter in the axiom arrPoint = array(j,i-1,z) rhino.addTextDot Mid(axiom, i, 1), arrPoint 'add a text dot with each letter from the axiom Next
For i=0 To Ubound(rules,1) 'for each of the rules in the first dimension 'a match is converted into a number axiom = Replace(axiom, rules(i,0), i) 'take the letter in the axiom and replace it with a number Next
For i=0 To Ubound(rules,1) 'the number is replaced with the result of the substitution rule axiom = Replace(axiom, i, rules(i,1)) 'now replace that number based on your rules Next
Next Rhino.Print("finished!") 'when finished display FINISHED in the command line End Sub 'this marks the end of the MAIN SUB _______________
Option Explicit 'Script written by Charlie Portelli 'Script version Thursday, August 30, 2007 8:29:50 PM
Dim i, j Dim row : row = 10 Dim column : column = 10 Dim count : count = 0 ReDim pts(120) ReDim UV(1) UV(0) = 11 UV(1) = 11 Call Main()
Sub Main()
For i = 0 To row For j = 0 To column Dim temp: temp = array(i,j,rnd) rhino.addpoint(temp) pts(count) = temp count = count+1 Next Next rhino.AddSrfPtGrid UV, pts End Sub
.: Krystal Javier Grullon 8:50 PM
|