Grasshopper

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: 800

Reply to This

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

        writer.WriteLine(line)

      Next

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

    Else

      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

Else

  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

david@mcneel.com

Poprad, Slovakia

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

Hi,

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...

Attachments:

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 !!

Attachments:

Thank you!

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

RSS

Translate

Search Grasshopper

Photos

  • Add Photos
  • View All

© 2014   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service