Sunday, February 10, 2008

PCA PB22 | Morphogenetic Strategies













During last months I was contacted as morphogenetic consultant by PCA-Architecture for the skyscrapers project PB22, at the Defense in Paris. The project will be officially presented at the end of February, and I wish to publish some sample studies I did for this project. The idea was to use the environmental site-specific analysis as a vectors field able to determine an optimal morphology according to reduce the wind pressure over the towers bodies and to have an optimal solar exposure for energy absorption and use. At the end of the morphogenetic process I was asked to build the stereolithography model.

Edmondo Occhipinti

On Archistorm #29







Archistorm #29 [January-February 2008] published one of my recent essays, appeared on this blog, last year. I would like to thank Paul Ereth for the interest on my work. After ten months this blog appears still very small due to my day by day work that makes really hard to produce and post regularly. I really appreciate the interest of my twenty-five readers, and I also would like to thank Andrea Graziano [digitag] for his moral support since the beginning.

Edmondo Occhipinti

Sunday, November 25, 2007

Laser-Cutter Model



Some weeks ago an architectural firm from paris asked me to build a conceptual model for
An interactive façade. I had a very simple idea (I had no time too!). so this is the result. I rationalized the manufacturing process in rhinoscript. I create a simple automated process able to create the solid model (for presentation, just like in this image) from an input nurbs surface, and also able to extract every section of the model for laser-cutter manufacturing. A very simple stuff, but useful.

Thursday, October 11, 2007


In mathematics exists a lot of affirmations which nobody has ever been able to demonstrate, as the one of most notorious linear Diophantine equation a^n + b^n = c^n has no solutions in non-zero integers for n > 2 (last Fermat’s theorem). In nineteen-thirty-one Alan Turing was twenty y.o. and just three years before the world had knew the deductible trueness system by the aka Hilbert’s program (is mathematics complete, consistent and decidable?). In that time Turing was in Cambridge studying mathematics, and trying to dematerialize the mathematics’ decidability (Kurt Gödel had just demonstrate one of the most famous theorem about the incompleteness of mathematics, discrediting the first point of Hilbert’s program). Woking on decidability -on the hilbertian question given an axiomatic system and an arbitrary proposition, does exist a procedure that allows to determinate if that proposition is true or false, inside the system?- Turing arises to formulate a different related question –does exist a mechanical procedure to make that?- that evidently call for the more general question –what is a mechanical procedure, that is what is a machine?
A machine is a man-made object with a finite number of configurations, that for everyone of those configurations has completely determined comportments, and is also an object that manipulate symbols. Thus Turing thought was no useful to build specialized machines, able to play check, to translate from Italian and to solve differential equations; his idea was to define the different rules tabula for everyone of these activities, to introduce, then, in an universal machine which, having appropriate codes, would be able to simulate every specialized machine (in that time such concepts like hardware and software simply didn’t exist!). But in that time, nineteen-thirty-four, this idea was so innovative that nobody was able to understand it. The Turing Machine expression will be familiar just later, but today this is the name of that platonic idea, that kantian noumenos of “machinity”. Being celebrated in the small room of the formal logic, Turing moved to Princeton, where he stayed for two years; after that he refused the proposal to assist the teaching of John von Neumann, and come back to Cambridge, where Wittgenstein were lecturing. In that time, nineteen-thirty-seven, he saw the Disney animated feature “Snow White and the Seven Dwarfs”; some of his friends tale that Turing singed, over the months, the witch’s melody while she putted the poison in the apple. Then, the war arose, and nobody had news of Turing’s life.
What really happened at that time, is quite interesting to tale. The Britannic secret services were working to try to penetrate the strategic messages’ coding system, based on Enigma, an infernal machine, able to code and decode messages, using a recto-verso rotors system. The Reich guessed Enigma, absolutely inviolable and used that machine among the entire war. Alain Turing was recruited by the Government Code and Cyber School, dependent by Foreign Office (!), as a decoder. This was his best occupation as long as this was his best enjoyment: thus was under his direction that GC&CS was able to build the anti-Enigma machine, best known as
Bomb. In April nineteen-forty Bomb, perfectly working, was installed in a cantina with all the listening-systems of Britannic intelligence; everything intercepted by radio repeaters in all the world, arose Bomb, able to identify and decode, among hundred thousands of messages, those ones which had a war meaningful interest.
We’ll never know if Turing understood the importance of his work, this is, if he was able to understand what responsibility he had, but the Bomb become, in few months, the Major State oracle, and Turing, as a medium able to make Bomb communicate, the head of Britannic war machine. From nineteen-forty-three the man who, exploring the logic problems, had dematerialized Enigma, starts lo loose his importance and begins to study a code system of human voice, named Dalila. The start point was a registration of Churchill discourses, progressively coded in no understandable sounds, and sequentially decoded. Few people knew that the Normandy invasion, the victory of allied and that strange man, that played the role of pythagoric Archimedes, were strictly linked. Perhaps Turing guessed that if he had told how he won the war, people had thought he was completely crazy. Thus, he won the war, but he lost his peace. Coming back to Cambridge and then to Manchester, as an academic researcher, he works to the project for an English computer, against the famous American one, the Electronic Numerical Integrator And Computer, aka
ENIAC. Thus Turing was interested by the implicated logic system: his dream was to build a machine able to execute every kind of application, and to build applications able to execute and simulate every known process; a machine, he said, is no more able to execute calculus than to play check or translate Italian, but his applications could be able to manipulate formal symbols in such a way that the machine will look as if she really does those activities. Exactly the same thing happens with the human brain. Thus, his idea to create a brain.
In the Forty’s nobody talked about informatics, but of cybernetics, so with the greatest names of Neumann, Wiener and Haldane, sometimes one should also find Turing’s name, as a precursor of the cyber, since his article in the thirty-four. In the fifty’ he publish an interesting article on “Mind”, regarding artificial intelligence, contributing to the eternal debating between materialists and spiritualists; he suggested an operational way to decide if a machine can think as the human do: is a machine able to make believe that she thinks like a human? (I suggest to talk few minutes with
A.L.I.C.E.). In Turing opinion nobody, human or machine, “really” thinks, “really” makes mathematics operations, “really” plays checks, “really” feels the sweetness of kisses: at the level of formal system, everybody, machine or human, manipulate symbols, and this manipulation, at other levels, can be named as one of those activities. Some weeks after this publication, considered as one of the most important in the A.I. field Turing was condemned by the law that prohibited the against-nature relationships. Definitively expulsed from the university, he started studying embryology and morphogenesis: his question was how living being know and execute their applications. He tested his models by computer, spending most of his time in his house and following extremely personal protocols.
In nineteen-fifty-four, the 8th of June the housekeeper discovered the body of Turing, on the bad, in his little house of Manchester. He had put poison in his apple. We could resume the salient points of his life, saying he was an important mathematic and pioneer of artificial intelligence, an eccentric actor of the espionage history, during the second world war, and finally an homosexual martyr. Thank to Andrew Hodges, mathematic and gay, who published in the nineteen-eighty-four an amazing biography of Turing, but also thanks to Sara Turing, Alan’s mother, who wrote the first not-so-exciting biography of her son, and finally thanks to Emmanuel Carrère, for his Alain Turing portrait, published in nineteen-ninety-five on Revue de Littérature Générale.
Edmondo Occhipinti

