Forgot password?

Create an account!

Forum

« back

RhinoScript – type mismatch in parameter. string required

Messages

Please log in to write a message.

  • 7. tos (Jun 03, 2013 09.35):

    I tried this Tree.
    It is no error.

    Perhaps LINE direction, or wrong recursive loop.

    LINE direction:
    Trunk(start) -> Branch(end)
    Branch(start) -> Leaf(end)

    type mismatch in parameter. string required
  • 6. gkontomi (Jun 02, 2013 10.54):

    now I have an error: type mismatch in parameter. string required

    Option Explicit

    Call Main()
    Sub Main()

    Dim arrLines : arrLines = Rhino.GetObjects("", 4)
    Dim strLine, i : i = 0
    Dim arrNames : arrNames = arrLines
    For Each strLine In arrLines
    arrNames(i) = Rhino.ObjectLayer(strLine)
    i = i + 1
    Next

    Call rhino.EnableRedraw(False)
    Dim arrSort : arrSort = Rhino.SortNumbers(arrNames)

    Dim arrLeafs : arrLeafs = Rhino.ObjectsByLayer(arrSort(Ubound(arrSort)))
    Dim arrPaths : arrPaths = arrLeafs
    Dim strLeaf
    Dim arrPts()
    For Each strLeaf In arrLeafs
    ReDim arrPts(0)
    arrPts(0) = Rhino.CurveEndPoint(strLeaf)
    Dim strLeafName : strLeafName = Rhino.ObjectLayer(strLeaf)
    Dim j : j = CInt(strLeafName)
    Dim strCurrentBranch : strCurrentBranch = strLeaf
    Dim arrParLeafs, strParent
    Do
    If j > 0 Then
    arrParLeafs = Rhino.ObjectsByLayer(CStr(j - 1))
    For i = 0 To Ubound(arrParLeafs)
    If Rhino.PointCompare(Rhino.CurveStartPoint(strCurrentBranch), Rhino.CurveEndPoint(arrParLeafs(i))) Then
    strParent = arrParLeafs(i)
    Exit For
    End If
    Next
    ReDim Preserve arrPts(Ubound(arrPts)+1)
    arrPts(Ubound(arrPts)) = Rhino.CurveEndPoint(strParent)
    strCurrentBranch = strParent
    j = j - 1
    ElseIf j = 0 Then
    arrParLeafs = Rhino.ObjectsByLayer(0)
    For i = 0 To Ubound(arrParLeafs)
    If Rhino.PointCompare(Rhino.CurveStartPoint(strCurrentBranch), Rhino.CurveEndPoint(arrParLeafs(i))) Then
    strParent = arrParLeafs(i)
    Exit For
    End If
    Next
    ReDim Preserve arrPts(Ubound(arrPts)+1)
    arrPts(Ubound(arrPts)) = Rhino.CurveStartPoint(strParent)
    strCurrentBranch = strParent
    j = -1
    Else
    Exit Do
    End If
    Loop

    Call Rhino.AddCurve(arrPts)

    Next
    rhino.EnableRedraw(True)

    End Sub

    LINE 38

  • 5. tos (Jun 02, 2013 03.31):

    Sorry.

    attPts -> arrPts

  • 4. tos (Jun 02, 2013 03.25):

    Hello.

    forgot "Dim attPts()" before line20.

    and

    line41 is "arrParLeafs = Rhino.ObjectsByLayer(0)"

    regards.

  • 3. gkontomi (Jun 01, 2013 22.53):

    line 37 has the mentioned problem:

    arrPts(Ubound(arrPts)) = Rhino.CurveEndPoint(strParent)

  • 2. gkontomi (Jun 01, 2013 22.51):

    error: type mismatch in parameter. string required

  • 1. gkontomi (Jun 01, 2013 22.43):

    Hello everyone!

    I've written this code and I'm stuck

    Option Explicit

    Call Main()
    Sub Main()

    Dim arrLines : arrLines = Rhino.GetObjects("",4)
    Dim strLine, i : i = 0
    Dim arrNames : arrNames = arrLines
    For Each strLine In arrLines
    arrNames(i) = CInt(Rhino.ObjectLayer(strLine))
    i = i+1
    Next

    Call rhino.EnableRedraw(False)
    Dim arrSort : arrSort = Rhino.SortNumbers (arrNames)

    Dim arrLeafs : arrLeafs = Rhino.ObjectsByLayer(arrSort(Ubound(arrSort)))
    Dim arrPaths : arrPaths = arrLeafs
    Dim strLeaf
    For Each strLeaf In arrLeafs
    ReDim arrPts(0)
    arrPts(0) = Rhino.CurveEndPoint(strLeaf)
    Dim strLeafName : strLeafName = Rhino.ObjectLayer(strLeaf)
    Dim j : j = CInt(strLeafName)
    Dim strCurrentBranch : strCurrentBranch = strLeaf
    Dim arrParLeafs, strParent
    Do
    If j > 0 Then
    arrParLeafs = Rhino.ObjectsByLayer(CStr(j-1))
    For i = 0 To Ubound(arrParLeafs)
    If Rhino.PointCompare (Rhino.CurveStartPoint(strCurrentBranch),Rhino.CurveEndPoint(arrParLeafs(i))) Then
    strParent = arrParLeafs(i)
    Exit For
    End If
    Next
    ReDim Preserve arrPts(Ubound(arrPts)+1)
    arrPts(Ubound(arrPts)) = Rhino.CurveEndPoint(strParent)
    strCurrentBranch = strParent
    j = j - 1
    ElseIf j = 0 Then
    arrParLeafs = Rhino.ObjectsByName(0)
    For i = 0 To Ubound(arrParLeafs)
    If Rhino.PointCompare (Rhino.CurveStartPoint(strCurrentBranch),Rhino.CurveEndPoint(arrParLeafs(i))) Then
    strParent = arrParLeafs(i)
    Exit For
    End If
    Next
    ReDim Preserve arrPts(Ubound(arrPts)+1)
    arrPts(Ubound(arrPts)) = Rhino.CurveStartPoint(strParent)
    strCurrentBranch = strParent
    j = -1
    Else
    Exit Do
    End If
    Loop

    Call Rhino.AddCurve(arrPts)

    Next
    rhino.EnableRedraw(True)

    End Sub


    when I run the code it says what you see in the attached picture

    It seems that there is a problem that I cant figure out

Recommend

Why are these buttons gray?