---
title: "V-Ray Script Access"
canonical: "https://documentation.chaos.com/space/VRHINO/116130923/V-Ray%20Script%20Access"
format: markdown
---
In V-Ray it is now possible to access the underlying scene plugins via the Rhino script tools.

A script access manual is provided with the installation of V-Ray. It can be found at the V-Ray for Rhino root folder ***C:\Program Files\Chaos\V-Ray\V-Ray for Rhinoceros\VRayForRhinoObjectModel.html***

> ℹ️ To use the V-Ray for Rhino wrapper module, add a new *Python Module Search* path pointing to *C:\Program Files\Chaos\V-Ray\V-Ray for Rhinoceros.*
> ℹ️ 
> ℹ️ Alternatively, copy the *rhVRay.py* and *rh8VRay.py* file* *from *C:\Program Files\Chaos\V-Ray\V-Ray for Rhinoceros* to *%APPDATA%\McNeel\Rhinoceros\7.0\scripts and %APPDATA%\McNeel\Rhinoceros\8.0\scripts.*


Due to the way V-Ray for Rhino communicates with its UI, certain "user data" parameters are employed while the actual scene parameters are set accordingly only at render time.

The precise names of such "user data" parameters can be found listed in exported V-Ray files:

- for Settings - export a .*vropt* file
- for Assets - export an asset of the required type as a .*vrmat* file

Their parameter handlers contain `isUserData="1"`.

To set a parameter value in the V-Ray UI via a script, the "user data" counterpart must be used. Otherwise, the change will only affect the V-Ray scene.


## **ParamTypes**

  
<span style="color: #000000">Enumeration</span>

| **Name** | **Value** | **Description** |
| --- | --- | --- |
| T_UNKNOWN | 0 | Undefined type. Generally an error |
| T_INTEGER | 1 | <span style="color: #000000">Standard long integer number</span> |
| T_FLOAT | 2 | Single precision floating-point number |
| T_STRING | 4 | Character string value |
| T_BOOL | 8 | Boolean value |
| T_TRANSFORM | 16 | Transformation value, consisting of a matrix and a vector. Equivalent to 12-element single-precision floating-point array |
| T_MATRIX | 32 | Matrix value. Equivalent to 9-element single-precision floating-point array |
| T_VECTOR | 64 | Vector value. Equivalent to 3-element single-precision floating-point array |
| T_COLOR | 128 | RGB float color value. Equivalent to 3-element single-precision floating-point array |
| T_ACOLOR | 256 | RGBA float color value. Equivalent to 4-element single-precision floating-point array |
| T_LIST | 32768 | Binary OR-ed with the other type indicates that the value is a list of values of that type |


---

## **RenderModes**

Enumeration

| **Property Name** | **Value** | **Description** |
| --- | --- | --- |
| RM_PRODUCTION | 0 | Renders in production mode |
| RM_INTERACTIVE | 1 | Renders in interactive mode |
| RM_CLOUD | 2 | Starts the current render job on the Cloud |
| RM_LAST | 3 | Repeats the last render |


---

## **RenderEngines**

Enumeration

| **Property Name** | **Value** | **Description** |
| --- | --- | --- |
| RE_CPU | 0 | Renders on the CPU |
| RE_CUDA | 1 | Renders on the GPU and/or CPU using CUDA |
| RE_RTX | 2 | Renders on the GPU using RTX Optix |


---

## **RhinoScriptComputeDeviceInfo**

A structure packing all details for a GPU compute device into a single block

|  |  |
| --- | --- |
| Property Name | Description |
| Name | The name of the device |
| UseForRendering | Specifies whether the device is to be used for rendering or not |


---

### **Name**

Name of the device


**Syntax:**

`BSTR` **Name**


**Examples:**

<details>
<summary>IronPython 2.7</summary>

`import rhVRay as vray`

`cudaDevices = vray.GetDeviceList(vray.RenderEngines.RE_CUDA)`  
`name = cudaDevices[0].Name`
</details>

<details>
<summary>CPython 3.9</summary>

`import rh8VRay as vray`

`cudaDevices = vray.GetDeviceList(vray.RenderEngines.RE_CUDA)`  
`name = cudaDevices[0].Name`
</details>

<details>
<summary>C# 9.0</summary>

`using VRayForRhino;`

`ComputeDeviceInfo[] cudaDevices = VRay.GetDeviceList(RenderEngines.CUDA).ToArray();`  
`string name = cudaDevices[0].Name;`
</details>

---

** **

**UseForRendering**

Specifies whether the device is to be used for rendering or not


**Syntax:**

`VARIANT_BOOL` **UseForRendering**


**Examples:**


<details>
<summary>IronPython 2.7</summary>

`import rhVRay as vray`

