Option Explicit 'Script written by Mitch 'Input from Mike Houlder, Pascal Golay, Dale Fugier 'Version Sunday, 25 September, 2011 Call OffsetPointsAlongCrv() Sub OffsetPointsAlongCrv() Dim strCrv,refPt,strFirstPt strCrv = Rhino.GetObject("Select curve for point offset",4,True) If IsNull(strCrv) Then Exit Sub refPt = Rhino.GetPointOnCurve(strCrv,"Place initial point on curve") If Not IsArray(refPt) Then Exit Sub strFirstPt=Rhino.AddPoint(refPt) Call Rhino.SelectObject(strFirstPt) Dim strResp,nextDist,arrNewPt,offsetPtObj,prevPt,n n=1 Do While n>0 strResp=Rhino.GetString("Distance to next offset point",,Array("UndoLast")) If IsNumeric(strResp) Then nextDist=CDbl(strResp) arrNewPt=GetNextPointAlongCrv(strCrv,refPt,nextDist) If Not IsArray(arrNewPt) Then Call Rhino.Print("Unable to place next point, check distance") Else Call Rhino.UnselectAllObjects offsetPtObj=Rhino.AddPoint(arrNewPt) Call Rhino.SelectObject(offsetPtObj) prevPt=refPt refPt=arrNewPt : n=n+1 End If Else If IsNull(strResp) Or strResp<>"UndoLast" Then Exit Sub Call Rhino.DeleteObject(Rhino.FirstObject) refPt=prevPt n=n-1 If n>0 Then Call Rhino.SelectObject(Rhino.FirstObject) End If Loop End Sub Private Function GetNextPointAlongCrv(crv,pt,dist) 'outputs next point coordinate if successful, or Null if not GetNextPointAlongCrv=Null Dim crvDom,totLen,tParam,partLen,arrNxtPt crvDom = Rhino.CurveDomain(crv) totLen = Rhino.CurveLength(crv) tParam = Rhino.CurveClosestPoint(crv,pt) partLen = Rhino.CurveLength(crv,,Array(crvDom(0),tParam)) If (partLen+dist=0) Then arrNxtPt=Rhino.CurveArcLengthPoint(crv,partLen+dist,True) End If If IsArray(arrNxtPt) Then GetNextPointAlongCrv=arrNxtPt End Function