algorithmic modeling for Rhino
Hi,
attached is a GHPython script with which I am trying to automate the export of screenshots using a "-_ViewCaptureToFile" macro.
The weird thing is...once I export 2 or 3 images, I can't pan in the GH canvas anymore (only zoom) and can't select components. Do you have the same problem?
I thought it had something to do with switching documents, but I've tried setting scriptcontext to ghdoc before and after the script and the same problem occurs.
Maybe it has to do the way I'm writing the macro? I used rs.Command() because I couldn't find a method for this, if there are any please let me know.
Any help much appreciated!
Cheers,
Max
Tags:
If you're using a Button to trigger the capture this is likely the culprit. Try with a Boolean Toggle to check. Not exactly a good solution, but it should do the trick.
Yes that works, thanks!
Ok another question...The view capture doesn't work if the file path has a space in it, e.g. "C:\Users\Max Marschall\Desktop\".
If I manually type "-_ViewCaptureToFile" in the command line, hit enter, and then copy-paste "C:\Users\Max Marschall\Desktop\test.jpg", it works. However, if I start typing that path, the moment I get to the space Rhino thinks I want to end the path name at that point, which is precisely what is happening in my script.
How do I make Rhino read the space as an actual character? Also, is there a better way to script a view capture, maybe using RhinoCommon instead of the macro?
Cheers,
Max
You can define a string inside another string using single AND double-quotations like so:
'"C:\Users\Max Marschall\Desktop\"'
That should work. There are also functions to check/format path names in the os module.
All that said, try out the latest version which uses RhinoCommon directly. That'll probably alleviate this issue as well I imagine (see attached).
/A
That works perfectly! Thanks again.
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
Added by Parametric House 0 Comments 0 Likes
© 2024 Created by Scott Davidson. Powered by