Gallery details
Component Aggregation Code V.1 [05.July.2009] – via RhinoScript
RHINSCRIPT CODE
Option Explicit
'Script written by Luis Quinones + Griffin Frazen
'Script copyrighted by [n]igma + studioBoom + computationalMatter
'Script version Wednesday, July 29, 2009 9:28:46 AM
Call Main()
Sub Main()
'User input
Dim arrObj (9)
Dim gens
'prompt user for number of gens
gens = Rhino.GetReal("How many generations", 6)
'arrObj (mesh,pt1,pt2,pt3......pt9)
arrObj(0) = Rhino.GetObject("Select Mesh")
arrObj(1) = Rhino.GetObject("Select ref point 1",1)
arrObj(2) = Rhino.GetObject("Select ref point 2",1)
arrObj(3) = Rhino.GetObject("Select ref point 3",1)
arrObj(4) = Rhino.GetObject("Select tar1 point 1",1)
arrObj(5) = Rhino.GetObject("Select tar1 point 2",1)
arrObj(6) = Rhino.GetObject("Select tar1 point 3",1)
arrObj(7) = Rhino.GetObject("Select tar2 point 1",1)
arrObj(8) = Rhino.GetObject("Select tar2 point 2",1)
arrObj(9) = Rhino.GetObject("Select tar2 point 3",1)
'very beginning of main
Dim arrItems : arrItems = Array ("Animate", "Off", "On")
Dim arrDefaults : arrDefaults = Array(True) 'off is the default
'in the beginning of main with other user inputs
Dim arrIterationBlnReturn : arrIterationBlnReturn = Rhino.GetBoolean ("Would you like to ", arrItems,
arrDefaults) If Not isArray(arrIterationBlnReturn) Then Exit Sub
'For exporting images
If arrIterationBlnReturn(0) = "True" Then
Dim intIterationsPerImage : intIterationsPerImage = Rhino.GetInteger ("export images once in how many iterations?", 1, 1)
If isNull(arrIterationBlnReturn) Then Exit Sub
'hardcoded variables:
'CHANGE THE FILE NAME TO AN EXISTING FOLDER - THE LAST PART IS THE BEGINNING OF THE FILE NAME
Dim strFilename: strFilename ="C:Documents and SettingsAnim_"
Dim dblImageXSize : dblImageXSize = 968
Dim dblImageYSize : dblImageYSize = 462
Dim intImageCounter : intImageCounter = 0
'turn off unwanted screen info
Dim strView : strView = Rhino.CurrentView()
Rhino.ShowGrid strView, False
Rhino.ShowGridAxes strView, False
Rhino.ShowViewTitle strView, False
Rhino.ShowWorldAxes strView, False
Call exportImage(strFilename, dblImageXSize, dblImageYSize, strView, intImageCounter)
End If
Call aggregate (arrObj,gens,0,arrIterationBlnReturn(0),intIterationsPerImage,intImageCounter,strFilename,dblImageXSize,dblImageYSize,strView)
'Call recursive function
End Sub
Function aggregate (arrObj,gens,ByRef intCounter, blnAnimate,intIterationsPerImage,intImageCounter,strFilename,dblImageXSize,dblImageYSize,strView)
Dim arrREFPTs(2)
Dim arrTAR1PTs(2)
Dim arrTAR2PTs(2)
Dim arrOBJ1
Dim arrOBJ2
'condition based on generations
If gens > 0 Then
'compile an array of pts : ref,target1,target2
'array of ref pts.
arrREFPTs(0) = Rhino.PointCoordinates(arrObj(1))
arrREFPTs(1) = Rhino.PointCoordinates(arrObj(2))
arrREFPTs(2) = Rhino.PointCoordinates(arrObj(3))
arrTAR1PTs(0) = Rhino.PointCoordinates(arrObj(4))
arrTAR1PTs(1) = Rhino.PointCoordinates(arrObj(5))
arrTAR1PTs(2) = Rhino.PointCoordinates(arrObj(6))
arrTAR2PTs(0) = Rhino.PointCoordinates(arrObj(7))
arrTAR2PTs(1) = Rhino.PointCoordinates(arrObj(8))
arrTAR2PTs(2) = Rhino.PointCoordinates(arrObj(9))
'orient the object
arrOBJ1 = Rhino.OrientObjects(arrObj, arrREFPTs, arrTAR1PTs, 1)
'at the end of the loop that you want to
intCounter = intCounter + 1
If blnAnimate = "True" Then
If intCounter Mod intIterationsPerImage = 0 Then
intImageCounter = intImageCounter + 1
Call exportImage(strFilename, dblImageXSize, dblImageYSize, strView, intImageCounter)
End If
End If
arrOBJ2 = Rhino.OrientObjects(arrObj, arrREFPTs, arrTAR2PTs, 1)
intCounter = intCounter + 1
'at the end of the loop that you want to
If blnAnimate = "True" Then
If intCounter Mod intIterationsPerImage = 0 Then
intImageCounter = intImageCounter + 1
Call exportImage(strFilename, dblImageXSize, dblImageYSize, strView, intImageCounter)
End If
End If
'calling recursive function (add the minus one so that the gen runs and each time is one less so it counts down to 0
'otherwise it will never end
Call aggregate (arrOBJ1,gens-1,intCounter,
blnAnimate,intIterationsPerImage,intImageCounter,strFilename,dblImageXSize,dblImageYSize,strView)
Call aggregate (arrOBJ2,gens-1,intCounter, blnAnimate,intIterationsPerImage,intImageCounter,strFilename,dblImageXSize,dblImageYSize,strView)
End If
End Function
Sub exportImage(strFilename, dblImageXSize, dblImageYSize, strView, intIteration)
Dim strNumber
'create a number for the image, additional zeros are added to ensure the files are read in the correct order by photoshop batch actions
If intIteration < 9 Then
strNumber = "000" & (intIteration + 1)
ElseIf intIteration > 8 And intIteration < 99 Then
strNumber = "00" & (intIteration + 1)
ElseIf intIteration > 98 And intIteration < 999 Then
strNumber = "0" & (intIteration + 1)
Else
strNumber = intIteration + 1
End If
'send the image to an appropriately named file
Rhino.CreatePreviewImage strFilename & strNumber & ".jpg", strView, array(dblImageXSize, dblImageYSize)
End Sub
Update
Recently in Portfolio
- [K]ernels