`cudaDevices = vray.GetDeviceList(vray.RenderEngines.RE_CUDA)`  
`use = cudaDevices[0].UseForRendering`
</details>

<details>
<summary>CPython 3.9</summary>

`import rh8VRay as vray`

`cudaDevices = vray.GetDeviceList(vray.RenderEngines.RE_CUDA)`  
`use = cudaDevices[0].UseForRendering`
</details>

<details>
<summary>C# 9.0</summary>

`using VRayForRhino;`

`ComputeDeviceInfo[] cudaDevices = VRay.GetDeviceList(RenderEngines.CUDA).ToArray();`  
`bool use = cudaDevices[0].UseForRendering;`
</details>


---

## **RhinoScriptSceneParam**

<span style="color: #000000"> </span>

Represents a reference to a NeUI plugin parameter

| **Property Name** | **Description** |
| --- | --- |
| Value | Gets or sets the value of the parameter. Must conform with the value type |
| Type | Returns the data type of the parameter. Can be OR-ed with ParamTypes::T_LIST |
| TypeAsString | Returns the data type of the parameter as a string |


### **Value**

<span style="color: #000000">Gets or sets the value of the parameter. Must conform with the value type</span>

<span style="color: #000000"> </span>

**Syntax**:

`VARIANT Value`


**Examples:**


<details>
<summary>IronPython 2.7</summary>

`import rhVRay as vray`

`with vray.Scene.Transaction() as t:`  
`    vray.Scene.SettingsOutput.img_width *= 2`
</details>

<details>
<summary>CPython 3.9</summary>

`import rh8VRay as vray`

`with vray.Scene.Transaction() as t:`  
`    vray.Scene.SettingsOutput.img_width *= 2`
</details>

<details>
<summary>C# 9.0</summary>

`using VRayForRhino;`

`using(Transaction t =  VRay.Scene.Transaction())`  
`{`  
`    Param img_width = VRay.Scene["SettingsOutput"].Param("img_width");`  
`    img_width.Value = (int)img_width.Value * 2;`  
`}`
</details>


---

### **Type**

Returns the data type of the parameter. Can be OR-ed with ParamTypes::T_LIST


**Syntax**:

`ParamTypes Type`


**Examples:**


<details>
<summary>IronPython 2.7</summary>

`import rhVRay as vray`  
`                    `  
`paramType = vray.Scene.SettingsOutput.Param("img_width").Type`
</details>

<details>
<summary>CPython 3.9</summary>

`import rh8VRay as vray`  
`                    `  
`paramType = vray.Scene.SettingsOutput.Param("img_width").Type`
</details>

<details>
<summary>C# 9.0</summary>

`using VRayForRhino;`  
`                    `  
`int paramType = VRay.Scene["SettingsOutput"].Param("img_width").Type`
</details>


---


### **TypeAsString**

Returns the data type of the parameter as string. 


**Syntax**:

`BSTR TypeAsString`


**Examples:**


<details>
<summary>IronPython 2.7</summary>

`import rhVRay as vray`  
`                    `  
`paramType = vray.Scene.SettingsOutput.Param("img_width").TypeAsString`
</details>

<details>
<summary>CPython 3.9</summary>

`import rh8VRay as vray`  
`                    `  
`paramType = vray.Scene.SettingsOutput.Param("img_width").TypeAsString`
</details>

<details>
<summary>C# 9.0</summary>

`using VRayForRhino;`  
`                    `  
`string paramType = VRay.Scene["SettingsOutput"].Param("img_width").TypeAsString`
</details>



---

## **RhinoScriptScenePlugin**

<span style="color: #000000"> </span>

<span style="color: #000000">Represents a reference to a NeUI plugin</span>

| **Property Name** | **Description** |
| --- | --- |
| Params | <span style="color: #000000">Returns an array of references to all parameters for the current plugin</span> |
| ParamNames | <span style="color: #000000">Returns an array of strings containing all parameter names in the current plugin</span> |
| Name | Returns the name of the plugin |
| Category | <span style="color: #000000">Returns the category of the plugin</span> |
| Type | <span style="color: #000000">Returns the type of the plugin</span> |



| **Method Name** | **Description** |
| --- | --- |
| Param | <span style="color: #000000">Returns a reference to a given plugin parameter</span> |

** **

---

### **Params**

<span style="color: #000000">Returns an array of references to all parameters for the current plugin</span>

<span style="color: #000000"> </span>

**Syntax:**

`VARIANT Params`


**Examples:**


<details>
<summary>IronPython 2.7</summary>

`import rhVRay as vray`

`params = vray.Scene.SettingsOutput.Params`
</details>

<details>
<summary>CPython 3.9</summary>

`import rh8VRay as vray`

