    

 ## On this page

  

 

 # Example 08 - C# 

 Last update: 17.07.2025 

# <a class="anchor" id="ex08_s1"></a>C#

using System;

using [ZOSAPI](namespace_z_o_s_a_p_i.xhtml);

 

namespace CSharpStandaloneApplication1

{

 class CSharpStandalone_08_NSCEDetectorData

 {

 static void Main(string[] args)

 {

 // Find the installed version of OpticStudio

 bool isInitialized = ZOSAPI_NetHelper.ZOSAPI_Initializer.Initialize();

 // Note -- uncomment the following line to use a custom initialization path

 //bool isInitialized = ZOSAPI\_NetHelper.ZOSAPI\_Initializer.Initialize(@"C:\\Program Files\\OpticStudio\\");

 if (isInitialized)

 {

 LogInfo("Found OpticStudio at: " + ZOSAPI_NetHelper.ZOSAPI_Initializer.GetZemaxDirectory());

 }

 else

 {

 HandleError("Failed to locate OpticStudio!");

 return;

 }

 

 BeginStandaloneApplication();

 }

 

 static void BeginStandaloneApplication()

 {

 // Create the initial connection class

 [ZOSAPI\_Connection](class_z_o_s_a_p_i_1_1_z_o_s_a_p_i___connection.xhtml) TheConnection = new [ZOSAPI\_Connection](class_z_o_s_a_p_i_1_1_z_o_s_a_p_i___connection.xhtml)();

 

 // Attempt to create a Standalone connection

 [IZOSAPI\_Application](interface_z_o_s_a_p_i_1_1_i_z_o_s_a_p_i___application.xhtml) TheApplication = TheConnection.[CreateNewApplication](class_z_o_s_a_p_i_1_1_z_o_s_a_p_i___connection.xhtml#aadc54af7d7415a765592acf23d3a08ef)();

 if (TheApplication == null)

 {

 HandleError("An unknown connection error occurred!");

 return;

 }

 

 // Check the connection status

 if (!TheApplication.[IsValidLicenseForAPI](interface_z_o_s_a_p_i_1_1_i_z_o_s_a_p_i___application.xhtml#a5b8d6c216c668d13d6dcb870698c247f))

 {

 HandleError("Failed to connect to OpticStudio: " + TheApplication.[LicenseStatus](interface_z_o_s_a_p_i_1_1_i_z_o_s_a_p_i___application.xhtml#a95179eb8038b629caa12397723aacb3a));

 return;

 }

 if (TheApplication.[Mode](interface_z_o_s_a_p_i_1_1_i_z_o_s_a_p_i___application.xhtml#a8d2a89bafe9778c14f592276e5a5eb19) != [ZOSAPI\_Mode](namespace_z_o_s_a_p_i.xhtml#a254f5f6cb4ff37c2245b456b9bb79d2a).Server)

 {

 HandleError("User plugin was started in the wrong mode: expected Server, found " + TheApplication.[Mode](interface_z_o_s_a_p_i_1_1_i_z_o_s_a_p_i___application.xhtml#a8d2a89bafe9778c14f592276e5a5eb19).ToString());

 return;

 }

 

 [IOpticalSystem](interface_z_o_s_a_p_i_1_1_i_optical_system.xhtml) TheSystem = TheApplication.[PrimarySystem](interface_z_o_s_a_p_i_1_1_i_z_o_s_a_p_i___application.xhtml#aca8045fe84351622e0ee58814a2a3364);

 

 // Add your custom code here...

 /\* 

 -. load \\Samples\\NS\\Scattering\\ABg scattering surface.zos

 1. delete object 3(specular ray blocking)

 2. insert detector polar positioned at same pos as object 2

 - retrieve obj 2 rotation matrix, match orientation

 - size = 20

 - remove material from obj 4

 -. run ray trace

 3/4. Save/Load Detector Data

 5/6. get detector data for detector polar

 - retrieve single - value data with GetDetectorPolarData()

 - retrieve data grid(all pixels) with GetAllDetectorPolarDataSafe()

 7/8. get detector rectangle data

 - retrieve single - value data with GetDetectorData()

 - retrieve data grid(all pixels) with GetAllDetectorDataSafe()

 9/10. get coherent detector rectangle data

 - retrieve single-value data with GetCoherentData()

 - retrieve data grid (all pixels) with GetAllCoherentDataSafe()

 \*/

 

 string file = "\\\\Samples\\\\Non-sequential\\\\Scattering\\\\ABg scattering surface.zos";

 string DataDir = TheApplication.[ZemaxDataDir](interface_z_o_s_a_p_i_1_1_i_z_o_s_a_p_i___application.xhtml#a9064540f2c8b592b4acc58c3c096554c);

 string filepath = DataDir + file;

 TheSystem.[LoadFile](interface_z_o_s_a_p_i_1_1_i_optical_system.xhtml#a6eb1455ac53555ae6f30032d85b63735)(filepath, false);

 

 // creates new directory

 string strPath = System.IO.Path.Combine(TheApplication.[SamplesDir](interface_z_o_s_a_p_i_1_1_i_z_o_s_a_p_i___application.xhtml#ae8fc2a9409927955cc362f9262b052bb), @"API\\CS");

 System.IO.Directory.CreateDirectory(strPath);

 

 

 // delete unnecessary object from NSCE

 TheSystem.[NCE](interface_z_o_s_a_p_i_1_1_i_optical_system.xhtml#ab3cb797b606066a251c1aecd58e73f16).RemoveObjectAt(3);

 // Add detector polar, change radial size to 20mm

 [ZOSAPI.Editors.NCE.INCERow](interface_z_o_s_a_p_i_1_1_editors_1_1_n_c_e_1_1_i_n_c_e_row.xhtml) obj3 = TheSystem.[NCE](interface_z_o_s_a_p_i_1_1_i_optical_system.xhtml#ab3cb797b606066a251c1aecd58e73f16).InsertNewObjectAt(3);

 [ZOSAPI.Editors.NCE.IObjectTypeSettings](interface_z_o_s_a_p_i_1_1_editors_1_1_n_c_e_1_1_i_object_type_settings.xhtml) [DetectorPolar](namespace_z_o_s_a_p_i_1_1_editors_1_1_n_c_e.xhtml#afaeb02568d1df3bbfabfe7d8f9b59285a139b274362a21679f442de10127b25ca) = obj3.[GetObjectTypeSettings](interface_z_o_s_a_p_i_1_1_editors_1_1_n_c_e_1_1_i_n_c_e_row.xhtml#adc6a589b37811074cc08bdd6c3ef2804)([ZOSAPI](namespace_z_o_s_a_p_i.xhtml).[Editors](namespace_z_o_s_a_p_i_1_1_editors.xhtml).[NCE](namespace_z_o_s_a_p_i_1_1_editors_1_1_n_c_e.xhtml).ObjectType.DetectorPolar);

 obj3.[ChangeType](interface_z_o_s_a_p_i_1_1_editors_1_1_n_c_e_1_1_i_n_c_e_row.xhtml#a922f21c9a14d00066023074f68b04d12)(DetectorPolar);

 // Set the detector polar radial size to 20

 obj3.[GetCellAt](interface_z_o_s_a_p_i_1_1_editors_1_1_i_editor_row.xhtml#a6be57f761b7a17d997dc13c11eda45f9)(12).[DoubleValue](interface_z_o_s_a_p_i_1_1_editors_1_1_i_editor_cell.xhtml#a448d127a24d2dee490864d76b84f94ed) = 20; // cell 12 always corresponds to 'Par2' in the NSCE

 

 // Co-locate object 3 with object 2 (here, could alternatively use Ref Object flag)

 bool success = TheSystem.[NCE](interface_z_o_s_a_p_i_1_1_i_optical_system.xhtml#ab3cb797b606066a251c1aecd58e73f16).GetMatrix(2, out double R11, out double R12, out double R13, out double R21,

 out double R22, out double R23, out double R31, out double R32, out double R33, out double Xo,

 out double Yo, out double Zo);

 obj3.XPosition = Xo;

 obj3.YPosition = Yo;

 obj3.ZPosition = Zo;

 // Conversion from rotation matrix to tilts described in KBA "Rotation matrix and Tilt About X/Y/Z in OpticStudio"

 obj3.TiltAboutX = (180 / Math.PI) * Math.Atan2(-1 * R23, R33);

 obj3.TiltAboutY = (180 / Math.PI) * Math.Asin(R13);

 obj3.TiltAboutZ = (180 / Math.PI) * Math.Atan2(-1 * R12, R11);

 

 // remove ABSORB material from object 4

 TheSystem.[NCE](interface_z_o_s_a_p_i_1_1_i_optical_system.xhtml#ab3cb797b606066a251c1aecd58e73f16).GetObjectAt(4).Material = "";

 // Run ray trace

 [ZOSAPI.Tools.RayTrace.INSCRayTrace](interface_z_o_s_a_p_i_1_1_tools_1_1_ray_trace_1_1_i_n_s_c_ray_trace.xhtml) [RayTrace](namespace_z_o_s_a_p_i_1_1_analysis.xhtml#a0a5cf0f456b9510dd8070610bf696de7a143874eab0d95152e7ac0009deaefade) = TheSystem.[Tools](interface_z_o_s_a_p_i_1_1_i_optical_system.xhtml#add3e3631eadf7955b7b341179ff1eff8).OpenNSCRayTrace();

 [RayTrace](namespace_z_o_s_a_p_i_1_1_analysis.xhtml#a0a5cf0f456b9510dd8070610bf696de7a143874eab0d95152e7ac0009deaefade).ClearDetectors(0); // clear the old detector data!

 RayTrace.ScatterNSCRays = true;

 RayTrace.UsePolarization = false;

 RayTrace.SplitNSCRays = false;

 RayTrace.IgnoreErrors = true;

 [RayTrace](namespace_z_o_s_a_p_i_1_1_analysis.xhtml#a0a5cf0f456b9510dd8070610bf696de7a143874eab0d95152e7ac0009deaefade).RunAndWaitForCompletion();

 [RayTrace](namespace_z_o_s_a_p_i_1_1_analysis.xhtml#a0a5cf0f456b9510dd8070610bf696de7a143874eab0d95152e7ac0009deaefade).Close();

 

 // The next two steps are technically unnecessary in this case; since we just ran the ray trace,

 // the results are already there. But we demonstrate usage here anyways

 // Save detector data -- allows ray trace results to be loaded later

 // For detector polar, the file type is .DDP; for detector rectangle, it is .DDR

 string DetectorPolarFile = TheApplication.ZemaxDataDir + "\\\\Samples\\\\API\\\\CS\\\\detector3polar.DDP";

 string DetectorRectFile = TheApplication.ZemaxDataDir + "\\\\Samples\\\\API\\\\CS\\\\detector4rect.DDR";

 TheSystem.[NCE](interface_z_o_s_a_p_i_1_1_i_optical_system.xhtml#ab3cb797b606066a251c1aecd58e73f16).SaveDetector(3, DetectorPolarFile);

 TheSystem.[NCE](interface_z_o_s_a_p_i_1_1_i_optical_system.xhtml#ab3cb797b606066a251c1aecd58e73f16).SaveDetector(4, DetectorRectFile);

 

 // Load detector data -- for analyzing previous ray trace results

 // For detector polar, the file type is .DDP; for detector rectangle, it's .DDR

 TheSystem.[NCE](interface_z_o_s_a_p_i_1_1_i_optical_system.xhtml#ab3cb797b606066a251c1aecd58e73f16).LoadDetector(3, TheApplication.[ZemaxDataDir](interface_z_o_s_a_p_i_1_1_i_z_o_s_a_p_i___application.xhtml#a9064540f2c8b592b4acc58c3c096554c) + "\\\\Samples\\\\API\\\\CS\\\\detector3polar.DDP", false);

 TheSystem.[NCE](interface_z_o_s_a_p_i_1_1_i_optical_system.xhtml#ab3cb797b606066a251c1aecd58e73f16).LoadDetector(4, TheApplication.[ZemaxDataDir](interface_z_o_s_a_p_i_1_1_i_z_o_s_a_p_i___application.xhtml#a9064540f2c8b592b4acc58c3c096554c) + "\\\\Samples\\\\API\\\\CS\\\\detector4rect.DDR", false);

 

 // Here we read in the detector polar data from ZOS

 // GetPolarDetectorData() is very similar to the MF operand NSDP;

 // can retrieve RMS (degrees), total power, chromatricity, etc. (see NSDP in OpticStudio help)

 // Note: GetPolarDetectorData() uses an enumeration for data type, shown here

 [ZOSAPI.Editors.NCE.PolarDetectorDataType](namespace_z_o_s_a_p_i_1_1_editors_1_1_n_c_e.xhtml#af2e3d9a13b455eab749a70ec14b79b79) DataFlag_Power = [ZOSAPI](namespace_z_o_s_a_p_i.xhtml).[Editors](namespace_z_o_s_a_p_i_1_1_editors.xhtml).[NCE](namespace_z_o_s_a_p_i_1_1_editors_1_1_n_c_e.xhtml).PolarDetectorDataType.Power;

 [ZOSAPI.Editors.NCE.PolarDetectorDataType](namespace_z_o_s_a_p_i_1_1_editors_1_1_n_c_e.xhtml#af2e3d9a13b455eab749a70ec14b79b79) DataFlag_ChromX = [ZOSAPI](namespace_z_o_s_a_p_i.xhtml).[Editors](namespace_z_o_s_a_p_i_1_1_editors.xhtml).[NCE](namespace_z_o_s_a_p_i_1_1_editors_1_1_n_c_e.xhtml).PolarDetectorDataType.Cx;

 [ZOSAPI.Editors.NCE.PolarDetectorDataType](namespace_z_o_s_a_p_i_1_1_editors_1_1_n_c_e.xhtml#af2e3d9a13b455eab749a70ec14b79b79) DataFlag_ChromY = [ZOSAPI](namespace_z_o_s_a_p_i.xhtml).[Editors](namespace_z_o_s_a_p_i_1_1_editors.xhtml).[NCE](namespace_z_o_s_a_p_i_1_1_editors_1_1_n_c_e.xhtml).PolarDetectorDataType.Cy;

 success = TheSystem.[NCE](interface_z_o_s_a_p_i_1_1_i_optical_system.xhtml#ab3cb797b606066a251c1aecd58e73f16).GetPolarDetectorData(3, -4, DataFlag_Power, out double DetPolarData_RadialRMS); // obj=3, pix=-4, data=power enum

 success = TheSystem.[NCE](interface_z_o_s_a_p_i_1_1_i_optical_system.xhtml#ab3cb797b606066a251c1aecd58e73f16).GetPolarDetectorData(3, 0, DataFlag_ChromX, out double DetPolarData_ChromX); // obj=3, pix=0, data=chromaticityX enum

 success = TheSystem.[NCE](interface_z_o_s_a_p_i_1_1_i_optical_system.xhtml#ab3cb797b606066a251c1aecd58e73f16).GetPolarDetectorData(3, 0, DataFlag_ChromY, out double DetPolarData_ChromY); // obj=3, pix=0, data=chromaticityY enum

 

 // To retrieve the entire data array (power, tristim. X/Y/Z, etc. for each pixel) 

 // can use GetAllPolarDetectorDataSafe(), or GetAllPolarDetectorData().

 // Note: GetPolarDetectorData use an enumeration for data type, shown here

 [ZOSAPI.Editors.NCE.PolarDetectorDataType](namespace_z_o_s_a_p_i_1_1_editors_1_1_n_c_e.xhtml#af2e3d9a13b455eab749a70ec14b79b79) DataFlag_TriX = [ZOSAPI](namespace_z_o_s_a_p_i.xhtml).[Editors](namespace_z_o_s_a_p_i_1_1_editors.xhtml).[NCE](namespace_z_o_s_a_p_i_1_1_editors_1_1_n_c_e.xhtml).PolarDetectorDataType.TriX;

 [ZOSAPI.Editors.NCE.PolarDetectorDataType](namespace_z_o_s_a_p_i_1_1_editors_1_1_n_c_e.xhtml#af2e3d9a13b455eab749a70ec14b79b79) DataFlag_TriY = [ZOSAPI](namespace_z_o_s_a_p_i.xhtml).[Editors](namespace_z_o_s_a_p_i_1_1_editors.xhtml).[NCE](namespace_z_o_s_a_p_i_1_1_editors_1_1_n_c_e.xhtml).PolarDetectorDataType.TriY;

 [ZOSAPI.Editors.NCE.PolarDetectorDataType](namespace_z_o_s_a_p_i_1_1_editors_1_1_n_c_e.xhtml#af2e3d9a13b455eab749a70ec14b79b79) DataFlag_TriZ = [ZOSAPI](namespace_z_o_s_a_p_i.xhtml).[Editors](namespace_z_o_s_a_p_i_1_1_editors.xhtml).[NCE](namespace_z_o_s_a_p_i_1_1_editors_1_1_n_c_e.xhtml).PolarDetectorDataType.TriZ;

 // now, retrieve the pixel data array

 double[,] DetPolarData_TriX = TheSystem.[NCE](interface_z_o_s_a_p_i_1_1_i_optical_system.xhtml#ab3cb797b606066a251c1aecd58e73f16).GetAllPolarDetectorDataSafe(3, DataFlag_TriX);

 double[,] DetPolarData_TriY = TheSystem.[NCE](interface_z_o_s_a_p_i_1_1_i_optical_system.xhtml#ab3cb797b606066a251c1aecd58e73f16).GetAllPolarDetectorDataSafe(3, DataFlag_TriY);

 double[,] DetPolarData_TriZ = TheSystem.[NCE](interface_z_o_s_a_p_i_1_1_i_optical_system.xhtml#ab3cb797b606066a251c1aecd58e73f16).GetAllPolarDetectorDataSafe(3, DataFlag_TriZ);

 

 // Here we read in the detector rectangle data

 // GetDetectorData() is very similar to the Merit Function operand NSDD

 // can retrieve Std Dev, # of rays, total power, etc.; data calculated over whole detector or individual pixel

 TheSystem.[NCE](interface_z_o_s_a_p_i_1_1_i_optical_system.xhtml#ab3cb797b606066a251c1aecd58e73f16).GetDetectorData(4, -4, 0, out double DetRectangleData_StdDev); // obj=4, pix=-4, data=0

 

 // To retrieve the entire data array (flux, flux/area, etc.) for all pixel data,

 // can use GetAllDetectorDataSafe() or GetAllDetectorData().

 // The 'Data' inputs for these functions (parameter 2) can be found in the API syntax help,

 // under the listing for GetDetectorData. 

 double[,] DetRectangleData_Flux = TheSystem.[NCE](interface_z_o_s_a_p_i_1_1_i_optical_system.xhtml#ab3cb797b606066a251c1aecd58e73f16).GetAllDetectorDataSafe(4, 0); // total flux on each pixel

 double[,] DetRectangleData_FluxArea = TheSystem.[NCE](interface_z_o_s_a_p_i_1_1_i_optical_system.xhtml#ab3cb797b606066a251c1aecd58e73f16).GetAllDetectorDataSafe(4, 1); // flux/area on each pixel

 double[,] DetRectangleData_FluxSAP = TheSystem.[NCE](interface_z_o_s_a_p_i_1_1_i_optical_system.xhtml#ab3cb797b606066a251c1aecd58e73f16).GetAllDetectorDataSafe(4, 2); // flux/solid angle on each pixel

 

 // Finally, let's read coherent data.

 // The coherent data is meaningless in this example, but it serves to demonstrate API usage and functionality.

 // Read in the detector rectangle coherent data

 // GetCoherentData() is very similar to the operand NSDC

 // Can retrieve real, imaginary, amplitude, power, with 'data' input

 // for pix = 0, get sum on detector; pix &gt; 0 gives single pixel data

 TheSystem.[NCE](interface_z_o_s_a_p_i_1_1_i_optical_system.xhtml#ab3cb797b606066a251c1aecd58e73f16).GetCoherentData(4, 0, [ZOSAPI](namespace_z_o_s_a_p_i.xhtml).[Editors](namespace_z_o_s_a_p_i_1_1_editors.xhtml).[NCE](namespace_z_o_s_a_p_i_1_1_editors_1_1_n_c_e.xhtml).DetectorDataType.Amplitude, out double DetRectangle_CoherentAmp); // obj=4, pix=0, data=2

 TheSystem.[NCE](interface_z_o_s_a_p_i_1_1_i_optical_system.xhtml#ab3cb797b606066a251c1aecd58e73f16).GetCoherentData(4, 0, [ZOSAPI](namespace_z_o_s_a_p_i.xhtml).[Editors](namespace_z_o_s_a_p_i_1_1_editors.xhtml).[NCE](namespace_z_o_s_a_p_i_1_1_editors_1_1_n_c_e.xhtml).DetectorDataType.Power, out double DetRectangle_CoherentPower); // obj=4, pix=0, data=3

 

 // Retrieve whole data array with GetAllCoherentDataSafe(), or GetAllCoherentData(). 

 // The 'Data' input functions similarly to NSDC(real, imaginary, amplitude, power)

 // Note: divide coherent power by pixel area to get coherent irradiance

 double[,] DetRectangle_CoherentPowerFull = TheSystem.[NCE](interface_z_o_s_a_p_i_1_1_i_optical_system.xhtml#ab3cb797b606066a251c1aecd58e73f16).GetAllCoherentDataSafe(4, [ZOSAPI](namespace_z_o_s_a_p_i.xhtml).[Editors](namespace_z_o_s_a_p_i_1_1_editors.xhtml).[NCE](namespace_z_o_s_a_p_i_1_1_editors_1_1_n_c_e.xhtml).DetectorDataType.Power); // obj=4, data=3

 

 string OutFile = DataDir + "\\\\Samples\\\\API\\\\CS\\\\CS\_08\_NSCEDetectorData.zos";

 TheSystem.[SaveAs](interface_z_o_s_a_p_i_1_1_i_optical_system.xhtml#a32d2f472d9a6d3277f3cda76afb6d85d)(OutFile);

 

 // from here, we can plot or analyze any detector data we want!

 

 // Clean up

 FinishStandaloneApplication(TheApplication);

 }

 

 static void FinishStandaloneApplication([IZOSAPI\_Application](interface_z_o_s_a_p_i_1_1_i_z_o_s_a_p_i___application.xhtml) TheApplication)

 {

 // Note - TheApplication will close automatically when this application exits, so this isn't strictly necessary in most cases

 if (TheApplication != null)

 {

 TheApplication.[CloseApplication](interface_z_o_s_a_p_i_1_1_i_z_o_s_a_p_i___application.xhtml#ab662a3cc1b97d8632a324b1137fa943b)();

 }

 }

 

 static void LogInfo(string message)

 {

 // TODO - add custom logging

 Console.WriteLine(message);

 }

 

 static void HandleError(string errorMessage)

 {

 // TODO - add custom error handling

 throw new Exception(errorMessage);

 }

 

 }

}

[ZOSAPI.ZOSAPI\_Connection](class_z_o_s_a_p_i_1_1_z_o_s_a_p_i___connection.xhtml)

**Definition:** ZemaxService.cs:198



[ZOSAPI.ZOSAPI\_Connection.CreateNewApplication](class_z_o_s_a_p_i_1_1_z_o_s_a_p_i___connection.xhtml#aadc54af7d7415a765592acf23d3a08ef)

IZOSAPI_Application CreateNewApplication()

Attempts to launch a new instance of Optic Studio in 'headless' mode. Note that although the Optic St...

**Definition:** ZemaxService.cs:864



[ZOSAPI.Editors.IEditorCell.DoubleValue](interface_z_o_s_a_p_i_1_1_editors_1_1_i_editor_cell.xhtml#a448d127a24d2dee490864d76b84f94ed)

double DoubleValue

Gets or sets the double precision value of this cell. Note that if DataType is not CellDataType....

**Definition:** InterfacesEditors.cs:340



[ZOSAPI.Editors.IEditorRow.GetCellAt](interface_z_o_s_a_p_i_1_1_editors_1_1_i_editor_row.xhtml#a6be57f761b7a17d997dc13c11eda45f9)

IEditorCell GetCellAt(int pos)

Gets the cell at the specified index (IEditor.MinColumn to IEditor.MaxColumn).



[ZOSAPI.Editors.NCE.INCERow](interface_z_o_s_a_p_i_1_1_editors_1_1_n_c_e_1_1_i_n_c_e_row.xhtml)

All data for a Non-Sequential Component Editor object. This interface can be accessed via the INonSeq...

**Definition:** InterfacesNCE.cs:1198



[ZOSAPI.Editors.NCE.INCERow.ChangeType](interface_z_o_s_a_p_i_1_1_editors_1_1_n_c_e_1_1_i_n_c_e_row.xhtml#a922f21c9a14d00066023074f68b04d12)

bool ChangeType(IObjectTypeSettings settings)

Changes the current object to the specified type. Use GetObjectTypeSettings to get the relevant setti...



[ZOSAPI.Editors.NCE.INCERow.GetObjectTypeSettings](interface_z_o_s_a_p_i_1_1_editors_1_1_n_c_e_1_1_i_n_c_e_row.xhtml#adc6a589b37811074cc08bdd6c3ef2804)

IObjectTypeSettings GetObjectTypeSettings(ObjectType type)

Create the settings for the specified type. Use this method to specify any extra data required to cha...



[ZOSAPI.Editors.NCE.IObjectTypeSettings](interface_z_o_s_a_p_i_1_1_editors_1_1_n_c_e_1_1_i_object_type_settings.xhtml)

This interface is used for selecting any files required by a object, and for changing object types....

**Definition:** InterfacesNCE.cs:1110



[ZOSAPI.IOpticalSystem](interface_z_o_s_a_p_i_1_1_i_optical_system.xhtml)

Represent a complete optical system. A IOpticalSystem corresponds to a single .ZMX file....

**Definition:** Interfaces.cs:687



[ZOSAPI.IOpticalSystem.SaveAs](interface_z_o_s_a_p_i_1_1_i_optical_system.xhtml#a32d2f472d9a6d3277f3cda76afb6d85d)

void SaveAs(string fileName)

Saves the current system to the specified file. All future calls to Save will use the same file.



[ZOSAPI.IOpticalSystem.LoadFile](interface_z_o_s_a_p_i_1_1_i_optical_system.xhtml#a6eb1455ac53555ae6f30032d85b63735)

bool LoadFile(string LensFile, bool saveIfNeeded)

Replaces the current system with data from the specified file.



[ZOSAPI.IOpticalSystem.NCE](interface_z_o_s_a_p_i_1_1_i_optical_system.xhtml#ab3cb797b606066a251c1aecd58e73f16)

INonSeqEditor NCE

Gets the non-sequential component editor.

**Definition:** Interfaces.cs:884



[ZOSAPI.IOpticalSystem.Tools](interface_z_o_s_a_p_i_1_1_i_optical_system.xhtml#add3e3631eadf7955b7b341179ff1eff8)

IOpticalSystemTools Tools

Gets an interface used to run various tools on the optical system.

**Definition:** Interfaces.cs:932



[ZOSAPI.IZOSAPI\_Application](interface_z_o_s_a_p_i_1_1_i_z_o_s_a_p_i___application.xhtml)

This interface contains all information about the current ZOS-API connection, as well as methods for ...

**Definition:** Interfaces.cs:261



[ZOSAPI.IZOSAPI\_Application.IsValidLicenseForAPI](interface_z_o_s_a_p_i_1_1_i_z_o_s_a_p_i___application.xhtml#a5b8d6c216c668d13d6dcb870698c247f)

bool IsValidLicenseForAPI

Gets a value indicating whether this the API is currently useable.

**Definition:** Interfaces.cs:287



[ZOSAPI.IZOSAPI\_Application.Mode](interface_z_o_s_a_p_i_1_1_i_z_o_s_a_p_i___application.xhtml#a8d2a89bafe9778c14f592276e5a5eb19)

ZOSAPI_Mode Mode

Gets the current connetion mode. Use this to check if Optic Studio is expecting a user operand / anal...

**Definition:** Interfaces.cs:306



[ZOSAPI.IZOSAPI\_Application.ZemaxDataDir](interface_z_o_s_a_p_i_1_1_i_z_o_s_a_p_i___application.xhtml#a9064540f2c8b592b4acc58c3c096554c)

string ZemaxDataDir

Gets the full path for the current user's Zemax directory (in the My Documents\Zemax\ folder by defau...

**Definition:** Interfaces.cs:524



[ZOSAPI.IZOSAPI\_Application.LicenseStatus](interface_z_o_s_a_p_i_1_1_i_z_o_s_a_p_i___application.xhtml#a95179eb8038b629caa12397723aacb3a)

LicenseStatusType LicenseStatus

Gets the license status. Note that this displays the license edition if successful,...

**Definition:** Interfaces.cs:280



[ZOSAPI.IZOSAPI\_Application.CloseApplication](interface_z_o_s_a_p_i_1_1_i_z_o_s_a_p_i___application.xhtml#ab662a3cc1b97d8632a324b1137fa943b)

void CloseApplication()

Shut down the Optic Studio process.



[ZOSAPI.IZOSAPI\_Application.PrimarySystem](interface_z_o_s_a_p_i_1_1_i_z_o_s_a_p_i___application.xhtml#aca8045fe84351622e0ee58814a2a3364)

IOpticalSystem PrimarySystem

Gets the primary system. When Mode is ZOSAPI_Mode.Server, this will initially be an empty sequential ...

**Definition:** Interfaces.cs:328



[ZOSAPI.IZOSAPI\_Application.SamplesDir](interface_z_o_s_a_p_i_1_1_i_z_o_s_a_p_i___application.xhtml#ae8fc2a9409927955cc362f9262b052bb)

string SamplesDir

Gets the full path for the current user's samples directory (in the My Documents\Zemax\Samples\ folde...

**Definition:** Interfaces.cs:505



[ZOSAPI.Tools.RayTrace.INSCRayTrace](interface_z_o_s_a_p_i_1_1_tools_1_1_ray_trace_1_1_i_n_s_c_ray_trace.xhtml)

Interfaces and methods for running a non-sequential ray trace. This interface can be accessed via the...

**Definition:** RayTrace.cs:45



[ZOSAPI.Analysis.AnalysisIDM.RayTrace](namespace_z_o_s_a_p_i_1_1_analysis.xhtml#a0a5cf0f456b9510dd8070610bf696de7a143874eab0d95152e7ac0009deaefade)

@ RayTrace

Single Ray Trace.



[ZOSAPI.Editors.NCE](namespace_z_o_s_a_p_i_1_1_editors_1_1_n_c_e.xhtml)

**Definition:** InterfacesNCE.cs:19



[ZOSAPI.Editors.NCE.PolarDetectorDataType](namespace_z_o_s_a_p_i_1_1_editors_1_1_n_c_e.xhtml#af2e3d9a13b455eab749a70ec14b79b79)

PolarDetectorDataType

**Definition:** InterfacesNCE.cs:262



[ZOSAPI.Editors.NCE.ObjectType.DetectorPolar](namespace_z_o_s_a_p_i_1_1_editors_1_1_n_c_e.xhtml#afaeb02568d1df3bbfabfe7d8f9b59285a139b274362a21679f442de10127b25ca)

@ DetectorPolar



[ZOSAPI.Editors](namespace_z_o_s_a_p_i_1_1_editors.xhtml)

**Definition:** InterfacesEditors.cs:12



[ZOSAPI](namespace_z_o_s_a_p_i.xhtml)

The ZOSAPI namespace contains classes for initially connecting to zemax. See also ZOSAPI_Connection,...

**Definition:** IAS_FieldCurvatureAndDistortion.cs:5



[ZOSAPI.ZOSAPI\_Mode](namespace_z_o_s_a_p_i.xhtml#a254f5f6cb4ff37c2245b456b9bb79d2a)

ZOSAPI_Mode

**Definition:** Interfaces.cs:77