Friday, June 15, 2007

triangulation networks


Editing previous density points script this is an interesting application of that logic. this script creates a network between three d points, defining an interior volume. adding spheres to every point we can also think to link spheres and obtain something similar to the 3d cristals structure of prevous post.
this script could be used as a diagrammatic tool for networking programatic or functional informations as well as a volumetric tool based on some external information-based points.
to be developped.

edmondo occhipinti

Option Explicit
'This Script Generate network pipes based on Points set and their Relative Distances

'Structural optimization based on reticular triangulation network

'Code by Edmondo Occhipinti Architect [codesign.lab] 2007


MsgBox "Code by Edmondo Occhipinti Architect
edmondo@co-design-lab.net"

Sub network

Dim arrpts, strline, strcmd, piperadius

Dim dbdist, dbtotdist

Dim i, u


arrpts = Rhino.GetPointCoordinates ("Select Points to Create Skeleton Pattern")

If IsNull (arrpts) Then

Exit Sub

End If

For i = 0 To UBound (arrpts)

dbtotdist = 1000000
For u = 0 To UBound (arrpts)

strline = Rhino.AddLine (arrpts(i), arrpts(u))

dbdist = Rhino.Distance (arrpts(i), arrpts(u))

piperadius = 1

strCmd = "! _Pipe _SelID " & strline & " " & pipeRadius & " _Enter _Enter"

Rhino.Command strCmd
If u = UBound (arrpts) And dbdist = 0 Then

Exit Sub

End If

If dbdist = 0 Then

u = u+1

dbdist = Rhino.Distance (arrpts(i), arrpts(u))

End If If

dbdist

dbtotdist = dbdist

End If

Next

Dim arrPlane, crv, text

text = Rhino.AddText (dbtotdist, arrpts(i), dbtotdist/5)

arrPlane = Rhino.PlaneFromFrame (arrpts (i), Array(1.0,0.0,0.0), Array(0.0,1.0,0.0))

crv = Rhino.AddCircle (arrPlane, dbtotdist/2)

Rhino.AddSphere arrpts(i), dbtotdist/2

Next

End Sub

network

Wednesday, June 6, 2007

RhinoScript Workshop. Student Training ESA 2

And here a second script developed by Taichi Sunayama. Taichi’s idea was to create a structured script able to attempt to different project phases. His quite long script works for sections and interact with users preferences. The aim was to create a script which calculates the site specific pollution levels and translates it into a faded point cloud. By doing this he is able to create a growing structure (voronoi based) able to proportionate cells’ dimension to pollution levels. He inserts specific values of sound and air pollution into the script. The user can choose some sample parameters of a specific site (such as routes, number of vehicles, heights, dimensions, etc.) and the script will print some prompt-based data. The script will use these values to build the final site-specific structure. Here I’m pleased to post the 42th version of his script… to be continued and updated.

edmondo occhipinti



Option Explicit

'workshop growing structuresgenerative scripts
'Script supervisor edmondo occhipinti architect COdesignLab
'Script written by taichi sunayama ecole speciale d'architecture
'Script version lundi 12 mai 2007 18:32:03

Call HighRise()

Sub HighRise()

Dim strHead1 : strHead1 = "PollutionCloud"
Dim strHead2 : strHead2 = "PollutionCloud > Intention de forme"
Dim strHead3 : strHead3 = "Localisation"
Dim strHead4 : strHead4 = "Intention de form"
Dim strHead5 : strHead5 = "Creation de module"
Dim strHead6 : strHead6 = "Intention de form > Creation de module"
Dim strHead7 : strHead7 = "Identification des modules"
Dim strHead8 : strHead8 = "extract surfaces"
Dim arrRoute , strRoute
arrRoute = array(strHead1 , strHead2 , strHead3 , strHead4 , strHead5 , _
strHead6 , strHead7)
strRoute = rhino.ListBox(arrRoute , "selection de Route")
Select Case strRoute
Case strHead1
Call Route1()
Case strHead2
Call Route2()
Case strHead3
Call Route3()
Case strHead4
Call Route4()
Case strHead5
Call Route5()
Case strHead6
Call Route6()
Case strHead7
Call Route7()
Case Else Exit Sub
End Select
End Sub

Sub Route1()
'********************************************************************
'--------------------------------------------------------------------
Dim strPtCloud : strPtCloud = InputPollution()
'--------------------------------------------------------------------
End Sub '"PollutionCloud"

Sub Route2()
'********************************************************************* INPUT **************
'--------------------------------------------------------------------------- CONDITION ----
Dim strPtCloud : strPtCloud = InputPollution()
'--------------------------------------------------------------------------- INTENTION ----
Dim strSite : strSite = rhino.GetObject("selection de site" , 4) '
Dim dblHigh : dblHigh = rhino.RealBox("hauteur de gabarit" , 50)
'-------------------------------------------------------------------
Dim arrEnv : arrEnv = FormGenerator(strPtCloud , dblHigh , strSite)
'-------------------------------------------------------------------
End Sub '"PollutionCloud > Intention de forme"

Sub route3()
Dim strPtCloud : strPtCloud = rhino.Getobject ("select Pointcloud" , 2)
Call Localisation(strPtCloud)
End Sub


Sub Route4()
'************************************************************************
'------------------------------------------------------------------------
Dim strPtCloud : strPtCloud = rhino.Getobject ("select Pointcloud" , 2)
'------------------------------------------------------------------------
Dim strSite : strSite = rhino.GetObject("selection de site" , 4) '
Dim dblHigh : dblHigh = rhino.RealBox("hauteur de gabarit" , 50)
'------------------------------------------------------------------------
Dim arrEnv : arrEnv = FormGenerator(strPtCloud , dblHigh , strSite)
Dim strVlEnv : strVlEnv = arrEnv(0)
Dim strPtEnv : strPtEnv = arrEnv(1)


End Sub '"Intention de forme"

