urban 2004-2005 auth residential thesis SCRIPTING research studio 2006-2007 installation 2005-2006 USES j+aphilippou programs seminar FLOWS 2002-2003 largeScale 2003-2004 professional iaac workshop fabrication 2007-2008

11.11.08

SCRIPTED LAMP_Scripting, IaaC 2008

“Introduction / Justification

Programming is a pure and free language of lies in its practice. It can be used for example, for the planning of cities as well as to solve a simple problem of distribution to the interior of a house. Nevertheless both challenges are faced the same tools (loops, conditional, first and data types).
The same ordered tools (composed) of different way, design a city or a chair.
The programming implies composition.

Objectives of the Seminar
_ Introduce the student to the use of the programming as design strategy.
_ To extend knowledge of modeling and design with Rhinoceros through RhinoScript.
_ The great problem of the programming is not the language, but the capacity to understand a problem “x” and to be able to abstract it to a mathematical concept (function). The objective therefore would be “to mobilize” to the student to this type of thought.
_ The student will be able to recognize when and how the programming becomes an ally in the process from design and manufacture.”


Script trials:








This is the final script generated for the lamp:

Option Explicit ‘for debugging always use
‘Maria Papaloizou_Peerapong Suntinanond
‘IaaC Scripting Seminar_Carlos de la Barrera_Luis Fraguada
‘February 2008

Call Main()
Sub Main()

‘variable declaration
Dim strcurve1, strcurve2, strcurve3
Dim Domain1, param1, point1, i, sections, Domain2, param2, point2
Dim Domain3, param3, point3

‘number of divisions
sections = 30

‘array declaration
ReDim collection(sections)
ReDim collection2(sections)
ReDim collection3(sections)
ReDim closedcurve(sections)

‘inputs
strcurve1 = rhino.GetObject(”select curve1″)
If isnull (strcurve1) Then Exit Sub

strcurve2 = rhino.GetObject (”select curve2″)
If isnull (strcurve2) Then Exit Sub

strcurve3 = rhino.GetObject(”select curve3″)
If isnull (strcurve3) Then Exit Sub

‘the name of the curve
Domain1 = rhino.CurveDomain(strcurve1)
Domain2 = rhino.CurveDomain(strcurve2)
Domain3 = rhino.CurveDomain(strcurve3)

‘looping
For i = 0 To sections

param1 = i * ((Domain1(1) - Domain1(0))/sections)
param2 = i * ((Domain2(1) - Domain2(0))/sections)
param3 = i * ((Domain3(1) - Domain3(0))/sections)

point1 = rhino.evaluatecurve(strcurve1, param1)
rhino.AddPoint point1

point2 = rhino.evaluatecurve(strcurve2, param2)
rhino.AddPoint point2

point3 = rhino.evaluatecurve(strcurve3, param3)
rhino.AddPoint point3

‘charging the array
collection(i) = point1
collection2(i) = point2
collection3(i) = point3

Next

‘hide the curves since we dont need them anymore
Call Rhino.HideObjects(Array(strcurve1, strcurve2, strcurve3))

‘variable
Dim newpoint, newpoint2, newpoint3

‘looping for pass over the array
For i =0 To sections

newpoint = collection(i)
newpoint2 = collection2(i)
newpoint3 = collection3(i)

‘function calling
Call micurvedclosed(newpoint, newpoint2, newpoint3, closedcurve, i)

Next

‘here we make a loft by the surface inside in the array closedcurve
Dim arrSurface: arrSurface = Rhino.AddLoftSrf(closedcurve)

‘here we do the offset of the surface.
Dim MyOffSurface: MyOffSUrface = Rhino.OffsetSurface (arrSurface(0), 4)

‘here we call a function to evaluate the created surfaces.
‘in this case the offset return an string
Call EvaluateSurface(arrSurface, MyOffSurface)

End Sub

Function micurvedclosed(newpoint, newpoint2, newpoint3, closedcurve, i)

Dim closcrv: closcrv = Rhino.AddCurve (array(newpoint, newpoint2, newpoint3, newpoint))
closedcurve(i) = closcrv ‘here we charge the array

End Function

Function EvaluateSurface(arrSurface, strSurface)

‘here we declare the elements necessary to analyse the surface.
Dim uDomain, vDomain, uParam, vParam, arrPoint
Dim uDomain2, vDomain2, uParam2, vParam2, arrPoint2
Dim i, j, divisionsu, divisionsv

divisionsu = 8
divisionsv = 5

ReDim colection(divisionsu, divisionsv)
ReDim colection2(divisionsu, divisionsv)

For i = 0 To divisionsu
For j = 0 To divisionsv

uDomain = Rhino.SurfaceDomain(arrSurface(0),0)
vDomain = Rhino.SurfaceDomain(arrSurface(0),1)

uDomain2 = Rhino.SurfaceDomain(strSurface,0)
vDomain2 = Rhino.SurfaceDomain(strSurface,1)

‘here we calculate the points on the surface
uParam = uDomain(0) + i *((uDomain(1) - uDomain(0)) / divisionsu)
vParam = vDomain(0) + j *((vDomain(1) - vDomain(0)) / divisionsv)

uParam2 = uDomain2(0) + i *((uDomain2(1) - uDomain2(0)) / divisionsu)
vParam2 = vDomain2(0) + j *((vDomain2(1) - vDomain2(0)) / divisionsv)

arrPoint = Rhino.EvaluateSurface(arrSurface(0), Array(uParam, vParam))
Rhino.AddPoint arrPoint
colection(i, j) = arrPoint

arrPoint2 = Rhino.EvaluateSurface(strSurface, Array(uParam2, vParam2))
Rhino.AddPoint arrPoint2
colection2(i, j) = arrPoint2

Next
Next

’since here we don`t need anymore our surfaces, we can continue working
‘only over the points
Call Rhino.DeleteObjects(Array(arrSurface(0), strSurface))

Dim apt1, apt2, apt3, apt4, spt1, spt2, spt3, spt4

‘here we determine the positon of the points, to create the structure
apt1 = colection(1, 1) : apt2 = colection(1, 2)
apt3 = colection(2, 2) : apt4 = colection(2, 1)

spt1 = colection2(1, 1) : spt2 = colection2(1, 2)
spt3 = colection2(2, 2) : spt4 = colection2(2, 1)

For i = 0 To (divisionsu - 1)
For j = 0 To (divisionsv - 1)

‘here we determine the points so later we can do whatever we want
‘with them
apt1 = colection(i, j) : apt2 = colection(i, j + 1)
apt3 = colection(i + 1, j + 1) : apt4 = colection(i + 1, j)

spt1 = colection2(i, j) : spt2 = colection2(i, j + 1)
spt3 = colection2(i + 1, j + 1) : spt4 = colection2(i + 1, j)

‘here we build the skin, with an algorithm using the points
Dim myCurve: myCurve = Rhino.AddCurve(Array(apt2, spt3, spt4, apt1))
Dim myCurve2: myCurve2 = Rhino.AddCurve(Array(apt4, spt3, apt2, spt1))

‘here we loft the curves created by the algorythm, to create the surfaces
Call Rhino.AddLoftSrf(Array(MyCurve, MyCurve2))

Next
End Function








Changing the algorithm:





Project by: Maria Papaloizou_Peerapong Suntinanond
Tutors: Carlos de la Barrera_Luis Fraguada

No comments: