Forgot password?

Create an account!

Forum

« back

RhinoScript – selecting the curve while running rhinoscript

Messages

Please log in to write a message.

  • 1. ved810 (Apr 12, 2018 13.07):

    Dear all,
    I am Engineering student,new to rhinoscripting, working on T-spline.For that purpose I need knot vector for given curve.I searched it on internet where I got following rhinoscript,


    Option Explicit

    Sub ListKnotVector

    Dim curve : curve = Rhino.GetObject("Select curve", 4)
    If IsNull(curve) Then Exit Sub

    Dim knot : knot = Rhino.CurveKnots(curve)
    If Not IsArray(knot) Then
    Rhino.Print "NULL knot vector"
    End If

    ' order = degree + 1
    Dim order : order = Rhino.CurveDegree(curve) + 1
    If (order < 2) Then
    Rhino.Print "knot vector order < 2"
    End If

    Dim cv_count : cv_count = Rhino.CurvePointCount(curve)
    If (cv_count < order) Then
    Rhino.Print "knot vector cv_count < order"
    End If

    Dim knot_count, i, i0, mult
    If (order >= 2) And (cv_count >= order) And IsArray(knot) Then
    knot_count = order + cv_count - 2
    i = 0
    i0 = 0
    Rhino.Print "index, value, mult, delta"
    While (i < knot_count)
    mult = 1
    Do While (i + mult < knot_count)
    If (i + mult < knot_count) Then
    If (knot(i) = knot(i+mult)) Then
    mult = mult + 1
    Else
    Exit Do
    End If
    Else
    Exit Do
    End If
    Loop
    If (i = 0) Then
    Rhino.Print CStr(i) & ", " & CStr(knot(i)) & ", " & CStr(mult)
    Else
    Rhino.Print CStr(i) & ", " & CStr(knot(i)) & ", " & CStr(mult) & ", " & CStr(knot(i)-knot(i0))
    End If
    i0 = i
    i = i + mult
    Wend
    End If

    End Sub



    I am not able understand how to select the curve which is given in the initial part of script...
    hope anyone will help on this matter...
    Thank you ...

Recommend

Why are these buttons gray?