sc003.jpg
novelty and the perverse in the urban wild

third script: looping the script to get continous generation of the system.
problem unresolved: syntax entry which would enable self-morphology embedded within the script. this would achieve a balancing loop.
result: artifitial simulation of progressive state change by the cube unit. 150 iterations, step 1: 67% step 2: 50% step 3. 33%

script:

option explicit
'balancing loop feedback system
'thanks to gil for help

dim intIterations: intIterations = rhino.getInteger ("input Iteration")
dim imageLocation
dim l
dim intPopulation, intStartXPercentage
dim numberOfX, maxPercentX, maxNumberOfX, numberOfY, maxPercentY, maxNumberOfY, intStartYPercentage, numberOfZ, maxNumberOfZ, maxPercentZ
dim Y, X, Z
dim intNewXPercentage, intNewPopulation
'initial distribution of X, Y, Z
intPopulation = rhino.getInteger ("input population", 100, 2, 10000)
intStartXPercentage = rhino.getInteger ("input percentage of X", 33, 1, 100)
intStartYPercentage = rhino.getInteger ("input percentage of Y", (intPopulation - intStartXPercentage) / 2, 1, 100 - intStartXPercentage)
maxPercentZ = rhino.getInteger ("input maximum percentage of Z", 90, 1, 100)
maxPercentX = rhino.getInteger ("input maximum percentage of X", 90, 1, 100)
maxPercentY = rhino.getInteger ("input maximum percentage of Y", 90, 1, 100)
intNewPopulation = intPopulation

sub dumbNumbers
'run iterations of populate function
For l = 0 to (intIterations - 1)
Rhino.command ("selall")
Rhino.command ("delete")
Rhino.command ("selnone")
makeObjects

' get top view
Rhino.command ("-_SetView _World _Top")
' screengrab
imageLocation = ("-_ScreenCaptureToFile E:\0shit\screencraps\001\screencraps" & (l) & ".jpg enter")
Rhino.command (imageLocation)

' get front view
Rhino.command ("-_SetView _World _Perspective")
Next
if l = (intIterations - 1) then exit sub
end sub
dumbNumbers
'array objects
Function makeObjects
dim arrPopulationMembersState(), maxCurrentRow, currentMemberState, desiredState
dim arrBoxPts, arrBoxPt0, arrBoxPt1, arrBoxPt2, arrBoxPt3, arrBoxPt4, arrBoxPt5, arrBoxPt6, arrBoxPt7
dim i, j, k, intNumberPerRow, arrPopulationMembers(), blnYX

'setup of population percentages
'spheres are Y, cones are X, cubes are Z
if isNull(intPopulation) then exit Function

'for cones(X)
if isNull(intStartXPercentage) then exit Function
if isNull(intStartXPercentage) then exit Function

'for spheres (Y)
if isNull(intStartYPercentage) then exit Function
if isNull(intStartYPercentage) then exit Function
'for cubes (Z)
if isNull(maxPercentZ) then exit Function

i = 0
j = 0
k = 0
intNumberPerRow = int(intPopulation ^ (1/2)) - 1
maxCurrentRow = intNumberPerRow
redim arrPopulationMembers(-1)
redim arrPopulationMembersState(-1)

'build the population
For i = 0 to (intPopulation - 1)
redim preserve arrPopulationMembers(uBound(arrPopulationMembers)+1)
redim preserve arrPopulationMembersState(uBound(arrPopulationMembers)+1)
arrBoxPt0 = array(k*5 + 0.5, j*5 - 0.5, -0.5)
arrBoxPt1 = array(k*5 + 0.5, j*5 + 0.5, -0.5)
arrBoxPt2 = array(k*5 - 0.5, j*5 + 0.5, -0.5)
arrBoxPt3 = array(k*5 - 0.5, j*5 - 0.5, -0.5)
arrBoxPt4 = array(k*5 + 0.5, j*5 - 0.5, 0.5)
arrBoxPt5 = array(k*5 + 0.5, j*5 + 0.5, 0.5)
arrBoxPt6 = array(k*5 - 0.5, j*5 + 0.5, 0.5)
arrBoxPt7 = array(k*5 - 0.5, j*5 - 0.5, 0.5)
'create boxes (Z)
arrBoxPts = array(arrBoxPt0, arrBoxPt1, arrBoxPt2, arrBoxPt3, arrBoxPt4, arrBoxPt5, arrBoxPt6, arrBoxPt7)
arrPopulationMembers(i) = Rhino.AddBox (arrBoxPts)
arrPopulationMembersState(i) = Z

'create cones (X)
If rnd(1)<intStartXPercentage/100 then
rhino.deleteObject(arrPopulationMembers(i))
arrPopulationMembers(i) = Rhino.AddCone (array(k*5,j*5,0), array(k*5,j*5,1), 1)
arrPopulationMembersState(i) = X
End If

'create spheres (Y)
If rnd(1)<intStartXPercentage/100 then
rhino.deleteObject(arrPopulationMembers(i))
arrPopulationMembers(i) = Rhino.AddSphere (array(k*5,j*5,0), 1)
arrPopulationMembersState(i) = Y
End If
if i = maxCurrentRow then
maxCurrentRow = maxCurrentRow + intNumberPerRow
j = j + 1
End If
k = k + 1
if k

intNumberPerRow then k

0
Next
End Function