Grasshopper

algorithmic modeling for Rhino

Hi

I have a text file which is separated by spaces.  I need to extract out the 3rd, 4th and 5th column to use as x,y,z coordinates.  I have tried the text split using a single space as the delimiter and then using the cull command to remove the resulting empty string.  However due to the size of the file, it takes sometime (>5 minutes) to process the file.  Is there a faster way to do this?

Many thanks

William

Views: 2822

Attachments:

Replies to This Discussion

Just realised why it is giving so many <empty>, because as a divider in the text file it uses 5 spaces. Well wherever the textfiles come from, whoever decided it was a good idea to use that as a separator is a bit of an idiot (no offense).

Instead of using " " as the separator, you can also try to use "      ", although I doubt it will be that much faster. At least you wont have any <empty> data in your output. I am not in front of GH right now, so cant test if it really works. In any case splitting text is simply a slow process unfortunately.

this could be a solution, but i am not sure if it is going to be quick. you can test it with your data.

since the file structure will be like this, without changes the i and n input can be set manually.

best

alex

I had a similar idea to you Alex, just worked out the spacing was set so could split the text in parts then trim the write space at the start. Also solves the problem you will get if the numbers are different lengths.

Marcus Code seems the best solution though. 

RSS

About

Translate

Search

Photos

  • Add Photos
  • View All

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service