EM_hole maker

Option Explicit

Call Main()
Sub Main()

Dim scrvs : scrvs = Rhino.GetObjects(“Pick Voronoi Cells”,4)

Dim j,k
Dim aCtrlPts, scrv, aptsdiv, scrvmid, aparam, apttemp, aptmid

For j = 0 To UBound(scrvs)

aCtrlPts = Rhino.PolylineVertices(scrvs(j))

If UBound(aCtrlPts) >= 5 Then

sCrv = Rhino.AddCurve(array(aCtrlPts(0),aCtrlPts(1),aCtrlPts(2),aCtrlPts(3), aCtrlPts(0)))
aptsdiv = Rhino.DivideCurveLength(scrv,200,True)
aptsdiv = Rhino.DivideCurveLength(scrvs(j),400,True)
Else
sCrv = Rhino.AddCurve(array(aCtrlPts(0),aCtrlPts(1),aCtrlPts(2), aCtrlPts(0)))
aptsdiv = Rhino.DivideCurveLength(scrv,200,True)
aptsdiv = Rhino.DivideCurveLength(scrvs(j),400,True)

For k = 0 To UBound(aptsdiv)

aparam = Rhino.CurveClosestPoint(sCrv,aptsdiv(k))
apttemp = Rhino.EvaluateCurve(sCrv,aparam)
scrvmid = Rhino.AddLine(aptsdiv(k), apttemp)
aptmid = Rhino.CurveMidPoint(scrvmid)

Call Rhino.AddPoint(aptmid)
Call Rhino.DeleteObject(scrvmid)

Next
End If
Next
End Sub

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