Sub Route5()
Dim strPtEnv : strPtEnv = rhino.Getobject ("select Pointcloud" , 2)
Call Rhino.MessageBeep (5)
Dim strVlEnv : strVlEnv = rhino.GetObject ("selection volume" , 16)
Call Rhino.MessageBeep (5)
'-----------------------------------------------------------------------
Dim arrBbox : arrBbox = rhino.BoundingBox(strPtEnv)
Dim dbldiagonale : dbldiagonale = Rhino.Distance(arrBbox(0), arrBbox(6))
'------------------------------------------------------------------------
Dim arrPtEnv : arrPtEnv = Rhino.PointCloudPoints(strPtEnv)
'------------------------------------------------------------------------
Dim arrType : arrType = array("aligneXY" , "aligneXYZ" , "normal")
Dim strType : strType = rhino.ListBox(arrType , "Type de cell" )
Dim arrPts
Select Case strType
Case "aligneXY"
arrPts = AlignXY(arrPtEnv)
Case "aligneXYZ"
arrPts = AlignXYZ(arrPtEnv)
Case "normal"
arrPts = arrPtEnv
Case Else Exit Sub
End Select
'------------------------------------------------------------------------
Dim arrCells : arrCells = VoronoiCell(arrPts , dbldiagonale , strVlEnv)
End Sub '"Creation de module"

Sub Route6()
'********************************************************************
'--------------------------------------------------------------------
Dim strPtCloud
strPtCloud = rhino.Getobject ("select Pointcloud" , 2)
'--------------------------------------------------------------------
Dim strSite , dblHigh
strSite = rhino.GetObject("selection de site" , 4)
dblHigh = rhino.RealBox("hauteur de gabarit" , 50)
'--------------------------------------------------------------------
Dim arrEnv : arrEnv = FormGenerator(strPtCloud , dblHigh , strSite)
Dim strVlEnv : strVlEnv = arrEnv(0)
Dim strPtEnv : strPtEnv = arrEnv(1)
'--------------------------------------------------------------------
Dim arrBbox , dbldiagonale
arrBbox = rhino.BoundingBox(strPtEnv)
dbldiagonale = Rhino.Distance(arrBbox(0), arrBbox(6))
'--------------------------------------------------------------------
Dim arrPtEnv : arrPtEnv = Rhino.PointCloudPoints(strPtEnv)
'--------------------------------------------------------------------
Dim arrType : arrType = array("aligneXY" , "aligneXYZ" , "normal")
Dim strType : strType = rhino.ListBox(arrType , "Type de cell" )
Dim arrPts
Select Case strType
Case "aligneXY"
arrPts = AlignXY(arrPtEnv)
Case "aligneXYZ"
arrPts = AlignXYZ(arrPtEnv)
Case "normal"
arrPts = arrPtEnv
Case Else Exit Sub
End Select
'--------------------------------------------------------------------
Dim arrCells
arrCells = VoronoiCell(arrPts , dbldiagonale , strVlEnv)
End Sub '"Intention de form > Creation de module"

Sub Route7()
Dim arrCells : arrCells = rhino.GetObjects("selection de module" , 16)
Dim arrPM : arrPM = Identity(arrCells)





End Sub '"Identification des modules"

Sub Route8()
Dim arrCells : arrCells = rhino.GetObjects("selection de module" , 16)
Dim arrIE : arrIE = Extractor(arrCells)

Call rhino.DeleteObjects(arrIE(0))
End Sub 'extract surfaces

'========================================================================
Function InputPollution()
Dim arrRoads()
Dim arrNCar()
Dim arrList2()
Dim arrRoad
Dim nCar
'------------------------------------------------------------------------------------------
Dim i : i = 0
Do
Dim arrEntry1 : arrEntry1 = array ("ok" , "fin" )
Dim strList1 : strList1 = rhino.ListBox(arrEntry1 , "selectionne de la rue")
If strList1 = "ok" Then
arrRoad = rhino.GetObject("selectionne de la rue" , 4)
If isnull(arrRoad) Then Exit Function
End If
If strList1 = "fin" Then Exit Do
'--------------------------------------------------------------------------------------
Dim arrTextPt : arrTextPt = rhino.DivideCurve(arrRoad , 4)
Dim strText : strText = rhino.AddText ("<" & i + 1 & ">" , arrTextPt(1) , 2)
'-------------------------------------------------------------------------------------
Call rhino.UnselectAllObjects
Call rhino.SelectObject (arrRoad)
Call rhino.SelectObject (strText)
'---------------------------------------------------------------------------------------
Dim arrEntry2 : arrEntry2 = array("3000 ~ 6000" , "1500 ~ 3000" , "1000 ~ 1500" , "500 ~ 1000" , "250 ~ 500" , "0 ~ 250")
Dim strList2 : strList2 = Rhino.ListBox(arrEntry2 , "Input nombre de voiture sur la rue < " & i + 1 & " > (/heure) ")
Select Case strList2
Case "3000 ~ 6000"
nCar = 6000
Case "1500 ~ 3000"
nCar = 3000
Case "1000 ~ 1500"
nCar = 1500
Case "500 ~ 1000"
nCar = 1000
Case "250 ~ 500"
nCar = 500
Case "0 ~ 250"
nCar = 250
Case Else Exit Function
End Select
'-------------------------------------------------------------
ReDim Preserve arrNCar(i)
arrNCar(i) = nCar
'--------------------------------------------------------------
ReDim Preserve arrRoads(i)
arrRoads(i) = arrRoad
'----------------------------------------------------------
ReDim Preserve arrList2(i)
arrList2(i) = strList2
'------------------------------------------------------------
i = i + 1
Loop
'------------------------------------------------------------------------------------------
'DIFINITION DE PORTEE D'EFFET
Dim dblRange : dblRange = rhino.IntegerBox ("largeur de agencement" , 50 )
If isnull(dblRange) Then Exit Function
'------------------------------------------------------------------------------------------
'INTENSITE DE DEVELLOPEMENT
Dim arrEntrys3: arrEntrys3 = array ("fort" , "moyen" , "faible")
Dim strList3 : strList3 = Rhino.ListBox(arrEntrys3, "Intensite de devellopement")
Dim dblSquare , intRaise
Select Case strList3
Case "fort"
dblSquare = sqr(dblRange)
intRaise = 2
Case "moyen"
dblSquare =sqr(sqr(dblRange))
intRaise = 4
Case "faible"
dblSquare =sqr(sqr(sqr(dblRange)))
intRaise = 8
Case Else Exit Function
End Select
'------------------------------------------------------------------------------------------
Dim arrBbox : arrBbox = rhino.BoundingBox(arrRoads)
Dim arrListPt
For i = 0 To UBound(arrRoads)
arrListPt = array(arrBbox(2)(0) , arrBbox(2)(1) - (i * 16) , 0)
Dim txtN , txtCond , txtNCar , txtVar , txtLA , txtID
txtN = rhino.AddText("<" & i+1 & ">" , arrListPt , 1)
Call rhino.ObjectName(txtN , "text")
txtCond = rhino.AddText("-- condition de la rue --", array(arrListPt(0),arrListPt(1)-2,0) , 1)
Call rhino.ObjectName(txtCond , "text")
txtNCar = rhino.AddText ("nombre de voiture : " & arrList2(i) & " / heure" , array(arrListPt(0),arrListPt(1)-4,0) , 1)
Call rhino.ObjectName(txtNCar , "text")
txtVar = rhino.AddText ("-- variable de generation des points --", array(arrListPt(0),arrListPt(1)-8,0) , 1)
Call rhino.ObjectName(txtVar , "text")
txtLA = rhino.AddText ("largeur de agencement : " & dblRange & "m" , array(arrListPt(0),arrListPt(1)-10,0) ,1)
Call rhino.ObjectName(txtLA , "text")
txtID = rhino.AddText ("Intensite de devellopement : " & strList3 ,array(arrListPt(0),arrListPt(1)-12,0) , 1)
Call rhino.ObjectName(txtID , "text")
Next
'----------------------------------------------------------------------------------------------------
Dim arrPts : arrPts = PollutionCloud(arrRoads , dblRange , dblSquare , intRaise ,arrNCar , arrBbox)
'----------------------------------------------------------------------------------------------------
Dim strPts : strPts = rhino.AddPointCloud(arrPts)
InputPollution = strPts
End Function