- Nike A.I.R Prototypes

- [A]nisochromatic Meshing

- Nike After Dark Tour

- PARAPRAXIS

- [001.HRR] CONCEPT BIKE

- 2040:LUNAR.OUTPOST[a]

- HE.6 2020 Prototype

- CULEBRA.NET

- PYTORCH-CLASSIFIER

- Nike Zoom Superfly Elite

- BENGBU CITY OPERA

- Nike Footscape Flyknit DM

- Jordan Hyperdunk React

- KA-HELMET

- [C]ucarachas

- [S]eeker

- [O]h Baby

- [E]l Papa

- [S]hatter.Brain

- [S]tigmergy

- [F]orces

- CULEBRA.JAVA

- [C]ulebra.MultiBehaviors

- [S]ticky Stuff

- [S]entinels

- [G]allopingTopiary

- RELUXOED

- [SRC] . Semi Rigid Car

- [P]erlin

- [E]ternal Wanderers

- [W]heelie

- [S]labacube

- [M]esh Crawlers

- [L]a Silla

- [3]D BabyMaking Trackstars

- [3]D Trackers

- [2]D BabyMaking Trackers

- [T]rackers

- CULEBRA GRASSHOPPER

- culebra.[M]eshCrawlers.3D

- culebra.[H]ybrid.3D

- culebra.[F]lorgy

- culebra.[F]ockers.3D

- culebra.[F]ockers.2D

- culebra.[N]oisey.3D

- [E]l Nino

- culebra.[S]elfOrg

- [D]rippin

- culebra.[N]oisey.2D

- [C]reepyCrawlers

- [J]eepresesCreepers

- [T]2000

- PUFFER PLEATNESS

- EMERGEN[CY]

- [L]iquified

- [S]uckedComp

- [X]plosion

- MR. EW

- [H]airGoo

- [B]alled

- [n]injaStars

- [b]loomer

- [t]rip city

- TAPE GUNNED

- [B]oom

- [M]iller Time

- [D]elamjam

- [B]rain Zapper

- [B]ig Bird

- [E]gg Tube Pavillion

- [A]llice’s Easter Tree

- [S]weet Honey

- [U]M.Urgent

- [t]oo.urgent

- [B]onnie..+..Clyde

- [B]io Mess

- [EL]Mojado.Virus

- [W]HAT the …!

- [H]ot Lava

- [P]leat Diddy

- [t]erminator easter egg

- Mr. BB

- [B]less You

- [F]antastic + Interactive

- [S]oo_Minimally_Pathed

- [P]uffer Fish.Fab

- [M]an Eater

- [AHH] Alien House Hunters

- [W]eave Machine

- Sportbike Racing

- Grappling

- Kart Racing



Leave a reply