Yes, VB only. You essentially parse the String you're given and return an object which represents the string. Let's assume you have a textfile which contains the following:
The first number is merely the index and the last three numbers on each line represent the x, y and z coordinates of a point. We cannot use the in-build String->Point converter in Grasshopper because it doesn't understand that a point coordinate might consist of 4 parts, the first one of which is an index.
So, you write the following parser, and you're done:
Dim parts As String() = data.Split(";".ToCharArray(), StringSplitOptions.RemoveEmptyEntries)
Dim x As Double = Double.Parse(parts(1))
Dim y As Double = Double.Parse(parts(2))
Dim z As Double = Double.Parse(parts(3))
I totally forgot to fix that code when I switched to the new SDK in Grasshopper 0.7
I'll have to do so soon, but in all likelyhood any existing parser code will become unusable.
how about using a normal C#/Vb.Net scripting component? Once one is used to it, I find it is much friendlier and reliable than the parser... plus, it will keep on working from 0.6 -> 0.7.
I've attached a small example, in the hope it could be somehow useful.
- Giulio
________________
giulio@mcneel.com
McNeel Europe, Barcelona
Thanks David and Giulio
Yeah I already wrote my Vb component to parse the file.
but I was still curious to understand how the parser works.
example very useful...