Reading a CSV and extracting points

Hi all,
I have a CSV file with x and y coordinates that I am trying to extract the points with Grasshopper.
I’m not sure what the best method is, I have a text to number issue. I have not used grasshopper much so any help would be great.
This is my workflow;

  1. File Path

  2. Read File

  3. Split (remove the headings from the CSV)

  4. Split (remove bottom data I don’t need, this leaves my x and y data that I want and looks clean in a Panel)

  5. Split (using “,” so it now gives 2 lists of x and y respectively)

  6. List Item (add “+1” this splits the output of the 2 lists)

I cant plot the points or convert to numbers, not sure why. it is obviously wrong, can someone point me in the right direction?

I would probably start here: DigiPedia - Tu Delft

Is that a university? That server appears to be overwhelmed? Very slow to load but eventually saw this, which looks good. :+1:

It would help if you would post a gh file of what you have so far along with your csv of points (or a reduced sample).

yes, it is the Technical University of Delft, NL
They have a very nice + short introduction into Rhino /Grasshopper

Did you work there?

would have been nice, but no.

naca0012h-sa.csv (2.0 KB)

foilimport.gh (11.3 KB)
I am trying to import the points of this foil and make a spline through the points. And then a line between the start and endpoints to close the sketch. The points are coming in now but don’t understand why I cant put a curve through them.

This is another that I have made and puts a curve through points fine

SUBOFFgrasshopper.gh (13.4 KB)

Thankyou, I’ll have a look through this when I have time. i have managed to import the points but not put a curve through them. I have attached my .gh

I have attached my .gh, I’m sure there is a better way to do it.

You got so close! You just needed to plug the points in the right input (V) on the polyline component and flatten the branches.

Using a polyline makes strait lines between points, I want to use “interpolate points” this works fine in rhino and leaves a smooth surface at the leading edge. but not sure why its not working.

2 additional questions; how did you get the headings above and what does “flatten” do and why is it needed for PolyLine?

This is what I want but in grasshopper

As @nathanlundberg77 says you are almost there :slight_smile:
The solution is in the answer to your question: " What does flatten do".
See image below, the data of the “points” is saved in a dataset, where each point is in its own “cell”. Then next component connected (interpolate or poly line) will do its job per cell, giving 63 times the output a curve made of 1 point (what is not a curve)
By flattening all data is moved into the same “cell”. (have al look with label) and now the output is seen as 63 points to work on.
Regards, Eef


Perfect thanks for your help. this is giving a nice closed curve.
Apologies to add to the questions, I’m looking at outputting this as an STL and want to convert it to a TriMesh before, I’m wondering how to have better control over the refinement where there is large curvature.
I have deliberately made a bad mesh to describe what I’m thinking.
At the moment I only have control over the lengths globally, is there a way I can I put a formular in there to change length respective to x distance? I want very high refinement at the leading and trailing edge but don’t require it elsewhere. is there a better way to do this? the last image has a finer mesh but I want a lot finer still but don’t want it everywhere.

You can try remesh by color

Well, I would not mesh it in grasshopper Rhino. For me the easy and until fine quality route, is to export as 3mf (or step) and let the slicer do the job.
Regards, Eef

Hi Eliah,

I agree with Eef, typically the default Rhino export for .3mf and .stl are pretty good for 3D printing. However if you really want to control it from grasshopper, you could try something like the following. Some slicer’s don’t like quad meshes so you may or may not need to triangulate it at the end.

What printer are you using?

foilimport interpolate.gh (19.2 KB)

Thanks for the help. This isnt for a 3D printer at this stage. It is going to be used as an input for a software called OpenFOAM. It is a fluids dynamics software that is largely dependent on mesh quality. It has to be a STL (Ascii)

If i Mesh it before exporting i have better control over the mesh size’s than if i just use the exporter settings i believe.

Ascii STL and CSV can be extremely inefficient. Its not a good format to exchange data:

Consider a single coordinate
0.123456

in float32
	3d fc d6 80
-> 4 Byte

in ascii string
	30 2e 31 32 33 34 35 36
-> 7 Byte + 1 Byte as dedicated coordinate separator

Now consider the maximum accuracy
0.12345678910111213145

in float32
	3d fc d6 ea
-> 4 Byte

in ascii string
	30 2e 31 32 33 34 35 37 37 38 
	39 31 30 31 31 31 32 31 33 31 34 35		
-> 22 Byte + 1 Byte as dedicated coordinate separator

The only occurrence where ASCII is equal to binary:
0.1

in float32
     3d cc cc cd
-> 4 Byte
   
in ascii string
    30 2e 31
-> 3 Byte + 1 Byte as dedicated coordinate separator

Now add this up to many thousands if not millions of vertices…
But of course this holds true for any non-binary format.
Also you can save up memory by applying compression.
Not for 3d printing, but e.g DWG is a great format,
which has aggressive compression build-in. For printing,
binary STL is probably the best. At least I’m using it.