`params = vray.Scene.SettingsOutput.Params`
</details>

<details>
<summary>C# 9.0</summary>

`using VRayForRhino;`

`Param[] prms = VRay.Scene["SettingsOutput"].Params.ToArray();`
</details>

** **

---


### **ParamNames**

<span style="color: #000000">Returns an array of strings of all parameter names in the current plugin</span>

<span style="color: #000000"> </span>

**Syntax:**

`VARIANR ParamNames`


**Examples:**


<details>
<summary>IronPython 2.7</summary>

`import rhVRay as vray`

`paramName = vray.Scene.SettingsOutput.ParamNames`
</details>

<details>
<summary>CPython 3.9</summary>

`import rh8VRay as vray`

`paramName = vray.Scene.SettingsOutput.ParamNames`
</details>

<details>
<summary>C# 9.0</summary>

`using VRayForRhino;`

`string[] paramNames = VRay.Scene["SettingsOutput"].ParamNames.ToArray();`
</details>

** **

---

###   
**Name**

Gets or sets the name of the plugin


**Syntax**:

`BSTR Name`


**Examples:**


<details>
<summary>IronPython 2.7</summary>

`import rhVRay as vray`

`pluginName = vray.Scene.SettingsOutput.Name`

`vray.Scene.SettingsOutput.Name = "New " + pluginName`
</details>

<details>
<summary>CPython 3.9</summary>

`import rh8VRay as vray`

`pluginName = vray.Scene.SettingsOutput.Name`

`vray.Scene.SettingsOutput.Name = "New " + pluginName`
</details>

<details>
<summary>C# 9.0</summary>

`using VRayForRhino;`

`string pluginName = VRay.Scene["SettingsOutput"].Name;`

`VRay.Scene["SettingsOutput"].Name = "New " + pluginName;`
</details>

** **

---


### **Category**

<span style="color: #000000">Returns the category of the plugin</span>

<span style="color: #000000"> </span>

**Syntax**:

`BSTR Category`


**Examples:**


<details>
<summary>IronPython 2.7</summary>

`import rhVRay as vray`

`pluginCategory = vray.Scene.SettingsOutput.Category`
</details>

<details>
<summary>CPython 3.9</summary>

`import rh8VRay as vray`

`pluginCategory = vray.Scene.SettingsOutput.Category`
</details>

<details>
<summary>C# 9.0</summary>

`using VRayForRhino;`

`string pluginCategory = VRay.Scene["SettingsOutput"].Category;`
</details>

** **

---


### **Type**

<span style="color: #000000">Returns the type of the plugin</span>  


**Syntax**:

`BSTR Type`


**Examples:**


<details>
<summary>IronPython 2.7</summary>

`import rhVRay as vray`

`pluginType = vray.Scene.SettingsOutput.Type`
</details>

<details>
<summary>CPython 3.9</summary>

`import rh8VRay as vray`

`pluginType = vray.Scene.SettingsOutput.Type`
</details>

<details>
<summary>C# 9.0</summary>

`using VRayForRhino;`

`string pluginType = VRay.Scene["SettingsOutput"].Type;`
</details>

** **

---


### **Param**

<span style="color: #000000">Returns a reference to a given plugin parameter</span>

<span style="color: #000000"> </span>

**Syntax**:

`RhinoScriptSceneParam *Param(`  
`[in, string] BSTR paramName`  
`)`


**Parameters**:<span style="color: #000000">** **</span>

`[in] BSTR paramName` : Name of the parameter to get**Return**:<span style="color: #000000">** **</span>

`RhinoScriptSceneParam`


**Examples:**


<details>
<summary>IronPython 2.7</summary>

`import rhVRay as vray`

`imgWidth = vray.Scene.SettingsOutput.Param("img_width")`
</details>

<details>
<summary>CPython 3.9</summary>

`import rh8VRay as vray`

`imgWidth = vray.Scene.SettingsOutput.Param("img_width")`
</details>

<details>
<summary>C# 9.0</summary>

`using VRayForRhino;`

`Param imgWidth = VRay.Scene["SettingsOutput"].Param("img_width");`
</details>


---


## **RhinoScriptScene**

<span style="color: #000000">Represents the NeUI scene</span>


| <span style="color: #000000">**Method Name**</span> | <span style="color: #000000">**Description**</span> |
| --- | --- |
| Plugins | <span style="color: #000000">Returns an array of references to all plugins in the scene</span> |
| PluginNames | <span style="color: #000000">Returns an array of strings of all plugin names in the scene</span> |

<span style="color: #000000"> </span>

