How to set background to solid color mode use RhinoScript

hi, could any one help me?
we know we can set the background to solid color mode in rhino window, the setting page shows below:

then my question is: how to set background to solid color mode use RhinoScript VB codes?

What you’re showing is the page concerning render options. Are you trying to set the Render background to a specific color or the general viewport background default color in Options>Appearance>Colors>Background?

–Mitch

i am trying to set the render background to “solid color” mode, like the red area shows in the picture above.

The following macro will set that render background color:

-DocumentProperties Render Background BackgroundColor 230,230,230 enter enter enter

To embed that in a rhino script, you can use the Rhino.Command syntax.

I don’t actually know how to do this in vb Rhinoscript as neither the -dash command line interface nor the vb Rhinoscript interface address this setting in exactly the same way. It is possible to set the render background to a solid specific color either by macroing the -DocumentProperties string as Wim did, or by using Rhino.RenderColor (1, Array(r,g,b))

But that does not quite address the document properties checkbox setting directly. You can address the checkbox setting directly via Python/RhinoCommon however:

import Rhino
import scriptcontext as sc
solid_color=Rhino.Display.BackgroundStyle.SolidColor
sc.doc.RenderSettings.BackgroundStyle=solid_color

HTH, --Mitch

1 Like

Hi wim, thank you very much for your kindly help, seems it works now. and seems the command should be like the one below:

Call Rhino.Command("-DocumentProperties R B B 255,255,255 enter enter enter", False)

thank you Helvetosaur.

after change to another computer and re-run again,the issue still happen. no matter we use the command “Call Rhino.Command(”-DocumentProperties R B B 255,255,255 enter enter enter", False)" or the command " rhRenderBackgroundColor_old = Rhino.RenderColor(rhRenderBackgroundColor, vbWhite)", this issue still there. we can find that the background color of “front view”, “top view”, “right view” can be changed to white, but the “perspective view” background color will never change. after look into this issue, i found it was related to setup of OpenGL, if we select the first item, this issue happen, if we don’t select this item, this issue disappeared, I think this is a bug need Rhino5.0.

If things work on one PC but not on another without turning off hardware acceleration first it probably means that there are issues with the GPU on that second PC. It looks like the driver is from March 2014. You could try to update the driver and see if that solves things.