Function PollutionCloud(arrRoads , dblRange , dblSquare , intRaise ,_
arrNCar , arrBbox)

Dim arrPtsJ()
Dim i , j , N
'------------------------------------------------------------------------
N = 0
For i = 0 To UBound(arrRoads)
'NOx mg/h sur une rue
Dim dblLengthRoad : dblLengthRoad =rhino.CurveLength(arrRoads(i))
Dim dblGas
dblGas = 80*(dblLengthRoad/1000)*(arrNCar(i))
'*echapement de gaz(NOx):80mg/km
dblGas = (int(dblGas*100))/100
'--------------------------------------------------------------------
'AGENCEMENT DE POINTS
Dim arrPtStart : arrPtStart = rhino.CurveStartPoint (arrRoads(i))
Dim arrPtEnd : arrPtEnd = rhino.CurveEndPoint (arrRoads(i))
Dim vecS2E : vecS2E = rhino.VectorCreate(arrPtStart , arrPtEnd)
Dim dblLength : dblLength = rhino.VectorLength (vecS2E)
Dim vecNormal : vecNormal = Rhino.CurveNormal(arrRoads(i))

'----------------------------------------------------------------
Dim dblVolume : dblVolume = 3.14*dblRange*dblRange*dblLength
' NOMBREDE DE POINT
Dim nPoints : nPoints = int(((dblGas*dblVolume)/10^10)) ' int((dblGas*dblVolume)/10^6)30m 'indice ??????? > photocatalyse
Call rhino.Print ( "npoints :" & nPoints)
'----------------------------------------------------------------
'CALCUL DE DENSITE DE POINT
Dim dblDensity : dblDensity = nPoints/(dblVolume/1000^3) '!!
dblDensity = int(dblDensity)
'----------------------------------------------------------------
For j = 0 To nPoints
Dim dblRandom : dblRandom = rnd*nPoints
Dim arrDomain : arrDomain = Rhino.CurveDomain(arrRoads(i))
Dim dblParam : dblParam = ( ( arrDomain(1)-arrDomain(0) ) / ( nPoints ) ) * ( dblRandom )
Dim arrPt : arrPt = Rhino.EvaluateCurve(arrRoads(i), dblParam)
Dim dblRandamEx : dblRandamEx = (rnd*dblSquare)^intRaise
Dim vecDir
vecDir = rhino.VectorRotate (vecS2E , 90 , vecNormal)
vecDir = rhino.VectorRotate (vecDir , rnd*180 , vecS2E)
If vecDir(2) < 0 Then
vecDir = rhino.VectorReverse(vecDir)
End If
vecDir = rhino.VectorDivide ( vecDir , dblLength/dblRandamEx )
Dim arrPtEx : arrPtEx = rhino.PointAdd (arrPt , vecDir)
'------------------------------------------------------------
ReDim Preserve arrPtsJ(N)
arrPtsJ(N) = arrPtEx
N = N + 1
'------------------------------------------------------------
Next
'----------------------------------------------------------------
Dim arrListPt : arrListPt = array(arrBbox(2)(0) , arrBbox(2)(1) - (i * 16) , 0)
Dim txtNOx , txtDMP
txtNOx = rhino.AddText ("NOx : " & dblGas & " mg / heure" , _
array(arrListPt(0),arrListPt(1)-6,0) , 1)
Call rhino.ObjectName(txtNOx, "text")
txtDMP = rhino.AddText ("densite moyenne de point : " & _
dblDensity & "/ km3" , array(arrListPt(0),arrListPt(1)-14,0) , 1)
Call rhino.ObjectName(txtDMP , "text")
'----------------------------------------------------------------
Next
'--------------------------------------------------------------------
PollutionCloud = arrPtsJ
End Function

'========================================================================

Function Localisation(PtCloud)
Dim arrPts : arrPts = rhino.PointCloudPoints(PtCloud)
Dim arrPoint
Dim arrPoints()
Dim i , j
For i = 0 To UBound(arrPts)
Dim intRnd : intRnd = int(rnd*100)
If intRnd = 0 Then
arrPoint = rhino.AddPoint(arrPts(i))
ReDim Preserve arrPoints(j)
arrPoints(j) = arrPoint
j = j + 1
End If
Next
call rhino.Print(UBound(arrPoints))
Call Rhino.SelectObjects (arrPoints)
End Function

'====================================================================