| <span style="color: #000000">**Method Name**</span> | <span style="color: #000000">**Description**</span> |
| --- | --- |
| Plugin | Returns a reference to a given scene plugin |
| PluginFromObject | <span style="color: #000000">Returns a reference to a plugin that is linked to a Rhino model object, given by ID</span> |
| PluginsByType | Returns an array of references to all plugins of a given type in the scene |
| PluginsByCategory | Returns an array of references to all plugins of a given category in the scene |
| Refresh | Refreshes the NeUI window |
| Materials | Gets an array of all material plugins in the scene |
| Lights | Gets an array of all light plugins in the scene |
| Settings | Gets an array of all settings plugins in the scene |
| SpecialObjects | Gets an array of all special object plugins (proxies, clippers, furs and infinite planes) in the scene |
| LoadSettings | <span style="color: #000000">Loads a given .vropt file into the scene. The default file will be loaded on failure</span> |
| SaveSettings | Saves the current settings into a given .vropt file |
| BeginChange | <span style="color: #000000">Opens a transaction to modify the scene. Call EndChange() when done modifying the scene</span> |
| EndChange | Closes a scene modification transaction, previously opened by a call to BeginChange() |

 

---


### **Plugins**

<span style="color: #000000">Returns an array of references to all plugins in the scene</span>

<span style="color: #000000"> </span>

**Syntax:**

`VARIANT Plugins`


**Examples:**


<details>
<summary>IronPython 2.7</summary>

`import rhVRay as vray`

`plugins = vray.Scene.Plugins`
</details>

<details>
<summary>CPython 3.9</summary>

`import rh8VRay as vray`

`plugins = vray.Scene.Plugins`
</details>

<details>
<summary>C# 9.0</summary>

`using VRayForRhino;`

`Plugin[] plugins = VRay.Scene.Plugins.ToArray();`
</details>


---


### **PluginNames**

<span style="color: #000000">Returns an array of strings of all plugin names in the scene</span>

<span style="color: #000000"> </span>

**Syntax:**

`VARIANT PluginNames`


**Examples:**


<details>
<summary>IronPython 2.7</summary>

`import rhVRay as vray`

`plugins = vray.Scene.PluginNames`
</details>

<details>
<summary>CPython 3.9</summary>

`import rh8VRay as vray`

`plugins = vray.Scene.PluginNames`
</details>

<details>
<summary>C# 9.0</summary>

`using VRayForRhino;`

`string[] pluginNames = VRay.Scene.PluginNames.ToArray();`
</details>


---


### **Plugin**

<span style="color: #000000">Returns a reference to a given scene plugin</span>

  
**Syntax:**

`RhinoScriptScenePlugin* Plugin(`

`[in, string] const BSTR pluginName`  
`)`


**Parameters:**

[in] BSTR pluginName : `Name of the plugin to get`


**Return:**

`RhinoScriptScenePlugin`


**Examples:**


<details>
<summary>IronPython 2.7</summary>

`import  rhVRay as vray`

`settingsOutput = vray.Scene.Plugin("/SettingsOutput")`
</details>

<details>
<summary>CPython 3.9</summary>

`import  rh8VRay as vray`

`settingsOutput = vray.Scene.Plugin("/SettingsOutput")`
</details>

<details>
<summary>C# 9.0</summary>

`using VRayForRhino;`

`Plugin settingsOutput = vray.Scene.Plugin("/SettingsOutput");`
</details>


---


### **PluginFromObject**

Returns a reference to a plugin that is linked to an Rhino model object, given by ID


**Syntax**:

`VARIANT PluginFromObject(`

`[in, string] const BSTR id`  
`)`


**Parameters**:

`[in] BSTR id : Rhino model object id to query`


**Return**:

RhinoScriptScenePlugin


**Examples:**


<details>
<summary>IronPython 2.7</summary>

`import rhVRay as vray`

`vrayPlugin = vray.Scene.PluginFromObject("99dec31e-c736-4f7d-a98c-9dd321396344")`
</details>

<details>
<summary>CPython 3.9</summary>

`import rh8VRay as vray`

`vrayPlugin = vray.Scene.PluginFromObject("99dec31e-c736-4f7d-a98c-9dd321396344")`
</details>

<details>
<summary>C# 9.0</summary>

`using VRayForRhino;`

`Plugin vrayPlugin = VRay.Scene.PluginFromObject("99dec31e-c736-4f7d-a98c-9dd321396344");`
</details>


---


### **PluginsByType**

Returns an array of references to all plugins of a given type in the scene


**Syntax:**

`VARIANT PluginsByType(`  
`[in, string] const BSTR typeName`

`[in] VARIANT_BOOL onlyTopLevel`

`)`


**Parameters:**

`[in] BSTR typeName : `Name of the plugins Type  
  
`[in] VARIANT_BOOL onlyTopLevel : VARIANT_TRUE`<span style="color: #000000"> to consider only top-level plugins, or all plugins otherwise. </span>`VARIANT_TRUE`<span style="color: #000000"> by default</span>


