Hi,
I am still struggling getting my head around VB.NET.
I have the following Grasshopper definition:
(x,y,z)Pt(Pt) ---> (testpoints)VB(out,tstOut) and yellow panels hooked
up on the VB outputs.
The code in the VB component is as follows:
Sub RunScript(ByVal testpoints As List(Of On3dPoint))
reflect(testpoints)
tstOut = testpoints.get_Count
End Sub
This results in the following reflect output:
Error: 'get_Count' is not a member of 'System.Collections.Generic.List
(Of RMA.OpenNURBS.On3dPoint)'.
But when I comment out the line with tstOut, reflects outputs:
List`1 {methods: 'ConvertAll', 'get_Capacity', 'set_Capacity',
'get_Count', 'get_Item', 'set_Item', 'Add', 'AddRange', 'AsReadOnly',
'BinarySearch', 'Clear', 'Contains', 'CopyTo', 'Exists', 'Find',
'FindAll', 'FindIndex', 'FindLast', 'FindLastIndex', 'ForEach',
'GetEnumerator', 'GetRange', 'IndexOf', 'Insert', 'InsertRange',
'LastIndexOf', 'Remove', 'RemoveAll', 'RemoveAt', 'RemoveRange',
'Reverse', 'Sort', 'ToArray', 'TrimExcess', 'TrueForAll', 'GetType',
'ToString', 'Equals', 'GetHashCode'}
Question: what am I doing wrong? Why is get_Count not working?
More background:
Steve B sent me some code as a reply to a question in the Rhino.plug-
ins group which contains the following line:
testpoints.TryFastGet(i, x, y, z)
Grasshopper doesn't like TryFastGet and so I started looking for a way
to access x,y,z info of the points some other way... If I search the
Rhino 4 .NET SDK helpfile for methods of list I basically end up with
nothing. Steve's code also includes the following:
Dim pointcount As Integer = testpoints.Count()
Both following lines have no problems:
reflect(pointcount)
tstOut = pointcount
So now I know that the way to get the count of the list is by using
its .Count() method but how do I find out about things like that? I
thought that I could use reflect for this but that tells me "List`1
{methods: <snip> 'get_Count' <snip>}".
Is it me that is misreading the reflect information?
Thanks for any pointers!
(btw, I guess that in this specific case I will do something like
"For each point Pt in the points list give me access to Pt.x"
but this post is more about finding out which methods to use...)
cheers,
wim