Programming Reference for VirtualLab Fusion  2026.1
Loading...
Searching...
No Matches
VL_OpticalSetups Class Reference

This class provides methods for changing parameters of an Optical Setup (if you want to write your own parameter variation) and for working with Parameter Runs (if you want to vary parameters this way). More...

Static Public Member Functions

static List< string > GetAllResultNames (this ParameterRun parameterRun)
 Gets all result names which you can access with the methods GetParameterValues(Lightpath, string) and GetDocumentResults<T>(ParameterRun, out bool, string, string). Detector name and sub-detector name are separated by ParameterRunSupportFunctions.IdentificationStringSeparator (" || "). Only the first iteration is evaluated, thus this method does not work correctly if different iterations yield results for different sub-detectors.
 
static List< T?> GetDocumentResults< T > (this ParameterRun parameterRun, out bool areNullEntries, string partialDetectorName, string partialSubDetectorName="")
 Gets all document results of the first matching detector (and maybe sub-detector).
 
static List< PhysicalValueGetParameterValues (this Lightpath opticalSetup, string filterString)
 Gets the values of the specified parameters of this Optical Setup. To this end you specify strings which you can find for example in the Parameter Overview Table.
 
static List< PhysicalValueBase?> GetPhysicalValueResults (this ParameterRun parameterRun, string partialDetectorName, string partialSubDetectorName, bool searchVariedParametersFirst=false)
 Gets all physical value results of the first matching detector (and maybe sub-detector), including varied and coupled parameters.
 
static void SetParameterValue (this Lightpath opticalSetup, PhysicalValue valueToSet)
 Method to set a single value which was retrieved with the GetParameterValues(Lightpath, string) method and changed externally back to the Optical Setup.
 

Detailed Description

This class provides methods for changing parameters of an Optical Setup (if you want to write your own parameter variation) and for working with Parameter Runs (if you want to vary parameters this way).

Member Function Documentation

◆ GetAllResultNames()

static List< string > GetAllResultNames ( this ParameterRun parameterRun)
static

Gets all result names which you can access with the methods GetParameterValues(Lightpath, string) and GetDocumentResults<T>(ParameterRun, out bool, string, string). Detector name and sub-detector name are separated by ParameterRunSupportFunctions.IdentificationStringSeparator (" || "). Only the first iteration is evaluated, thus this method does not work correctly if different iterations yield results for different sub-detectors.

Parameters
parameterRunThe parameter run from which the results are retrieved.
Returns
A list with detector name and sub-detector name of all available results.
Exceptions
System.ArgumentExceptionParameter Run contains no results.

◆ GetDocumentResults< T >()

static List< T?> GetDocumentResults< T > ( this ParameterRun parameterRun,
out bool areNullEntries,
string partialDetectorName,
string partialSubDetectorName = "" )
static

Gets all document results of the first matching detector (and maybe sub-detector).

Template Parameters
TThe type of the detector results, e.g. DataArray2D.
Parameters
parameterRunThe parameter run from which the results are retrieved.
areNullEntriesReturns whether there are null entries.
partialDetectorNameA filter string to find the desired detector name. It can contain multiple words and word groups (marked by quotation marks) which must all be in the detector name. Can be empty if there is only one detector.
partialSubDetectorNameA filter string to find the desired sub-detector name. It can contain multiple words and word groups (marked by quotation marks) which must all be in the sub-detector name. Can be omitted if the specified detector returned only one document.
Returns
The list with the desired documents. A list with null entries if the detector results are not of the given type.
Exceptions
System.ArgumentExceptionParameter Run contains no results. or Matching detector could not be found. or No results for given detector. or Found results do not have the given type.
Type Constraints
T :class 
T :IDocument 

◆ GetParameterValues()

static List< PhysicalValue > GetParameterValues ( this Lightpath opticalSetup,
string filterString )
static

Gets the values of the specified parameters of this Optical Setup. To this end you specify strings which you can find for example in the Parameter Overview Table.

Parameters
opticalSetupThe optical setup from which the parameters are extracted. Note that for a Optical Setup variable e.g. named os, you can directly write os.GetParameterValues(…) without this parameter.
filterStringThe filter string. Can contain multiple words and word groups embraced by quotation marks, for example: "surface #1" scaling.
Returns
A list with all parameters containing all given words or word groups in their complete parameter name including object names and categories (if applicable). The matching is done case insensitive.
The parameters are given as PhysicalValue including also their current value.

◆ GetPhysicalValueResults()

static List< PhysicalValueBase?> GetPhysicalValueResults ( this ParameterRun parameterRun,
string partialDetectorName,
string partialSubDetectorName,
bool searchVariedParametersFirst = false )
static

Gets all physical value results of the first matching detector (and maybe sub-detector), including varied and coupled parameters.

Parameters
parameterRunThe parameter run from which the results are retrieved.
partialDetectorNameA filter string to find the desired detector name. It can contain multiple words and word groups (marked by quotation marks) which must all be in the detector name. Can be empty if there is only one detector. You can useParameterRunSupportFunctions.VariedParametersString to retrieve a certain varied parameter and CoupledParameterContainer.CoupledParametersString to retrieve a certain coupled parameter (if present).
partialSubDetectorNameA filter string to find the desired sub-detector name. It can contain multiple words and word groups (marked by quotation marks) which must all be in the sub-detector name.
searchVariedParametersFirstBy default, first the detector results are searched and then the varied (and maybe coupled) parameters. Set this optional parameter to true to change this behavior.
Returns
The list with the desired physical values (one entry for each iteration of the Parameter Run).
Exceptions
System.ArgumentExceptionParameter Run contains no results. or Matching detector could not be found. or No results for given detector. or Given detector does not yield physical values. or A matching sub-detector could not be found in the sub-detectors of the specified detector.

◆ SetParameterValue()

static void SetParameterValue ( this Lightpath opticalSetup,
PhysicalValue valueToSet )
static

Method to set a single value which was retrieved with the GetParameterValues(Lightpath, string) method and changed externally back to the Optical Setup.

Parameters
opticalSetupThe optical setup from which the parameters are extracted. Note that for a Optical Setup variable e.g. named os, you can directly write os.SetParameterValue(…) without this parameter.
valueToSetThe value to set. The comment must match the complete name of the parameter in the Optical Setup.
Exceptions
System.ArgumentExceptionComment of given value matches no parameter of the Optical Setup. or Comment of given value matches more than one parameter of the Optical Setup.