Function FormGenerator(PtCloud , High , Base)
Dim arrType : arrType = array ("Normal" , "Varie" , "Varie Coubure")
Dim strType : strType = rhino.ListBox(arrType , "selection de type de generation de la form")
'=====================================================================================
Dim strGab : strGab = Gabarit(High , Base)
'---------------------------------------------------------
Dim Bbox : Bbox = rhino.BoundingBox(strGab)
Dim strText1, strText2 , strText3 , strText4
strText1 = rhino.AddText("Type de enveloppe : " & strType , array(Bbox(6)(0), Bbox(6)(1)-2,Bbox(6)(2)),1)
Call rhino.ObjectName(strText1 , "Text")
'----------------------------------------------------------------------------------
Dim strPtLimite : strPtLimite = PtLimitor(PtCloud , strGab)
Dim arrPtSite : arrPtSite = rhino.PointCloudPoints(strPtLimite)
'======================================================================================
Dim strForm
Dim strPtEnv
Dim strHigh
Select Case strType
'----------------------------------------------------------------------------------
Case "Normal"
strForm = strGab
strPtEnv = strPtLimite
'----------------------------------------------------------------------------------
Call rhino.UnselectAllObjects
'----------------------------------------------------------------------------------
Case Else
Dim nDiv : nDiv = rhino.IntegerBox("creer la variation - division par : " , 3)
'=====================================================================================
strText2 = rhino.AddText("division des points : " & nDiv , array(Bbox(6)(0), Bbox(6)(1)-4,Bbox(6)(2)),1)
Call rhino.ObjectName(strText2 , "Text")
'=====================================================================================
Call rhino.DeleteObject(strGab)
'-------------------------------------------------------------------------------------
Dim arrGet
Dim arrPoints()
Dim i , j
For i = 0 To UBound(arrPtsite)
ReDim Preserve arrPoints(i)
arrPoints(i) = rhino.AddPoint(arrPtsite(i))
strHigh = (int((arrPtsite(i)(2))*100))/100
Call rhino.ObjectName(arrPoints(i) , strHigh)
Call rhino.Print (strHigh)
Next
'------------------------------------------------------------------------------------
Dim arrPt()
Dim arrPtCord()
i = 0 : j = 0
Do
If i >= High Then Exit Do
arrGet = rhino.ObjectsByName(i)
If isArray(arrGet) Then
ReDim Preserve arrPt(j)
arrPt(j) = arrGet(0)
j = j + 1
End If
i = i + 0.01
Loop
'------------------------------------------------------------------------------------
For i = 0 To UBound (arrPt)
ReDim Preserve arrPtCord(i)
arrPtCord(i) = Rhino.PointCoordinates(arrPt(i))
Next
'------------------------------------------------------------------------------------
Dim nPts : nPts = UBound(arrPtCord) + 1
Dim nPtEns : nPtEns = (nPts/nDiv) -1
'------------------------------------------------------------------------------------
strText3 = rhino.AddText("Nombre des points chanque division : " & int(nPtEns + 1) , array(Bbox(6)(0), Bbox(6)(1)-6,Bbox(6)(2)),1)

Call rhino.ObjectName(strText3 , "Text")
'------------------------------------------------------------------------------------
Dim arrPtGroup()
Dim arrGroup()
Dim N : N = 0
For i = 0 To (nDiv - 1)
j = 0
Do
If j > nPtEns Then Exit Do
If N >= nPts Then Exit Do
ReDim Preserve arrPtGroup(j)
arrPtGroup(j) = arrPtCord(N)
N = N + 1
j = j +1
Loop
ReDim Preserve arrGroup(i)
arrGroup(i) = arrPtGroup
Next
'-----------------------------------------------------------------------------------
Dim arrPtLevel
Dim strPtLv
Dim arrPtLv
For i = 0 To UBound(arrGroup)
strPtLv = "PtLv" & i
For j = 0 To UBound(arrGroup(i))
arrPtLevel = array(arrGroup(i)(j)(0) , arrGroup(i)(j)(1) , arrGroup(i)(UBound(arrGroup(i)))(2))
arrPtLevel = rhino.AddPoint(arrPtLevel)
Call rhino.ObjectName(arrPtLevel , strPtLv)
Next
Call rhino.UnselectAllObjects
arrPtLv = rhino.ObjectsByName(strPtLv , True)
Call rhino.Command ("!_Delaunay" & " " & " " & "_enter _enter" & "_shader" & " " & "_none" & " " & "_enter")
Call rhino.DeleteObjects(arrPtLv)
Next
'-----------------------------------------------------------------------------------
Dim arrMesh : arrMesh = rhino.ObjectsByType(32 , True)
For Each i In arrMesh
Call rhino.ObjectName(i, "Delaunay")
Next
'-----------------------------------------------------------------------------------
' Dim dblAreaBase : dblAreaBase = rhino.CurveArea (Base)
'-----------------------------------------------------------------------------------
Dim arrOLine
Dim arrOLines()
Dim strOline
Call rhino.Command ("!_CPlane" & " " & "_World" & " " & "_Bottom")
For i = 0 To UBound(arrMesh)
Call rhino.UnselectAllObjects
Call rhino.Command ("!_bottom")
Call rhino.SelectObject(arrMesh(i))
Call rhino.Command("!_Meshoutline" & " " & "_enter")
arrOLine = rhino.ObjectsByName("",True)
strOline = arrOLine(0)
Call rhino.ObjectName(strOline,"Outline")
Call rhino.MoveObject(strOline , array(0,0,0) , array(0,0,arrGroup(UBound(arrGroup)-i)(UBound(arrGroup(i)))(2)))
Call rhino.command("!_Perspective")
'-----------------------------------------------------------------------------------
If strType = "Varie Coubure" Then
Dim arrVertice : arrVertice = rhino.PolylineVertices(strOline)
strOline = Rhino.AddInterpCurveEx (arrVertice , 3 , 1 )
End If
'-----------------------------------------------------------------------------------
ReDim Preserve arrOLines(i)
arrOLines(i)= strOline
Next
Call rhino.Command ("!_CPlane" & " " & "_World" & " " & "_Top")
'----------------------------------------------------------------------------------
Call rhino.UnselectAllObjects
Call rhino.DeleteObjects(arrPoints)
'----------------------------------------------------------------------------------
Dim strSite : strSite = rhino.CopyObject(Base)
Dim arrLoft()
For i = 0 To UBound(arrOlines) + 1
If i <> UBound(arrOlines) + 1 Then
ReDim Preserve arrLoft(i)
arrLoft(i) = arrOlines(i)
End If
If i = UBound(arrOlines) + 1 Then
ReDim Preserve arrLoft(i)
arrLoft(i) = strSite
End If
Next
Dim arrForm
arrForm = Rhino.AddLoftSrf (arrLoft , , , 2 , 0 , , False)
Call rhino.ObjectName(arrForm , "Enveloppe")
Dim arrCap : arrCap = rhino.ObjectsByName("Enveloppe")
Call rhino.CapPlanarHoles(arrCap(0))
strForm = arrCap(0)
'----------------------------------------------------------------------------------
strPtEnv = PtLimitor(strPtLimite , strForm)
'----------------------------------------------------------------------------------
Call rhino.DeleteObjects(arrMesh)
Call rhino.DeleteObjects(arrLoft)
'----------------------------------------------------------------------------------
End Select
'----------------------------------------------------------------------------------
Dim nPtEnv : nPtEnv = rhino.PointCloudCount(strPtEnv)
strText4 = rhino.AddText("nombre de point dans volume : " & nPtEnv , Bbox(6),1)
Call rhino.ObjectName(strText4 , "Text")
'----------------------------------------------------------------------------------
FormGenerator = array(strForm , strPtEnv)
End Function