**Return:**

`VARIANT array of RhinoScriptScenePlugin`  


**Examples:**


<details>
<summary>IronPython 2.7</summary>

`import rhVRay as vray`

`vrayMtlAssets = vray.Scene.PluginsByType("MtlSingleBRDF", True)`  
`vrayMtlAll = vray.Scene.PluginsByType("MtlSingleBRDF", False)`
</details>

<details>
<summary>CPython 3.9</summary>

`import rh8VRay as vray`

`vrayMtlAssets = vray.Scene.PluginsByType("MtlSingleBRDF", True)`  
`vrayMtlAll = vray.Scene.PluginsByType("MtlSingleBRDF", False)`
</details>

<details>
<summary>C# 9.0</summary>

`using VRayForRhino;`

`Plugin[] vrayMtlAssets = VRay.Scene.PluginsByType("MtlSingleBRDF", true).ToArray();`  
`Plugin[] vrayMtlAll = VRay.Scene.PluginsByType("MtlSingleBRDF", false).ToArray();`
</details>


---


### **PluginsByCategory**

<span style="color: #000000">Returns an array of references to all plugins of a given category in the scene</span>


**Syntax:**

`VARIANT PluginsByCategory(`  
`[in, string] const BSTR categoryName`  
`[in] VARIANT_BOOL onlyTopLevel`  
`)`

`Parameters:`

`[in] BSTR categoryName : `Name of the plugins type

`[in] VARIANT_BOOL onlyTopLevel : VARIANT_TRUE`<span style="color: #000000"> to consider only top-level plugins, or all plugins otherwise. </span>`VARIANT_TRUE`<span style="color: #000000"> by default</span>


**Return:**

`VARIANT array of RhinoScriptScenePlugin`  


**Examples:**


<details>
<summary>IronPython 2.7</summary>

`import rhVRay as vray`

`mtls = vray.Scene.PluginsByCategory("material", True)`  
`all_mtl_plugins = vray.Scene.PluginsByCategory("material", False)`
</details>

<details>
<summary>CPython 3.9</summary>

`import rh8VRay as vray`

`mtls = vray.Scene.PluginsByCategory("material", True)`  
`all_mtl_plugins = vray.Scene.PluginsByCategory("material", False)`
</details>

<details>
<summary>C# 9.0</summary>

`using VRayForRhino;`

`Plugin[] mtls = VRay.Scene.PluginsByCategory("material", true).ToArray();`  
`Plugin[] all_mtl_plugins = VRay.Scene.PluginsByCategory("material", false).ToArray();`
</details>


---


### Refresh

Refreshes the NeUI window


**Syntax:**

`void Refresh()`  


**Examples:**


<details>
<summary>IronPython 2.7</summary>

`import rhVRay as vray`

`vray.Scene.Refresh()`
</details>

<details>
<summary>CPython 3.9</summary>

`import rh8VRay as vray`

`vray.Scene.Refresh()`
</details>

<details>
<summary>C# 9.0</summary>

`using VRayForRhino;`

`VRay.Scene.Refresh();`
</details>


---


### **Materials**

Gets an array of all material plugins in the scene


**Syntax:**

`VARIANT Materials()`


**Return:**

`VARIANT array of RhinoScriptScenePlugin`  


**Examples:**


<details>
<summary>IronPython 2.7</summary>

`import rhVRay as vray`

`materials = vray.Scene.Materials`
</details>

<details>
<summary>CPython 3.9</summary>

`import rh8VRay as vray`

`materials = vray.Scene.Materials`
</details>

<details>
<summary>C# 9.0</summary>

`using VRayForRhino;`

`Plugin[] materials = VRay.Scene.Materials.ToArray();`
</details>


---


### **Lights**

Gets an array of all light plugins in the scene


**Syntax:**

`VARIANT Lights()`


**Return:**

`VARIANT array of RhinoScriptScenePlugin`  


**Examples:**


<details>
<summary>IronPython 2.7</summary>

`import rhVRay as vray`

`lights = vray.Scene.Lights`
</details>

<details>
<summary>CPython 3.9</summary>

`import rh8VRay as vray`

`lights = vray.Scene.Lights`
</details>

<details>
<summary>C# 9.0</summary>

`using VRayForRhino;`

`Plugin[] lights = VRay.Scene.Lights.ToArray();`
</details>

 

---


### Settings

Gets an array of all settings plugins in the scene


**Syntax:**

`VARIANT Settings()`

**Return:**

`VARIANT array of RhinoScriptScenePlugin`  


**Examples:**


<details>
<summary>IronPython 2.7</summary>

`import rhVRay as vray`

