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
0 responses so far ↓
There are no comments yet...Kick things off by filling out the form below.