Function Gabarit(dblHigh , strSite)
Dim arrLimite
arrLimite = array(strSite)
arrLimite = rhino.AddPlanarSrf(arrLimite)
Dim strHigh : strHigh = rhino.AddLine(array(0,0,0) , array(0,0,dblHigh))
Dim strLimite
strLimite = rhino.ExtrudeSurface(arrLimite(0) , strHigh , True)
'-----------------------------------------------------------------------------
Call rhino.DeleteObjects(arrLimite)
Call rhino.DeleteObject(strHigh)
Call rhino.UnselectAllObjects
'-----------------------------------------------------------------------------
Gabarit = strLimite
End Function

Function PtLimitor(PtCloud ,Limite)
Dim Points : Points = rhino.PointCloudPoints(PtCloud)
Dim arrPtsIn()
Dim arrPtsOut()
Dim i , j , N
j = 0
N = 0
For i = 0 To UBound(Points)
If rhino.IsPointInSurface(Limite , Points(i)) Then
ReDim Preserve arrPtsIn(j)
arrPtsIn(j) = Points(i)
j = j + 1
Else
ReDim Preserve arrPtsOut(N)
arrPtsOut(N) = Points(i)
N = N +1
End If
Next
'---------------------------------------------------------------------------
If isArray(arrPtsIn) Then
Dim strPtsIn : strPtsIn = Rhino.AddPointCloud (arrPtsIn)
Call rhino.ObjectColor(strPtsIn , RGB(139,121,94))
Call rhino.ObjectName(strPtsIn , "PtsIn")
End If
If isArray(arrPtsOut) Then
Dim strPtsOut : strPtsOut = Rhino.AddPointCloud (arrPtsOut)
Call rhino.ObjectColor(strPtsOut , RGB(230,230,230))
Call rhino.ObjectName(strPtsOut , "PtsOut")
End If
'---------------------------------------------------------------------------
Call rhino.DeleteObject(PtCloud)
'---------------------------------------------------------------------------
PtLimitor = strPtsIn
End Function

'====================================================================


Function VoronoiCell(Points , Length , Evlp)

Dim arrCells
Dim arrSrfs()
Dim i, j ,N
'-------------------------------------------------------------------
For i = 0 To UBound(Points)
'------------------------------------------------------------------------
N = 0
For j = 0 To UBound(Points)
If j <> i Then
Dim vecDir : vecDir = rhino.VectorCreate (Points(j) , Points(i))
Dim vecMid : vecMid = rhino.VectorDivide (vecDir , 2)
Dim arrMidPt : arrMidPt = rhino.PointAdd(Points(i) , vecMid)
Dim arrPlane : arrPlane = rhino.PlaneFromNormal (arrMidPt, vecDir)
Dim strSrf : strSrf = Rhino.AddPlaneSurface (arrPlane, 2*Length, 2*Length)
Dim arrCenter : arrCenter = Rhino.SurfaceAreaCentroid (strSrf)
Call rhino.MoveObject(strSrf , arrCenter(0) , arrMidPt)
ReDim Preserve arrSrfs(N)
arrSrfs(N) = strSrf
N = N + 1
' Call Rhino.HideObject (strSrf)
'--------------------------------------------------------------
End If
Next
'-----------------------------------------------------------------------------------
' Call Rhino.ShowObjects (arrSrfs)
Dim strEvlp : strEvlp = rhino.CopyObject(Evlp)
Dim strCell : strCell = strEvlp
Dim arrInput1 : arrInput1 = array(strCell)
For j = 0 To Ubound(arrSrfs)

Dim arrInput2 : arrInput2 = array(arrSrfs(j))

Dim arrCell : arrCell = Rhino.BooleanIntersection (arrInput1, arrInput2)

If isArray(arrCell) Then
arrInput1 = arrCell
Else
Call rhino.DeleteObject(arrSrfs(j))
End If

Next
'----------------------------------------------------------------------------
Next
'---------------------------------------------------------------------------
Call rhino.DeleteObject(Evlp)
VoronoiCell = rhino.ObjectsByName("Cell")
End Function

Function AlignXY(Points)
Dim arrPts()
Dim arrNear , dblNear
'-------------------------------------------------------------------------
Dim i ,j
For i = 0 To UBound(Points)
dblNear = 10000
'-----------------------------------------------------------------------
For j = 0 To UBound(Points)
If i<>j Then
Dim arrPtXY1 : arrPtXY1 = array(Points(i)(0), Points(i)(1),0)
Dim arrPtXY2 : arrPtXY2 = array(Points(j)(0), Points(j)(1),0)
Dim dblDis : dblDis = Rhino.Distance(arrPtXY1 , arrPtXY2)
If dblDis < dblNear Then
dblNear = dblDis
arrNear = Points(j)
End If
End If
Next
'-------------------------------------------------------------------------
If i<>j Then
arrPtXY2 = array(arrNear(0), arrNear(1),0)
Dim vecDir : vecDir = rhino.VectorCreate (arrPtXY2 , arrPtXY1)
Dim vecMid : vecMid = rhino.VectorDivide (vecDir , 2)
Dim arrMidPt : arrMidPt = rhino.PointAdd(arrPtXY1 , vecMid)
Dim arrMidPtZ : arrMidPtZ = array(arrMidPt(0) , arrMidPt(1) , Points(i)(2))
ReDim Preserve arrPts(i)
arrPts(i) = arrMidPtZ
End If
'-------------------------------------------------------------------------
Next
'-------------------------------------------------------------------------------
AlignXY = arrPts
End Function

Function AlignXYZ(Points)
Dim arrPts()
Dim arrNear , dblNear
'-------------------------------------------------------------------------
Dim i ,j
For i = 0 To UBound(Points)
dblNear = 10000
'-----------------------------------------------------------------------
For j = 0 To UBound(Points)
If i<>j Then
Dim dblDis : dblDis = Rhino.Distance(Points(i), Points(j))
If dblDis < dblNear Then
dblNear = dblDis
arrNear = Points(j)
End If
End If
Next
'-------------------------------------------------------------------------
If i<>j Then
Dim vecDir : vecDir = rhino.VectorCreate (arrNear , Points(i))
Dim vecMid : vecMid = rhino.VectorDivide (vecDir , 2)
Dim arrMidPt : arrMidPt = rhino.PointAdd(Points(i) , vecMid)
Dim arrMidPtZ : arrMidPtZ = array(arrMidPt(0) , arrMidPt(1) , Points(i)(2))
ReDim Preserve arrPts(i)
arrPts(i) = arrMidPtZ
'call rhino.AddLine(Points(i) , arrMidPtZ )
End If
'-------------------------------------------------------------------------
Next
'-------------------------------------------------------------------------------
'call rhino.AddPoints(arrPts)
AlignXYZ = arrPts
End Function

'====================================================================