`settings = vray.Scene.Settings`
</details>

<details>
<summary>CPython 3.9</summary>

`import rh8VRay as vray`

`settings = vray.Scene.Settings`
</details>

<details>
<summary>C# 9.0</summary>

`using VRayForRhino;`

`Plugin[] settings = VRay.Scene.Settings.ToArray();`
</details>


---


### **SpecialObjects**

Gets an array of all special object plugins (proxies, clippers, furs and infinite planes) in the scene

** **

**Syntax:**

`VARIANT SpecialObjects()`

`Return:`

`VARIANT array of RhinoScriptScenePlugin`  


**Examples:**


<details>
<summary>IronPython 2.7</summary>

`import rhVRay as vray`

`specialObj = vray.Scene.SpecialObjects`
</details>

<details>
<summary>CPython 3.9</summary>

`import rh8VRay as vray`

`specialObj = vray.Scene.SpecialObjects`
</details>

<details>
<summary>C# 9.0</summary>

`using VRayForRhino;`

`Plugin[] specialObj = VRay.Scene.SpecialObjects.ToArray();`
</details>


---


### **LoadSettings**

Loads a given .vropt file into the scene. The default file will be loaded on failure

** **

**Syntax:**

`VARIANT_BOOL LoadSettings(`  
`[in, string] const BSTR fileName`  
`)`


**Parameters:**

`[in] BSTR fileName : Name of the file to load in`


**Return:**

None-zero if succeeded, zero if failed  


**Examples:**


<details>
<summary>IronPython 2.7</summary>

`import rhVRay as vray`

`success = vray.Scene.LoadSettings("Rhino Default.vropt")`
</details>

<details>
<summary>CPython 3.9</summary>

`import rh8VRay as vray`

`success = vray.Scene.LoadSettings("Rhino Default.vropt")`
</details>

<details>
<summary>C# 9.0</summary>

`using VRayForRhino;`

`bool success = VRay.Scene.LoadSettings("Rhino Default.vropt");`
</details>


---


### **SaveSettings**

Saves the current settings into a given .vropt file


**Syntax:**

`VARIANT_BOOL SaveSettings(`  
`[in, string] const BSTR fileName`  
`)`

**Parameters:**

`[in] BSTR fileName : Name of the file to write out`

**Return:**

None-zero if succeeded, zero if failed  


**Examples:**


<details>
<summary>IronPython 2.7</summary>

`import rhVRay as vray`

`success = vray.Scene.SaveSettings("settings.vropt")`
</details>

<details>
<summary>CPython 3.9</summary>

`import rh8VRay as vray`

`success = vray.Scene.SaveSettings("settings.vropt")`
</details>

<details>
<summary>C# 9.0</summary>

`using VRayForRhino;`

`bool success = VRay.Scene.SaveSettings("settings.vropt");`
</details>


---


### **BeginChange**

Opens a transaction to modify the scene. Call EndChange() when done modifying the scene


**Syntax:**

`void BeginChange()`


**Examples:**


<details>
<summary>IronPython 2.7</summary>

`import rhVRay as vray`

`vray.Scene.BeginChange()`  
`# scene modification statements`  
`vray.Scene.EndChange()`

`# or in a RAII-manner`  
`with vray.Scene.Transaction():`  
`    # scene modification statements.`  
`    # exiting the scope is equivalent to calling vray.Scene.EndChange()`
</details>

<details>
<summary>CPython 3.9</summary>

`import rh8VRay as vray`

`vray.Scene.BeginChange()`  
`# scene modification statements`  
`vray.Scene.EndChange()`

`# or in a RAII-manner`  
`with vray.Scene.Transaction():`  
`    # scene modification statements.`  
`    # exiting the scope is equivalent to calling vray.Scene.EndChange()`
</details>

<details>
<summary>C# 9.0</summary>

`using VRayForRhino;`

`VRay.Scene.BeginChange();`  
`// scene modification statements`  
`VRay.Scene.EndChange();`

`// or in a RAII-manner`  
`using(Transaction tr = VRay.Scene.Transaction())`  
`{`  
`    // scene modification statements.`  
`    // exiting the scope is equivalent to calling VRay.Scene.EndChange()`
</details>


---


### **EndChange**

Closes a scene modification transaction, previously opened by a call to BeginChange()


**Syntax:**

`void EndChange()`


**Examples:**


<details>
<summary>IronPython 2.7</summary>

`import rhVRay as vray`

`vray.Scene.BeginChange()`  
`    # scene modification statements`  
`vray.Scene.EndChange()`

`#or in a RAII-manner`  
`with vray.Scene.Transaction():`  
`    # scene modification statements.`  
`    # exiting the scope is equivalent to calling vray.Scene.EndChange()`
</details>

