algorithmic modeling for Rhino

Hi David et al,

I think the current Read File component is great, but it seems to be missing a friend. The current practice of streaming content by the Panel offer too little option. For example I would expect a WriteTxtFile tool, would take data like panels, and write it to a location (file path can be defined parametrically), write enable toggle, file exist check etc.


Because some of the time writing to a text file is preferred and that streaming content is not desired (which could accidentally overwrite my previous data). So a WriteTxtFile and StreamTxtFile could be two different component. So we could formally do the operation but not restricted to relying on the Panel.

Views: 5136

Replies to This Discussion

I solved the problem somehow by writting a short VB component:


If (activate = True)

      Dim writer As StreamWriter = _

        New StreamWriter(path)

      For Each line As String In lines



      A = "File written to " & path & " at " & now()


      A = "Not activated"    

End If


Hi Victor,


it could be even shorter:


If (activate) Then

  IO.File.WriteAllText(path, String.Join(Environment.NewLine, lines.ToArray()))

  A = "File written to " & path & " at " & DateTime.Now


  A = "Not activated"

End If


But I like the idea of a dedicated file writing component. It probably makes a lot of sense to add one.



David Rutten

Poprad, Slovakia

Thankyou for your reply David. I'm happy you agree with me.


I'm Phd student in architecture and i'm trying to modify a text file. I try to create the same component, but i have always an error, please could you send me this component in a GrassHopper File.

Thank you

Best regards

Try This...


Hi Victor, Hi All

I've problem for write a list of text in txt file.

If i write a multiligne data, a last column is write.

Hi Remi, could you solve the problem? I am having the same one...Could you give me some advice?

Yes Nicolas.

Please, look this ghx !!


Thank you!

Brilliant!!! That's exactly what I was looking for. Thx

I know this is an old thread, but the "problem" remains of being able to write a text file out (not using stream contents).

I am trying Remy's VB component and it works in a way, but is useless because of the way that the File path primitive works. What we need is a Folder path primitive or some way to set a FOLDER not a file. Because if I want to save a new file, I have to either set the actual path as text, which is just ridiculous or keep overwriting an existing file, which is also ridicolous, because I have to create the file first.

The solution would be a way to pick a Folder. In vvvv this is solved really well, where I can pick a file or a folder, then get the contents of the folder or use the folder path to concatenate my own filename and ending.

If for example I want to be able to pick a folder and then have it write a file that starts with the current time every time I press write on the component, then I don't see a way of doing this right now, which is a real shame. For working with files in a folder, Grasshopper is really terrible right now.

I know there is the possibility to stream a panel, but in many ways this is inferior and much worse usability wise, because I (or the person using my document) has to use a totally different pattern of interaction, especially with having to flick Stream Contents on and off.

While we are at it, it would be great if we could get support for relative file paths as well as a node that gives me the folder of the current grasshopper document.

Does anybody know a solution?

especially with having to flick Stream Contents on and off.

You should use the Data Dam component to trigger a write event.

EDIT: you should also write this on the Pain Points Discussion for Marc Syp to see. They are looking for a plug-in to write for GH






  • Add Photos
  • View All

© 2022   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service