Hi Adam,

the variable called 'points' in your script is of type List(Of
On3dPoint). The function RhinoInterpCurve() requires that the points
be supplied as an ArrayOn3dPoint.

instead of:

Dim points As New List( Of On3dPoint )

use

Dim points As New ArrayOn3dPoint()

Then, instead of using:

points.Add(myPoint)

you use:

points.Append(myPoint)

And it should work fine.

--
David Rutten
[email protected]
Robert McNeel & Associates



On Feb 15, 6:14 pm, Apologue <[email protected]> wrote:
> Hi,
>
> So I have this problem with a VB component that I made to sort a list
> of points and create a number of interpolated curves through them.
> This is the code in the component:
>
> Sub RunScript(ByVal divNum As Integer, ByVal pts As List(Of
> On3dPoint), ByVal linNum As Integer)
>
>     Dim myCrv As New List(Of OnCurve)
>     Dim i As Integer
>     Dim j As Integer
>
>     For i = 0 To divNum Step 1
>       Dim points As New List( Of On3dPoint )
>
>       For j = i To linNum Step (divNum + i)
>         Dim myPoint As On3dPoint
>         myPoint = pts(j)
>         points.Add(myPoint)
>
>       Next
>       'Create a nurbs curve
>       Dim crv As New OnNurbsCurve
>       crv = RhUtil.RhinoInterpCurve(3, points, Nothing, Nothing, 0)
>       If( crv.IsValid() ) Then
>         'Set return vlue to list
>         myCrv.Add(crv)
>       End If
>     Next
>     A = myCrv
>
>   End Sub
>
> And this is the error message I get coming out of the component:
>
> "Unable to cast object of type 'System.Collections.Generic.List'1
> [RMA.OpenNurbs.On3dPoint) to type 'RMA.OpenNurbs.IArrayOn3dPoints'"
>
> Any ideas?  I'm pretty new to scripting and have been racking my
> brains trying to figure it out.
>
> Thanks,
> Adam

Reply via email to