<details>
<summary>CPython 3.9</summary>

`import rh8VRay as vray`

`vray.Scene.BeginChange()`  
`    # scene modification statements`  
`vray.Scene.EndChange()`

`#or in a RAII-manner`  
`with vray.Scene.Transaction():`  
`    # scene modification statements.`  
`    # exiting the scope is equivalent to calling vray.Scene.EndChange()`
</details>

<details>
<summary>C# 9.0</summary>

`using VRayForRhino;`

`VRay.Scene.BeginChange();`  
`// scene modification statements`  
`VRay.Scene.EndChange();`

`// or in a RAII-manner`  
`using(Transaction tr = VRay.Scene.Transaction())`  
`{`  
`    // scene modification statements.`  
`    // exiting the scope is equivalent to calling VRay.Scene.EndChange()`
</details>


---


## **RhinoScriptObject**

Represents the NeUI scene


| **Property Name** | **Description** |
| --- | --- |
| Scene | Returns the currently active scene |
| Version | <span style="color: #000000">Returns the current plugin version</span> |
| VRayVersion | <span style="color: #000000">Returns the current V-Ray core version</span> |

| **Method Name** | **Description** |
| --- | --- |
| Render | <span style="color: #000000">Starts a V-Ray render</span> |
| CancelRender | Stops the current rendering process |
| RefreshUI | Refreshes the NeUI asset manager window |
| GetDeviceList | Returns the compute devices available on the machine for a given render mode |
| SetDeviceList | Sets a list of devices available on the machine, to be used for a given render mode |


---


### **Scene**

<span style="color: #000000">Returns the currently active scene</span>


**Syntax:**

`RhinoScriptScene* `**Scene**


**Examples:**


<details>
<summary>IronPython 2.7</summary>

`import rhVRay as vray`

`scene = vray.Scene`
</details>

<details>
<summary>CPython 3.9</summary>

`import rh8VRay as vray`

`scene = vray.Scene`
</details>

<details>
<summary>C# 9.0</summary>

`using VRayForRhino;`

`Scene scene = VRay.Scene;`
</details>


---


### **Version**

<span style="color: #000000">Returns the current plugin version</span>

<span style="color: #000000"> </span>

**Syntax:**

`int `**Version**


**Examples:**


<details>
<summary>IronPython 2.7</summary>

`import rhVRay as vray`

`version = vray.Version`
</details>

<details>
<summary>CPython 3.9</summary>

`import rh8VRay as vray`

`version = vray.Version`
</details>

<details>
<summary>C# 9.0</summary>

`using VRayForRhino;`

`int version = VRay.Version;`
</details>


---


### **VRayVersion**

<span style="color: #000000">Returns the current V-Ray core version</span>

<span style="color: #000000"> </span>

**Syntax: **

`int `**VRayVersion**


**Examples:**


<details>
<summary>IronPython 2.7</summary>

`import rhVRay as vray`

`vray_version = vray.VRayVersion`
</details>

<details>
<summary>CPython 3.9</summary>

`import rh8VRay as vray`

`vray_version = vray.VRayVersion`
</details>

<details>
<summary>C# 9.0</summary>

`using VRayForRhino;`

`int vray_version = VRay.VRayVersion;`
</details>


---


### **Render**

Starts a V-Ray render


**Syntax:**

`void Render(`  
`[in] RenderModes mode,`  
`[in] RenderEngines engine,`  
`[in] int timeout`  
`)`


**Parameters:**

[in] RenderModes mode: Specifies the mode the render job shall be executed in

[in] RenderEngines engine: Specifies the render engine to use for the current render job

[in] int timeout: Specifies whether the current render job shall be executed synchronously or asynchronously.  
Use -1 for syncrhonous renders, and >=0 for specific wait timeout in milliseconds


**Examples:**


<details>
<summary>IronPython 2.7</summary>

`import rhVRay as vray`

`vray.Render(0, 0, -1)`
</details>

<details>
<summary>CPython 3.9</summary>

`import rh8VRay as vray`

`vray.Render(0, 0, -1)`
</details>

<details>
<summary>C# 9.0</summary>

`using VRayForRhino;`

`VRay.Render(0, 0, -1);`
</details>


---


### **CancelRender**

Stops the current rendering process


**Syntax:**

`void CancelRender()`  


**Examples:**


<details>
<summary>IronPython 2.7</summary>

`import rhVRay as vray`

`vray.CancelRender()`
</details>

<details>
<summary>CPython 3.9</summary>

`import rh8VRay as vray`

`vray.CancelRender()`
</details>

<details>
<summary>C# 9.0</summary>

`using VRayForRhino;`

`VRay.CancelRender();`
</details>


---


### **RefreshUI**

