ZOSAPI.Tools.RayTrace.INSCRayTrace Interface Reference
Last update: 17.07.2025Interfaces and methods for running a non-sequential ray trace. This interface can be accessed via the IOpticalSystemTools interface. NOTE - due to architectural limitations, currently only one INSCRayTrace instance can be used at a time, across all IOpticalSystem instances. The first call to IOpticalSystemTools.OpenNSCRayTrace will succeed, while all further calls will return null until the the single INSCRayTrace instance is closed. It is anticipated that this limiation will be removed in future versions of the API.
More...

Public Member Functions | |
| ErrorType | ClearDetectors (int DetectorNumber) |
| Clears the specified detectors. | |
| ErrorType | ClearDetectorObject (int ObjectNumber) |
| Clears the detector data on the specified object. | |
| double | GetTotalRayEnergy () |
| void | SetRandomSeed (int seed) |
| Usually the NSC Ray Trace uses a new random seed each time it is run. This function allows the user to explicitly set the random seed that is used, in order to trace a reproducible set of rays. | |
| void | ResetRandomSeed () |
| Clear any previously set random seed, so that each new ray trace uses a new random seed value. | |
| void | SetPartialRTMode (int seed, int group) |
| bool | EstimateHPCTime () |
Public Member Functions inherited from ZOSAPI.Tools.ISystemTool | |
| bool | Run () |
| Start the tool. Note that for synchronous tools (see IsAsynchronous), this call will block until completion. If it is asynchronous it will start running but return immediately. | |
| bool | RunAndWaitForCompletion () |
| Sames as calling Run followed by WaitForCompletion. | |
| bool | WaitForCompletion () |
| Waits for the asynchronous tool to complete. | |
| bool | Cancel () |
| Cancels the currently running asynchronous tool. | |
| bool | Close () |
| Closes this tool and frees up and associated resources. | |
| RunStatus | WaitWithTimeout (double timeOutSeconds) |
| Waits for the currently running tool to complete, with a specified time out value. Note that if the timeout is exceeded this method will return, however the tool will continue to run. Also note that this method will not start the tool running if it is not already. | |
| RunStatus | RunAndWaitWithTimeout (double timeOutSeconds) |
| Starts the tool running, and waits for it to complete with the specified timeout value. Note that if the timeout is exceeded this method will return, however the tool will continue to run. | |
Properties | |
| bool | AutoUpdate [get, set] |
| int | NumberOfCores [get, set] |
| bool | UsePolarization [get, set] |
| bool | IgnoreErrors [get, set] |
| bool | SplitNSCRays [get, set] |
| bool | ScatterNSCRays [get, set] |
| bool | SaveRays [get, set] |
| string | SaveRaysFile [get, set] |
Gets or sets the save rays filename (only used when SaveRays is true). | |
| bool | SavePaths [get, set] |
| string | SavePathsFile [get, set] |
Gets or sets the save rays filename (only used when SavePaths is true). | |
| ZRDFormatType | ZRDFormat [get, set] |
| string | Filter [get, set] |
| double | DeadRayErrors [get] |
| double | DeadRayThreshold [get] |
| bool | IsHPCEnabled [get] |
| double | HPCEstimatedTimeS [get] |
| double | HPCRemainingTimeS [get] |
| double | HPCTimeToStartS [get] |
| int | HPCQueuePosition [get] |
| HPCRunState | HPCState [get] |
| bool | HPCHasTimeEstimate [get] |
| double | RayMultiplier [get, set] |
| bool | HasHPCUnsupportedDetectors [get] |
Properties inherited from ZOSAPI.Tools.ISystemTool | |
| int | Progress [get] |
| Gets the progress of the current tool, if supported. | |
| string | Status [get] |
| Gets the status of the current tool, if supporoted. | |
| bool | IsRunning [get] |
| Gets a value indicating whether the tool is currently running asynchronously. | |
| bool | CanCancel [get] |
| Gets a value indicating whether the tool can be cancelled. | |
| bool | IsAsynchronous [get] |
| Gets a value indicating whether the tool runs asynchronously (i.e. on a thread). | |
| bool | IsFiniteDuration [get] |
| Gets a value indicating whether this tool will complete on its own. | |
| bool | IsValid [get] |
| Gets a value indicating whether the input settings are valid. | |
| bool | Succeeded [get] |
| Gets a value indicating whether the tool execution succeeded. | |
| string | ErrorMessage [get] |
If Succeeded is false, get the error messages; otherwise, null. | |
Detailed Description
Interfaces and methods for running a non-sequential ray trace. This interface can be accessed via the IOpticalSystemTools interface. NOTE - due to architectural limitations, currently only one INSCRayTrace instance can be used at a time, across all IOpticalSystem instances. The first call to IOpticalSystemTools.OpenNSCRayTrace will succeed, while all further calls will return null until the the single INSCRayTrace instance is closed. It is anticipated that this limiation will be removed in future versions of the API.
Usage (see Example 17 for a full sample)
C#
C++
Matlab
Python
- Examples
- CSharpStandalone_02_NSC_ray_trace.cs, CSharpStandalone_05_Read_ZRD_File.cs, CSharpStandalone_06_nsc_phase.cs, CSharpStandalone_08_NSCEDetectorData.cs, CSharpStandalone_10_NSC_ZRD_filter_string.cs, CSharpStandalone_17_NSC_BulkScatter.cs, CSharpStandalone_21_White_LED_Phosphor.cs, CSharpStandalone_24_nsc_detectors.cs, and CSharpStandalone_25_source_spectrum_diffraction_grating.cs.
Member Function Documentation
◆ ClearDetectorObject()
| ErrorType ZOSAPI.Tools.RayTrace.INSCRayTrace.ClearDetectorObject | ( | int | ObjectNumber | ) |
Clears the detector data on the specified object.
- Parameters
-
ObjectNumber object number of the detector to clear. Use 0for all detectors.
◆ ClearDetectors()
| ErrorType ZOSAPI.Tools.RayTrace.INSCRayTrace.ClearDetectors | ( | int | DetectorNumber | ) |
Clears the specified detectors.
Usage (see Example 02 for a full sample)
C#
C++
Matlab
Python
- Parameters
-
DetectorNumber number of the detector to clear. Use 0for all detectors. Note that detector number 1 is the first object that functions as a detector, not object number 1. To clear a specific object, use ClearDetectorObject.///
- Examples
- CSharpStandalone_05_Read_ZRD_File.cs, CSharpStandalone_06_nsc_phase.cs, CSharpStandalone_10_NSC_ZRD_filter_string.cs, CSharpStandalone_17_NSC_BulkScatter.cs, CSharpStandalone_21_White_LED_Phosphor.cs, CSharpStandalone_24_nsc_detectors.cs, and CSharpStandalone_25_source_spectrum_diffraction_grating.cs.
◆ EstimateHPCTime()
| bool ZOSAPI.Tools.RayTrace.INSCRayTrace.EstimateHPCTime | ( | ) |
◆ GetTotalRayEnergy()
| double ZOSAPI.Tools.RayTrace.INSCRayTrace.GetTotalRayEnergy | ( | ) |
◆ ResetRandomSeed()
| void ZOSAPI.Tools.RayTrace.INSCRayTrace.ResetRandomSeed | ( | ) |
Clear any previously set random seed, so that each new ray trace uses a new random seed value.
◆ SetPartialRTMode()
| void ZOSAPI.Tools.RayTrace.INSCRayTrace.SetPartialRTMode | ( | int | seed, |
| int | group | ||
| ) |
◆ SetRandomSeed()
| void ZOSAPI.Tools.RayTrace.INSCRayTrace.SetRandomSeed | ( | int | seed | ) |
Usually the NSC Ray Trace uses a new random seed each time it is run. This function allows the user to explicitly set the random seed that is used, in order to trace a reproducible set of rays.
- Parameters
-
seed Any non-zero seed value
Property Documentation
◆ AutoUpdate
|
getset |
◆ DeadRayErrors
|
get |
◆ DeadRayThreshold
|
get |
◆ Filter
|
getset |
◆ HasHPCUnsupportedDetectors
|
get |
◆ HPCEstimatedTimeS
|
get |
◆ HPCHasTimeEstimate
|
get |
◆ HPCQueuePosition
|
get |
◆ HPCRemainingTimeS
|
get |
◆ HPCState
|
get |
◆ HPCTimeToStartS
|
get |
◆ IgnoreErrors
|
getset |
Usage (see Example 02 for a full sample)
C#
C++
Matlab
Python
◆ IsHPCEnabled
|
get |
◆ NumberOfCores
|
getset |
◆ RayMultiplier
|
getset |
◆ SavePaths
|
getset |
◆ SavePathsFile
|
getset |
Gets or sets the save rays filename (only used when SavePaths is true).
The save paths filename. Note - only the file name will be used, not any path information; it will be saved in the directory of the lens file.
◆ SaveRays
|
getset |
Usage (see Example 06 for a full sample)
C#
C++
Matlab
Python
◆ SaveRaysFile
|
getset |
Gets or sets the save rays filename (only used when SaveRays is true).
The save rays filename. Note - only the file name will be used, not any path information; it will be saved in the directory of the lens file.
◆ ScatterNSCRays
|
getset |
◆ SplitNSCRays
|
getset |
◆ UsePolarization
|
getset |
◆ ZRDFormat
|
getset |
Public Member Functions inherited from