algorithmic modeling for Rhino

I'm looking for parsing code to read a CSV file from the Read File component. Figured this has been done already, but was having trouble finding example. I did find Damian Alomar's thing about forcing Excel to update Grasshopper (cool trick). But I'm really just looking to read in contents of CSV file.

Also I noticed only one output to the read file. If I have several columns in a CSV file, do I need to use a different Read File component for each column I want to parse out?


Views: 2337

Replies to This Discussion

Check this thread:

You can't add additional outputs to the parser component (i think). If you really want different outputs per column, i think the best solution would be to connect the file parser to a scripting component and split each line insde the scripting component to different outputs.

Inside the file parser you can combine several columns and output a value, for example you can combine 3 columns to output points (there's an example in that thread).

After some tinkering I got it to work for my needs. Now I can have an external data table with as many columns as I want, and then feed each column to the outputs of the VB component.

The data table has the GUIDs from referenced objects in Rhino, and now I can attach extra data fields to my Rhino objects (not the most elegant solution, but it works for now).

You can also use the _setusertext command in rhino to attach attribute data to objects. You can read this data in a scripting component. Unfortunately when you change this data in rhino, you have to manually update the definition for the changes to have an effect. Also, it's not very user friendly to change data using commands (you can add them to the toolbar).

I recently did a definition that required custom attribute data per object. Since objects could vary in number it was easier to have the data attached to the object rather than in a spreadsheet. I only needed 3 or 4 values per object, so i just added them to the name of the object in the form of "a;3;500". I have the object properties window open all the time so this way it's easy to quickly change the values.

It would be great if rhino's GUI allowed to add and change custom attribute data easily. Cinema 4D does this very well. I think David was working on a plugin that did this but i doubt it's still in development.
Yes, I was looking at the setUserText stuff earlier today, but it seemed too hard to use. The spreadsheet is not ideal, but I might end up using a lot of data fields, and Excel is easy to update a lot of data quickly.

Just in case I wanted to use your name thing. Do you still have code you used to parse the values out?

Also, I considered using the Rhino layer as a way to specify one of the attributes, as I assumed there is a way to read layer from a VB component, but hadn't tried it yet.






  • Add Photos
  • View All


  • Add Videos
  • View All

© 2022   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service