Hi, I want to create a new (black) environment and set it as active for all channels, do some view capturing and set the old values back, but I can not figure out how to do so.
I have gotten to the point where I am to sett the different environment channels, but there I am at a loss:
import Rhino
import scriptcontext as sc
import System
import rhinoscriptsyntax as rs
color = rs.coercecolor((0,0,0))
sim = Rhino.Render.SimulatedEnvironment()
sim.BackgroundColor = color
env = Rhino.Render.RenderEnvironment.NewBasicEnvironment(sim)
env.Name = "My_environment"
print (env.Name)
index = sc.doc.RenderEnvironments.Add(env)
if index == True:
print (env.Id)
# Set for all environment channels
Oh, you also want to change render settings so you can set background, reflection and skylight environments. I have some code I use in a huge regression testing script where I set these. Let me dreg that up from the depths of my storage.
Sweet, thanks, I should be good to go from there then. This stuff is getting more and more complex for an novice to handle, but better for the users so I guess we should be happy
Here a script with which I generate several hairs short of 1000 tests with different environment options. In this script I do import existing environments, but what you should look at is how to change the document render settings to set background, reflection and skylight environments. This happens in prepare_model method from line 266 onward in regression.py, specifically between lines 305 and 334, replicated here for convenience: