Follow Path.

Curve üzerinde dizin oluşturma..








Option Explicit

Sub SelfDividingPolyline()
    Dim crvMaster, crvStamp
    Dim Depth, Steps, s
    Dim vertices, copies(), i

    crvMaster = Rhino.GetObject("Select a curve to grow along...", 4, vbTrue, vbTrue)
    If IsNull(crvMaster) Then Exit Sub

    crvStamp = Rhino.GetObject("Select an open path curve for recursive stamping...", 4, vbFalse, vbFalse)
    If IsNull(crvStamp) Then Exit Sub
    If Rhino.IsCurveClosed(crvStamp) Then Exit Sub

    If Not Rhino.IsPolyline(crvMaster) Or Not Rhino.IsPolyline(crvStamp) Then
        Steps = Rhino.GetInteger("Specify a number of steps for smooth paths...", 3, 2, 100)
        If IsNull(Steps) Then Exit Sub
    End If
   
    Depth = Rhino.GetInteger("To what depths are you willing to go?", 4, 1, 100)
    If IsNull(Depth) Then Exit Sub

    For s = 1 To Depth
      vertices = PointsOnCurveSpecial(crvMaster, Steps)
      If IsNull(vertices) Then Exit Sub
     
      For i = 0 To UBound(vertices)-1
          ReDim Preserve copies(i)
          copies(i) = Rhino.OrientObject(crvStamp, Array(Rhino.CurveStartPoint(crvStamp), Rhino.CurveEndPoint(crvStamp)), _
                                                   Array(vertices(i), vertices(i+1)), 3)
      Next
      crvMaster = Rhino.JoinCurves(copies, vbTrue)(0)
    Next
   

End Sub
SelfDividingPolyline

Function PointsOnCurveSpecial(strCurveID, amount)
    Dim divPt
    If Rhino.IsPolyline(strCurveID) Then
        divPt = Rhino.PolylineVertices(strCurveID)
    ElseIf Rhino.IsCurve(strCurveID) Then
        divPt = Rhino.DivideCurve(strCurveID, amount)
    Else
        divPt = Null
    End If
    PointsOnCurveSpecial = divPt
End Function

Ekleyen: Mad_Max

Kapalı

Topic closed automatically because it`s been more than a year!