Diggin’ on hell’s door

Option Explicit
‘Script written by Ado

Call Main()
Sub Main()

‘Dim strSrf : strSrf = Rhino.GetObject(“closed surface”,16)

Dim arrPtSeed : arrPtSeed = Rhino.GetObject(“Base Point”,1)
arrPtSeed = Rhino.PointCoordinates(arrPtSeed)

Dim n : n = 1000 ‘Rhino.GetInteger(“nr of points”, 10)

‘Dim bbox : bbox = Rhino.BoundingBox(strSrf)
Dim min : min = -500 ‘Rhino.Distance(bbox(0),bbox(6))/8
Dim max : max = 500’ Rhino.Distance(bbox(0),bbox(6))/4

Dim i, k : k = 1 : i = 0
Dim arrPt
Dim arrPtsCollect()

ReDim Preserve arrPtsCollect(0)
arrPtsCollect(0) = arrPtSeed

Do Until k = n+1

arrPt = array(arrPtSeed(0)+arbitraryValue(min, max),_
arrPtSeed(1) + arbitraryValue(min, max),_
arrPtSeed(2)- abs(arbitraryValue(min, max)))

Dim arrPtNeighBor : arrPtneighbor = shortestPt(arrPtsCollect, arrPt)
Call rhino.AddLine(arrPt, arrPtNeighBor)

ReDim Preserve arrPtsCollect(k)
arrPtsCollect(k) = arrPt
k = k + 1


Dim strCrv : strCrv = rhino.AddInterpCurve(arrPtsCollect)
Call rhino.ObjectColor(strcrv, vbred)

End Sub

Function shortestPt(arrPtsCollection, arrPtTest)
Dim i
Dim dblDistMin : dblDistMin = 100000000
For i = 0 To UBound(arrPtsCollection)
Dim dblDist : dblDist = rhino.Distance(arrPtTest, arrPtsCollection(i))
If dbldist 0 Then
If dblDist < dblDistMin Then
dblDistMin = dblDist
shortestPt = arrPtsCollection(i)
End If
End If
End Function

One more of the series… this one is almost working… i guess what i wanted is to have different possibilities to explore boundary populations, starting from surfaces to go to closed lines and finally redefine those conditions in the polysurfaces.

Digging algorithm

Digging algorithm


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 )

Google+ photo

You are commenting using your Google+ 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 )


Connecting to %s