Hello, I am working on a python script that is supposed to make a image for the current view, then hide the current layer, show the next layer and repeat. I was having difficulty with the Rhino.Command(-_Print) and had read that it had known bugs, so the only resources I could find were for the Rhino.Command(-_ViewCaptureToFile). The script seems to be working as intended, the view capture file is accepting my naming convention and going into the right path, but the background is grey and I can’t seem to get the command to accept an input that would change its value. Does anyone know how I can implement Transparent backgrounds, or an alternative method of saving my images to a folder for printing?
The current code I am using for the ViewCaptureToFile is:
“rs.Command(’-_ViewCaptureToFile ‘+chr(34)+Result+i+’.png’+chr(34)+’ _Enter’)”
Hello, Thank you for providing the sample script. I had seen this previously but overlooked the “.TransparentBackground” area, but I had abandoned this script as a reference because I was unable to get it to run from even pasting it into a blank script. I believe this script is a great example for what I am trying to do but I am unaware of how to extract the line I need and get it working when the example itself is not working.
The error I receive when trying to run this code as is:
" Message: attribute ‘ViewCapture’ of ‘namespace#’ object is read-only
Traceback:
line 10, in SampleViewCaptureToFile, “C:\Users\nate\AppData\Local\Temp\TempScript.py”
line 29, in , “C:\Users\nate\AppData\Local\Temp\TempScript.py”
"
I am working in Rhino 5. Is there a way to set the .TransparentBackground to True without the ViewCapture() command that is holding it up? The issue is the view_capture = ViewCapture section, I’d like to, if possible, eliminate all the view_capture lines?
The option exists in the form of a checkbox when doing ViewCaptureToFile and it works, the issue is getting that to be the default or setting it to True from the script…
Thank you! This is exactly the example I was looking for! I was able to get it working without prompt using the code rs.Command('-_ViewCaptureToFile '+chr(34)+Result+i+'.png'+chr(34)+ ' _TransparentBackground=_Yes'' _Enter') in place of my original. I really appreciate the help!!!