Since I'm not clear on what you actually want your code to do I can't
really say whether it its working or not, but as to the error you're
seeing, I believe its because  all of the inputs to your script are
just considered objects, which is the most generic data type there
is.  Also, your data is passed to your script as a singular object,
not a collection.  Therefore, you can't refer to it with an index.
Whether the error is because your data isn't a collection or isn't a
On3dPoint, I don't know, but I would change those in the script
component itself and see if that helps.  Right click on the name of
the variable (in GH) and set the type hint to On3dPoint, along with
enabling List.  I think that should work, but its possible it
won't...if not, some more information would be helpful.

Best,
Damien

On Mar 17, 6:27 pm, merwin <[email protected]> wrote:
> Hello, I have a issue with culling a list by another list.  Here's
> what I'm trying to accomplish:
>
> 1. I have an original list (of points)
>      - this list is a list of vertices for octagons (@ 8 points per
> octagon)
> 2.  I have a culled list derived from the original list (1 point
> represents each octagon)
> 3.  I send this culled list into a Cellular Automata module which
> gives me a new culled list (of live points)
> 4.  **I compare the new culled list with the original and draw out the
> remaining 7 points associated with each point in the new culled list.
> (so that I can create an octagon).
>
> Below is the script I was using to try and accomplish #4, which
> returned "Script exception: Unable to cast object of type
> 'RMA.OpenNurbs.On3dPoint' to type ' System.Collections.IEnumerable'."
>
> Any suggestions on how to fix or do #4 another way?  Thanks!
> -Matt Erwin
>
> Sub RunScript(ByVal OrigPoints As Object, ByVal CAPoints As Object,
> ByVal NumOrigPts As Object, ByVal NumCAPts As Object)
>     ''' <your code>
>     Dim LOctPoints As New List(Of On3dPoint )
>     Dim i As On3dPoint
>     Dim j As On3dPoint
>     Dim k As Int32
>     Dim m As Int32
>     Dim n As Int32
>     k = 0
>     m = 0
>     n = 0
>
>     'Cycle through the two list of points to find the matches
>     For Each i In OrigPoints
>       For Each j In CAPoints
>         'when you find a match, store the 8 octagon points from the
> original list that coinciding with the matching point
>         If i = j Then
>           For k = 0 To 7
>             n = m + k
>             LOctPoints.Add(OrigPoints(n))
>           Next
>         End If
>       Next
>       m = m + 1
>     Next
>     'output the new list
>     liveOctPoints = LOctPoints

Reply via email to