Grasshopper

algorithmic modeling for Rhino

Who knows how to Read and Write *.txt or *.xls files in Grasshopper?
It will be great help for me to link with other database.
Since there are lot of software which can do data analysis more easily.
Thank you~

Views: 7666

Replies to This Discussion

You can try in VB code with System.IO.File, like this:

system.IO.File.WriteAllText("c:\text.txt", "text")

This code write word text in file text.txt on disk c.

I've testing your code but for list of text, the text used last column.

Please i need write a list of text on tree in the txt file.

You'll need to create a single string out of your list if you want to use IO.File.WriteAllText(). You can do this using a loop and a System.Text.StringBuilder for example.

If you specifically want to write to a file line by line, then you need to create a writer object that can send stuff to a file or memorystream.

http://www.dotnetperls.com/streamwriter

--

David Rutten

david@mcneel.com

Poprad, Slovakia

Thanks, David.

This is from a while back, but you can correct directly to excel from within GH. I'm not sure the extent to which you could read xls files without running excel.

http://liquidtectonics.blogspot.com/search/label/Excel

Reading in a csv file wouldn't really be much different in GH than parsing it within dotNet, so all of the dotNet classes you would use would be the same.
With the newer version of GH (I'm using 0.8.0004), streaming data with the yellow text box is easy. I write tabular data to a csv by concancate then strings with commas.

RSS

About

Translate

Search

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service