Barcelona workshop rhinoScript

RhinoScript workshop Barcelona dna

I am just back to Delft after having visited Barcelona to participate as a Rhino educator to McNeel’s RhinoScript workshop. Luis Fraguada of Live Architecture Network was the instructor and showed us some useful techniques for geometry construction and data visualization. I developed one of the script of the class a bit further and came up with this DNA helix.

Download the code: Rhino VBScript file dna.rvb.

Option Explicit
Rem Script written by Giulio
Rem Script version lunes, 10 de noviembre de 2008 21:00:00

Call Main()

Sub Main()

Dim arrLfStart(),arrRxStart(), arrLfEnd(), arrRxEnd(), arrLinks(), i
Dim links: links = 36

ReDim arrLfStart(links), arrRxStart(links), arrLfEnd(links), arrRxEnd(links), arrLinks(links)

Dim angleDist:angleDist = Rhino.PI / 10

For i=0 To links

arrLfStart(i) = Array(Cos(i-angleDist)*3 + Cos(i*12)*12, Sin(i-angleDist)*3 + Sin(i*12)*12, i*5)
arrRxStart(i) = Array(Cos(i+angleDist)*3 + Cos(i*12)*12, Sin(i+angleDist)*3 + Sin(i*12)*12, i*5)
arrLfEnd(i) = Array(-Cos(i-angleDist)*3 + Cos(i*12)*12, -Sin(i-angleDist)*3 + Sin(i*12)*12, i*5)
arrRxEnd(i) = Array(-Cos(i+angleDist)*3 + Cos(i*12)*12, -Sin(i+angleDist)*3 + Sin(i*12)*12, i*5)

Call Rhino.AddCylinder(IntraPts(arrLfStart(i), arrRxStart(i), 0.5), IntraPts(arrLfEnd(i), arrRxEnd(i), 0.5), 0.5)

Next

Call Rhino.AddLoftSrf(Array(Rhino.AddInterpCurve(arrLfStart), Rhino.AddInterpCurve(arrRxStart)))
Call Rhino.AddLoftSrf(Array(Rhino.AddInterpCurve(arrLfEnd), Rhino.AddInterpCurve(arrRxEnd)))

End Sub

Function IntraPts(byRef p1, byRef p2,byRef n)
Rem This function gives the first point out if you use n=0,
Rem with n=1 it gives the second point.
IntraPts = Array( p1(0)*(1.0-n)+p2(0)*n, p1(1)*(1.0-n)+p2(1)*n, p1(2)*(1.0-n)+p2(2)*n )
End Function


Leave a Reply