algorithmic modeling for Rhino
Lately I've found myself jotting down and formatting notes in Grasshopper then exporting to a text file. (If this is strange to you, I understand completely.) So I've written a quick script making that workflow a bit easier. I know there are other codes out there, but I thought it might be interesting to share nonetheless.
There are some simple built-in safety protocols. It checks for an existing file path first then proceeds with the exporting process. If the specified file contains data the user is prompted with a warning, asking him/her to allow an overwrite or specify a new path.
It also works with CSV files. You will need GHPython.
You're welcome to download it here. Image of it in use below.
Best,
/SPM
EDIT 05/2016: The above file now includes the latest script with the additional functions (append, relative path, etc.).
Comment
Hey, Nick. Sure thing; I just updated the file in the post. I hope it helps!
/SPM
Hi Stephen,
Is there a link to the updated version with the append function? I downloaded from the link in the original post but it includes the overwrite function instead? Many thanks - this looks like just what I need.
regards
Nick
Christian,
That code is an adapted version of Giulio and Brian's (see discussion here), which is why I credit them in the script.
The code pings the GH Document, so if you're passing along a definition to someone who doesn't have a particular plugin the file uses, it will not display in the [Panel]. But the user will still be prompted with the "Unrecognized Objects" warning.
/SPM
The component is a useful alternative to stream content option of the panel.
But I was even more excited component you have 'hidden' which shows you the plug ins used in a definition. That is really helpful if you hand out definitions to people!
Matt,
My thoughts exactly. I was looking for a more user-friendly way to export text. The script allows me to stream data in real time or not. Fits better with my workflow.
/SPM
P.S. Just finished a bit of code that prompts the user to choose a file upon setting "write" to "True." This cut the code a few lines and removes the '"file" input, but may not be desirable if the user is constantly overwriting the same file.
Guessing you know when you write click on a panel you can click stream contents and set file path to stream to. Only down side is it will stream them in real time with the only way to stop the over ride is right click the panel and click the stream contents icon again to stop it.
P.s I like the idea of a boolean switch to stop and start writing. As means you can design things then break the stream and use the saved data for something else. Guess you can do it with Data Dam though that does not have a switch and must be done manually.
Thanks for sharing
Welcome to
Grasshopper
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
© 2024 Created by Scott Davidson. Powered by
You need to be a member of Grasshopper to add comments!