FINAL PROJECT

Sina Mesdaghi

Therese Diede

Call Main()
Sub Main()
Dim i,j,d,k,p,q,u,v, arrPlane, Circle, strAttractor, strPath, extrude, arrPoint, arrPoints, intLoop, arrRndNumber, strPoints()
Dim UDomain, VDomain, UStep, VStep, dblDistance, arrAttractor, testDistance
Dim intU : intU = 100 ‘Horizontal
Dim intV : intV = 1 ‘Vertical
ReDim arrCrvPt(intU)
ReDim arrCrv(intV)
ReDim arrFrame(intU,intV)
ReDim arrPts(intU,intV)
ReDim arrPtNormal(intU,intV)
Dim dblMatThick : dblMatThick = 0.25
For q = 0 To 4
For p = 1 To 5
arrPlane = Rhino.PlaneFromPoints (Array(p*8,q*8,0), Array(p*8,q*8+1,0), Array(p*8+1,q*8,0))
circle = Rhino.AddCircle (arrPlane, 3.5)
strPath = Rhino.AddLine (Array(20,30,0), Array(20,30,dblMatThick/2))
extrude = Rhino.ExtrudeCurve (circle, strPath)
arrPoints = Rhino.DivideCurve (circle,(4+p*4))
intLoop = Random(0+p*3, UBound(arrPoints))
If intLoop < 2 Then intLoop = 2
For j = 0 To IntLoop
ReDim Preserve strPoints(j)
arrRndNumber = Random(0, UBound(arrPoints))
arrPoint = arrPoints(arrRndNumber)
strPoints(j) = Rhino.AddPoint (arrPoint)
Next
ReDim arrAttractors(UBound(strPoints))
d = (p+2)*20
k=0
For Each strAttractor In strPoints
arrAttractors(k) = Rhino.pointcoordinates (strAttractor)
k=k+1
Next
UDomain = Rhino.SurfaceDomain(extrude, 0)
VDomain = Rhino.SurfaceDomain(extrude, 1)
UStep = (UDomain(1) – UDomain(0)) / intU
VStep = (VDomain(1) – VDomain(0)) / intV
For j = 0 To intV
For i = 0 To intU
u = UDomain(0) + UStep * i
v = VDomain(0) + vStep * j
arrFrame(i,j) = Rhino.SurfaceFrame (extrude, Array(U,V))
dblDistance = d
For Each arrAttractor In arrAttractors
testDistance = Rhino.Distance (arrFrame(i,j)(0), arrAttractor)
If testDistance < dblDistance Then
dblDistance = testDistance
End If
Next
dblDistance = dblDistance/1
arrPtNormal(i,j) = Rhino.PointAdd(arrFrame(i,j)(0), Rhino.VectorScale (arrFrame(i,j)(3),dblDistance+(j*0.5)))
arrCrvPt(i) = arrPtNormal(i,j)
Next
arrCrv(j) = Rhino.AddCurve (arrCrvPt)
Next
Call Rhino.addLoftSrf (arrCrv)
Call Rhino.DeleteObjects (strPoints)
Call Rhino.DeleteObject (extrude)
Call Rhino.addLoftSrf (Array(circle,arrCrv(0)))
Call Rhino.SelectObject (arrCrv(1))
Call Rhino.Command (“PlanarSrf “)
Call Rhino.UnselectAllObjects
Call Rhino.MoveObject (circle, Array(0,0,0),Array(0,0,dblMatThick+0.1))
Call Rhino.OffsetCurve (circle, Array(0,0,0), 0.125)
Call Rhino.deleteObject (circle)
Call Rhino.deleteObjects (arrCrv)

Next
Next

End Sub

Function Random(nMin, nMax)
Random = Int((nMax – nMin)*Rnd + nMin)
End Function

final_render

final_process1

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s