Create spline from coordinate data output from digitizer

Hi!!!
I’m Hisashi from Japan.

I’m trying to Create a Spline Curve from coordinate data output from digitizer.

I got the following data from the digitizer.
The data contained coordinate values ​​and some words.
・NAME/C → This is unnecessary.
・PIN → This is crease of curve.
・TAN → This is end of curve.
point_to_spline.txt (2.0 KB)

I want to organize the data and draw the correct spline curve.
But I don’t know how to organize PIN and TAN…
I need advice.

Create_Spline.3dm (30.0 KB)
Create_Spline.gh (10.0 KB)

Thank you.

The N is the separator between adjacent coordinates? It’s weird because it’s appended without any whitespace to a TAN and PIN:

That can be fixed by replacing TAN with TAN+space but I thought I’d ask.

Ah! Your file has non-standard line endings for Windows. At least it reads correctly into Grasshopper despite not showing correctly in Notepad.exe, that’ll make things easier.

Incidentally it might actually have been easier to merge all the lines into a single string and first split at all TAN and PIN occurrences so you start out with all associated coordinates already in the same list.

String parsing can often be radically simplified by doing something ‘clever’ rather than by doggedly interpreting it in the most obvious way.

Anyway, hope this helps: parse coordininates.gh (64.9 KB)

Here’s an approach which first merges all the lines into a single blob of text, then breaks it apart at TAN and PIN locations and only then tries to interpret the coordinates: parse coordinates.gh (77.0 KB)

Hi David.
Sorry Late Reply.
Both of the above two methods are amazing!
Thank you.

“String parsing can often be radically simplified by doing something ‘clever’ rather than by doggedly interpreting it in the most obvious way.”
Very helpful!!

And I have to apologize…
I mistook the contents of Text data.


The highlighted line does not originally exist.
point_to_spline_2.txt (1.9 KB)
I try to improve the code so that the same result can be obtained with the above data…