Refreshes the NeUI asset manager window

  
**Syntax:**

`void RefreshUI()`


**Examples:**


<details>
<summary>IronPython 2.7</summary>

`import rhVRay as vray`

`vray.RefreshUI()`
</details>

<details>
<summary>CPython 3.9</summary>

`import rh8VRay as vray`

`vray.RefreshUI()`
</details>

<details>
<summary>C# 9.0</summary>

`using VRayForRhino;`

`VRay.RefreshUI();`
</details>


---


### **GetDeviceList**

Returns the compute devices available on the machine for a given render mode


**Syntax:**

`VARIANT`** GetDeviceList**(RenderEngines engine)


**Return:**

`VARIANT`


**Examples:**


<details>
<summary>IronPython 2.7</summary>

`import rhVRay as vray`

`cudaDevices = vray.GetDeviceList(vray.RenderEngines.RE_CUDA)`
</details>

<details>
<summary>CPython 3.9</summary>

`import rh8VRay as vray`

`cudaDevices = vray.GetDeviceList(vray.RenderEngines.RE_CUDA)`
</details>

<details>
<summary>C# 9.0</summary>

`using VRayForRhino;`

`ComputeDeviceInfo[] cudaDevices = VRay.GetDeviceList(RenderEngines.CUDA).ToArray();`
</details>


---


### **SetDeviceList**

Sets a list of devices available on the machine, to be used for a given render mode


**Syntax:**

`VARIANT_BOOL` **SetDeviceList**(RenderEngines engine, VARIANT ids)


**Return:**

`VARIANT_BOOL`


**Examples:**


<details>
<summary>IronPython 2.7</summary>

`import rhVRay as vray`

`success = vray.SetDeviceList(vray.RenderEngines.RE_CUDA, [0, 1])`
</details>

<details>
<summary>CPython 3.9</summary>

`import rh8VRay as vray`

`success = vray.SetDeviceList(vray.RenderEngines.RE_CUDA, [0, 1])`
</details>

<details>
<summary>C# 9.0</summary>

`using VRayForRhino;`

`bool success = VRay.SetDeviceList(RenderEngines.CUDA, new int[]{ 0, 1 });`
</details>


---


### **Render Quality**

<span style="color: #172b4d">Changes </span><span style="color: #172b4d">**the quality of the render from Low to High+.**</span>


**Examples:**


<details>
<summary>IronPython 2.7</summary>

`import rhVRay as vray`

`s = vray.Scene`  
`with s.Transaction() as t:`  
`    s.SettingsOptions.quality_preset = 4`
</details>

<details>
<summary>CPython 3.9</summary>

`import rh8VRay as vray`

`s = vray.Scene`  
`with s.Transaction() as t:`  
`    s.SettingsOptions.quality_preset = 4`
</details>

<details>
<summary>C# </summary>

`using VRayForRhino;`

`using(Transaction t = VRay.Scene.Transaction())`  
`{`  
`    VRay.Scene["SettingsOptions"].Param("quality_preset").Value = 4;`  
`}`
</details>


| **Value** | **Description** |
| --- | --- |
| 0 | Low |
| 1 | Low + |
| 2 | Medium |
| 3 | Medium + |
| 4 | High |
| 5 | High + |
| 6 | Custom (uses the last used quality value) |

> ℹ️ Other values use the last selected quality value.


---

### **Render Engine **

Sets Render Engine modes.


**Examples:**


<details>
<summary>IronPython 2.7</summary>

`import rhVRay as vray`

`s = vray.Scene`  
`with s.Transaction():`  
`    s.SettingsOptions.render_mode=4`
</details>

<details>
<summary>CPython 3.9</summary>

`import rh8VRay as vray`

`s = vray.Scene`  
`with s.Transaction():`  
`    s.SettingsOptions.render_mode=4`
</details>

<details>
<summary>C# </summary>

`using VRayForRhino;`

`using(Transaction t = VRay.Scene.Transaction())`  
`{`  
`    VRay.Scene["SettingsOptions"].Param("render_mode").Value = 4;`  
`}`
</details>


| **Value** | **Description** |
| --- | --- |
| -1 | RENDER_MODE_PRODUCTION |
| 0 | RENDER_MODE_INTERACTIVE |
| 4 | RENDER_MODE_INTERACTIVE_CUDA |
| 7 | RENDER_MODE_INTERACTIVE_OPTIX |
| 104 | RENDER_MODE_PRODUCTION_CUDA |
| 107 | RENDER_MODE_PRODUCTION_OPTIX |

## **Notes**

---

Note that for versions prior to V-Ray 7, the script access manual is located at: C:\Program Files\Chaos Group\V-Ray\V-Ray for Rhinoceros\VRayForRhinoObjectModel.html