Function Identity(Volumes)
Dim i
Dim arrM3
Dim arrM3s()
Dim dblTotal : dblTotal = 0
Dim nVolumes : nVolumes = UBound(Volumes)
For i = 0 To nVolumes
arrM3 = Rhino.SurfaceVolume(Volumes(i))
Call Rhino.Print ("polysurface volume : " & arrM3(0))
dblTotal = dblTotal + arrM3(0)
ReDim Preserve arrM3s(i)
arrM3s(i) = arrM3(0)
Next
Call Rhino.Print ("totale volume : " & dblTotal)
'-------------------------------------------------------------
Dim N : N = 0
Dim M : M = 0
Dim dblIndice :dblIndice = dblTotal/nVolumes '!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
Dim arrPlus()
Dim arrMinus()
For i = 0 To nVolumes
If arrM3s(i) > dblIndice Then
ReDim Preserve arrPlus(N)
arrPlus(N) = Volumes(i)
N = N + 1
End If
If arrM3s(i) <= dblIndice Then
ReDim Preserve arrMinus(M)
arrMinus(M) = Volumes(i)
M = M + 1
End If
Next
'------------------------------------------------------------------
Dim arrBbox : arrBbox = rhino.BoundingBox(Volumes)
Dim strText1 , strText2 , strText3
strText1 = rhino.AddText ("indice de classement volume : " & dblIndice , array(arrBbox(6)(0) ,arrBbox(6)(1) - 4 , arrBbox(6)(2)) , 1)
strText2 = rhino.AddText("cell + : " & UBound(arrPlus)+1 , array(arrBbox(6)(0) ,arrBbox(6)(1) - 6 , arrBbox(6)(2)) , 1)
strText3 = rhino.AddText("cell - : " & UBound(arrMinus)+1 , array(arrBbox(6)(0) ,arrBbox(6)(1) - 8 , arrBbox(6)(2)) , 1)
'------------------------------------------------------------------------
Call Structure(arrMinus)





End Function

Function Structure(Volumes)
Dim arrStrctr()
Dim i,j
'--------------------------------------------------------------------------------
For i = 0 To UBound(Volumes)
If Rhino.IsPolysurfaceClosed ( Volumes(i))Then
'---------------------------------------------------------------------------------------
Dim arrSrfs : arrSrfs = rhino.ExplodePolysurfaces( Volumes(i) , True )
'-------------------------------------------------------------------------------
For j = 0 To UBound(arrSrfs)
Dim arrCvs1 : arrCvs1 = rhino.DuplicateEdgeCurves(arrSrfs(j))
Dim arrPl1 : arrPl1 = rhino.JoinCurves(arrCvs1,True)
Dim arrCenter : arrCenter = Rhino.SurfaceAreaCentroid (arrSrfs(j))
Dim strSrfSc : strSrfSc = rhino.ScaleObject(arrSrfs(j) , arrCenter(0) ,array(0.9 , 0.9 , 0.9) , False)
Dim arrCvs2 : arrCvs2 = rhino.DuplicateEdgeCurves(strSrfSc)
Dim arrPl2 : arrPl2 = rhino.JoinCurves(arrCvs2,True)
Dim arrVts : arrVts = Rhino.PolylineVertices(arrPl2(0))
If isarray(arrVts) Then
Dim strHole : strHole= Rhino.AddCurve (arrVts , 3)
End If
Dim arrContours : arrContours = array(arrPl1(0) , strHole)
Dim strSurface : strSurface = Rhino.AddPlanarSrf (arrContours)
'-----------------------------------------------------------------------------------------
' ReDim Preserve arrStrctr(j)
' arrStrctr(j) = strSurface(0)
'------------------------------------------------------------------------
Call rhino.DeleteObject(strSrfSc)
Call rhino.DeleteObjects(arrPl1)
Call rhino.DeleteObjects(arrPl2)
Call rhino.DeleteObject(strHole)
'-------------------------------------------------------------------------------
Next
' Call rhino.JoinSurfaces(arrStrctr,True)
End If
Next
End Function

Function Extractor(Modules)
Dim arrInte()
Dim arrExte()
'----------------------------------------------------
Dim arrParois : arrParois = Rhino.ExplodePolysurfaces(Modules , True)
Dim arrCentre
'---------------------------------------------------
Dim blnONOFF
Dim i , j
Dim N , M
N = 0
M = 0
For i = 0 To UBound(arrParois)
If rhino.IsObject(arrParois(i)) Then
blnONOFF = False
For j = 0 To UBound(arrParois)
If rhino.IsObject(arrParois(j)) Then
If j<>i Then
arrCentre = Rhino.SurfaceAreaCentroid (arrParois(i))
If rhino.IsPointOnSurface(arrParois(j) , arrCentre(0)) Then
Call rhino.DeleteObject(arrParois(j))
ReDim Preserve arrInte(N)
arrInte(N) = arrParois(i)
blnONOFF = True
N = N + 1
Exit For
End If
End If
End If
Next
If blnONOFF = False Then
ReDim Preserve arrExte(M)
arrExte(M) = arrParois(i)
M = M + 1
End If
End If
Call rhino.Print (i)
Next
'---------------------------------------------------------------------------
Extractor = array(arrInte , arrExte)
End Function

Function SurfaceEvaluateDivide(Surface)


Dim i , j

Dim arrDomainU, arrDomainV
Dim arrParam(1)
Dim arrPt
Dim nDivideU: nDivideU = 6
Dim nDivideV: nDivideV = 10


ReDim Matrix(nDivideU, nDivideV)

arrDomainU = Rhino.SurfaceDomain(Surface, 0)
arrDomainV = Rhino.SurfaceDomain(Surface, 1)

For i=0 To nDivideU
For j=0 To nDivideV
arrParam(0)=((arrDomainU(1)-arrDomainU(0))/nDivideU)*(i)
arrParam(1)=((arrDomainV(1)-arrDomainV(0))/nDivideV)*(j)
arrPt = Rhino.EvaluateSurface(Surface,arrParam)
' Call Rhino.addpoint (arrPt)
Matrix(i,j) = arrPt
Next
Next
Dim Pt1, Pt2, Pt3, Pt4
For i=0 To nDivideU-1
For j=0 To nDivideV-1
Pt1 = Matrix(i,j)
Pt2 = Matrix(i+1,j)
Pt3 = Matrix(i+1,j+1)
Pt4 = Matrix(i,j+1)
Call Paneling(Pt1,Pt2,Pt3,Pt4)
Next
Next
End Function

Function Paneling(Pt1,Pt2,Pt3,Pt4)

Dim arrPts1 : arrPts1 = array(Pt1,Pt2,Pt3)
Dim panel1 : panel1 = Rhino.AddSrfPt (arrPts1)
Dim arrPts2 : arrPts2 = array(Pt1,Pt3,Pt4)
Dim panel2 : panel2 = Rhino.AddSrfPt (arrPts2)

End Function

Function XGrid(Pt1,Pt2,Pt3,Pt4)

Dim linonetwo, lintwothre, linthrefour, linfourone, linonethre, lintwofour

linonetwo = Rhino.AddLine (Pt1, Pt2)
lintwothre = Rhino.AddLine (Pt2, Pt3)
linthrefour = Rhino.AddLine (Pt3, Pt4)
linfourone = Rhino.AddLine (Pt4, Pt1)
linonethre = Rhino.AddLine (Pt1, Pt3)
lintwofour = Rhino.AddLine (Pt2, Pt4)

End Function

RhinoScript Workshop. Students Training ESA

I’m pleased to post one of the scripts developed during the Generative Script workshop at Ecole Special d'Architecture de Paris I superviewed d in middle April. This is a first draft of further developing scripts by Joaquim Silvestre. The aim of Joaquim was to generate a parametric ramp for vehicles, based on site, functional and structural constraints. Thus the idea was to develop a script able to grow into a vertical structure for car storage. This is one of the first training. I want acknowledge the students from Esa for their participation and their constant interest to go ahead in this first essay.

edmondo occhipinti

Option Explicit

'workshop growing structuresgenerative scripts
'Script supervisor edmondo occhipinti COdesignLab
'Script written by silvestre joak ecole speciale d'architecture
'Script version lundi 16 april 2007 13:54:22

Sub CDR


Dim X
Dim Y

Dim arrRect
Dim tempcuba
Dim tempoint(4)
'creation du rectangle limitatif
arrRect=Rhino.Getrectangle (2)
Dim surface
surface = Rhino.addsrfpt(arrrect)

tempoint(4)=Rhino.addpointCloud(arrRect)



Dim bala
bala= Array(1,1,1)
Dim aroo
aroo=Array(0,0,0)
Dim Xi,Yi
X= Rhino.vectorCreate(arrRect(0), arrRect(1))
Xi=(Rhino.vectorLength(X))
Y= Rhino.vectorCreate(arrRect(0), arrRect(3))
Yi=(Rhino.vectorLength(Y))
Dim balpha
balpha=Rhino.Angle (arrRect(0), arrRect(1))
'balpha=(Rhino.VectorDotProduct(Array(1,0,0),X))
Rhino.print (balpha(0))
'Rhino.print(Rhino.ToDegrees(balpha))
If IsNull (balpha) Then
Rhino.print"Pb avec variable balfa"
End If
Dim gloubi
gloubi=(Rhino.vectorAdd(x,y))
Dim boulga
boulga=(Rhino.vectordivide(gloubi,2))
Dim pluto
pluto=(Rhino.PointAdd (aroo,boulga))
If IsNull(pluto) Then
Rhino.print"Pb avec variable pluto"

End If
'Dim gepeto
'gepeto=Rhino.pointcoordinates (pluto)
'//////////////////////////////////////////////////
Dim no
no=70
Dim arrpoint,arrpointO
Dim radius
Dim strRamp
Dim strRampO
ReDim arrPoints(0)
ReDim arrPointsO(0)
Dim bi
Dim g
ReDim g(2)
radius=(Rhino.Distance(arrRect(0), arrRect(3)))/2
Dim a,az,baz
az=1
a=1



Dim n,deltah
n=0

Do
no=n+1
'new new new new


baz=n/4
'For bi= -5 To 10 Step 0.025
'g(0)=(bi * Sin(5*bi))
'g(1)=(bi * Cos(3*bi))
Dim XB,YB,ZB

Dim XU,YD,ZF
'XU=((radius)*Sin(n))
XB=baz*2
XU=(((radius)*Sin(n))*(Xi/(radius*2)))'+XB

'YD=((radius)*Cos(n))
YB=n+5
YD=(((radius)*Cos(n))*a*(Yi/(radius*2)))'+YB
ZB=n/2'*(((n*n)+5*n+4)/no)
ZF=ZF
arrPoint=Array(XU,YD,ZF)
If n>1 Then
Dim vector,ptprec

Call Rhino.Print("intheboucle"&n)
vector= Rhino.vectorcreate (ptprec,arrPoint)
deltah= Rhino.vectorlength (vector)/7
Call Rhino.Print("deltah"&deltah)

ZF=ZF+deltah
Call Rhino.Print("ZF"&ZF)
Else
ZF=0
End If
arrPoint=Array(XU,YD,ZF)

If Abs(XB)>Xi/2 Then


az=0.25
End If
If Abs(XB)>Xi Then


a=-a
End If
If n>no/4 Then


a=Sin(baz)
End If
If n>no/2 Then
baz=-n/4

a=Sin(baz)
End If
If Abs(YB)>Yi Then

a=-a
End If
'If XB<(-1*Xi) Then
' a=-a
' End If
arrPointO=Array(XB,YB,ZB)
'arrPoint=Array((radius/sqr(n+1) * Sin(5*n)), (radius/sqr(n+1) * Cos(3*n)),n/2)
Dim teemp
'teemp=(arrPoint
Call Rhino.Print("n"&n)
ReDim Preserve arrPoints(n)
arrPoints(n)=arrPoint
ptprec=arrPoints(n)
ReDim Preserve arrPointsO(n)
arrPointsO(n)=arrPointO
'change radius
Dim random:random=Rnd()
If random<0.5 Then
radius=radius+.1+(Rnd()*2.1)
radius=radius+.1-(Rnd()*1.5)
End If
'Next
n=n+1
If ZF>200 Then Exit Do
Loop
Dim arrLine,arrLineO
arrline=arrpoints
arrLineO=arrpointsO
StrRamp=Rhino.AddCurve(arrLine)
StrRampO=Rhino.AddCurve(arrLineO)
Dim longroute
longroute=Rhino.curvelength (StrRamp)
Call Rhino.Print("longueurroute"&longroute)

Dim ctrRect
ctrRect=(Rhino.PointSubtract (arrRect(0),boulga))
If IsNull(ctrRect) Then
Rhino.print"Pb avec variable ctrRect"
End If
'ligne pr tester
Dim testline,stato,arivo

stato=Array(0,0,0)
arivo=Array(10,0,0)
'testline=rhino.addline( stato,arivo)
Dim movtest,movtestO
movtestO=Rhino.RotateObject (StrRampO, Array(0,0,0), (balpha(0)))
movtest=Rhino.RotateObject (StrRamp, Array(0,0,0), (balpha(0)))
Dim movu,movuO
movuO=Rhino.MoveObject (movtestO, Array(0,0,0), ctrRect)
movu=Rhino.MoveObject (movtest, Array(0,0,0), ctrRect)



End Sub
CDR