    

 ## On this page

  

 

 # Example 24 - C# 

 Last update: 16.07.2025 

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

using System;

using [ZOSAPI](namespace_z_o_s_a_p_i.xhtml);

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

 

namespace CSharpStandaloneApplication

{

 class Program

 {

 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);

 

 // 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);

 

 // Set up primary optical system

 TheSystem = TheApplication.[CreateNewSystem](interface_z_o_s_a_p_i_1_1_i_z_o_s_a_p_i___application.xhtml#a024aef7880a5ba49d60db78b9b9140b5)([ZOSAPI](namespace_z_o_s_a_p_i.xhtml).SystemType.NonSequential);

 TheSystem.[SystemData](interface_z_o_s_a_p_i_1_1_i_optical_system.xhtml#a4c4e9771e9ea51766885fdd6fb6627f5).MaterialCatalogs.AddCatalog("Schott");

 string sampleDir = TheApplication.[SamplesDir](interface_z_o_s_a_p_i_1_1_i_z_o_s_a_p_i___application.xhtml#ae8fc2a9409927955cc362f9262b052bb);

 

 // Initializes NCE and loads surfaces

 // Inserts objects

 [ZOSAPI.Editors.NCE.INonSeqEditor](interface_z_o_s_a_p_i_1_1_editors_1_1_n_c_e_1_1_i_non_seq_editor.xhtml) TheNCE = TheSystem.[NCE](interface_z_o_s_a_p_i_1_1_i_optical_system.xhtml#ab3cb797b606066a251c1aecd58e73f16);

 for (int a = 1; a &lt;= 4; a++) TheNCE.[InsertNewObjectAt](interface_z_o_s_a_p_i_1_1_editors_1_1_n_c_e_1_1_i_non_seq_editor.xhtml#a93d23b9aeba9b67ea2d4690e09c64457)(a);

 

 // Gets reference to specific object

 [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) o1 = TheNCE.[GetObjectAt](interface_z_o_s_a_p_i_1_1_editors_1_1_n_c_e_1_1_i_non_seq_editor.xhtml#a4788d547c88f21153f0d2da623c3c9ec)(1);

 [INCERow](interface_z_o_s_a_p_i_1_1_editors_1_1_n_c_e_1_1_i_n_c_e_row.xhtml) o2 = TheNCE.[GetObjectAt](interface_z_o_s_a_p_i_1_1_editors_1_1_n_c_e_1_1_i_non_seq_editor.xhtml#a4788d547c88f21153f0d2da623c3c9ec)(2);

 [INCERow](interface_z_o_s_a_p_i_1_1_editors_1_1_n_c_e_1_1_i_n_c_e_row.xhtml) o3 = TheNCE.[GetObjectAt](interface_z_o_s_a_p_i_1_1_editors_1_1_n_c_e_1_1_i_non_seq_editor.xhtml#a4788d547c88f21153f0d2da623c3c9ec)(3);

 [INCERow](interface_z_o_s_a_p_i_1_1_editors_1_1_n_c_e_1_1_i_n_c_e_row.xhtml) o4 = TheNCE.[GetObjectAt](interface_z_o_s_a_p_i_1_1_editors_1_1_n_c_e_1_1_i_non_seq_editor.xhtml#a4788d547c88f21153f0d2da623c3c9ec)(4);

 [INCERow](interface_z_o_s_a_p_i_1_1_editors_1_1_n_c_e_1_1_i_n_c_e_row.xhtml) o5 = TheNCE.[GetObjectAt](interface_z_o_s_a_p_i_1_1_editors_1_1_n_c_e_1_1_i_non_seq_editor.xhtml#a4788d547c88f21153f0d2da623c3c9ec)(5);

 

 // Changes Object Type

 TheNCE.[GetObjectAt](interface_z_o_s_a_p_i_1_1_editors_1_1_n_c_e_1_1_i_non_seq_editor.xhtml#a4788d547c88f21153f0d2da623c3c9ec)(1).[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)(o1.[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.SourceEllipse));

 o2.[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)(o2.[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.AsphericSurface2));

 o3.[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)(o3.[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.StandardLens));

 o4.[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)(o4.[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.DetectorColor));

 o5.[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)(o5.[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.DetectorRectangle));

 

 // Sets positions &amp; materials

 TheNCE.[GetObjectAt](interface_z_o_s_a_p_i_1_1_editors_1_1_n_c_e_1_1_i_non_seq_editor.xhtml#a4788d547c88f21153f0d2da623c3c9ec)(2).[XPosition](interface_z_o_s_a_p_i_1_1_editors_1_1_n_c_e_1_1_i_n_c_e_row.xhtml#a5365f428fb628c9ed2721772c3d7b4db) = 1.5;

 TheNCE.[GetObjectAt](interface_z_o_s_a_p_i_1_1_editors_1_1_n_c_e_1_1_i_non_seq_editor.xhtml#a4788d547c88f21153f0d2da623c3c9ec)(2).[ZPosition](interface_z_o_s_a_p_i_1_1_editors_1_1_n_c_e_1_1_i_n_c_e_row.xhtml#a45ef55e0f47af115659ba5bed47c0f9f) = 9.99;

 TheNCE.[GetObjectAt](interface_z_o_s_a_p_i_1_1_editors_1_1_n_c_e_1_1_i_non_seq_editor.xhtml#a4788d547c88f21153f0d2da623c3c9ec)(2).[Material](interface_z_o_s_a_p_i_1_1_editors_1_1_n_c_e_1_1_i_n_c_e_row.xhtml#a680d0180c89f0eee5669e868ad5e92b8) = "ABSORB";

 o3.YPosition = 1.5;

 o3.ZPosition = 8.99;

 o3.Material = "N-BK7";

 o4.ZPosition = 10;

 o5.RefObject = 4;

 o5.ZPosition = 1e-3;

 

 // Sets layout rays based on parameter number

 TheNCE.[GetObjectAt](interface_z_o_s_a_p_i_1_1_editors_1_1_n_c_e_1_1_i_non_seq_editor.xhtml#a4788d547c88f21153f0d2da623c3c9ec)(1).[GetObjectCell](interface_z_o_s_a_p_i_1_1_editors_1_1_n_c_e_1_1_i_n_c_e_row.xhtml#ad712fcba162df362928283b6e00b3840)([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).ObjectColumn.Par1).[IntegerValue](interface_z_o_s_a_p_i_1_1_editors_1_1_i_editor_cell.xhtml#ae449d1e2d9af965fc6cec60f2a9334ce) = 100;

 // Sets analysis rays based on object data column

 [ZOSAPI.Editors.NCE.IObjectSourceEllipse](interface_z_o_s_a_p_i_1_1_editors_1_1_n_c_e_1_1_i_object_source_ellipse.xhtml) sourcedata = o1.ObjectData as [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).[IObjectSourceEllipse](interface_z_o_s_a_p_i_1_1_editors_1_1_n_c_e_1_1_i_object_source_ellipse.xhtml);

 sourcedata.NumberOfAnalysisRays = (int)1E6;

 o1.[GetObjectCell](interface_z_o_s_a_p_i_1_1_editors_1_1_n_c_e_1_1_i_n_c_e_row.xhtml#ad712fcba162df362928283b6e00b3840)([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).ObjectColumn.Par10).[DoubleValue](interface_z_o_s_a_p_i_1_1_editors_1_1_i_editor_cell.xhtml#a448d127a24d2dee490864d76b84f94ed) = 50;

 o1.[GetObjectCell](interface_z_o_s_a_p_i_1_1_editors_1_1_n_c_e_1_1_i_n_c_e_row.xhtml#ad712fcba162df362928283b6e00b3840)([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).ObjectColumn.Par11).[DoubleValue](interface_z_o_s_a_p_i_1_1_editors_1_1_i_editor_cell.xhtml#a448d127a24d2dee490864d76b84f94ed) = 50;

 

 o2.[GetObjectCell](interface_z_o_s_a_p_i_1_1_editors_1_1_n_c_e_1_1_i_n_c_e_row.xhtml#ad712fcba162df362928283b6e00b3840)([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).ObjectColumn.Par3).[DoubleValue](interface_z_o_s_a_p_i_1_1_editors_1_1_i_editor_cell.xhtml#a448d127a24d2dee490864d76b84f94ed) = 0.5;

 o2.[GetObjectCell](interface_z_o_s_a_p_i_1_1_editors_1_1_n_c_e_1_1_i_n_c_e_row.xhtml#ad712fcba162df362928283b6e00b3840)([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).ObjectColumn.Par4).[DoubleValue](interface_z_o_s_a_p_i_1_1_editors_1_1_i_editor_cell.xhtml#a448d127a24d2dee490864d76b84f94ed) = 1;

 o2.[GetObjectCell](interface_z_o_s_a_p_i_1_1_editors_1_1_n_c_e_1_1_i_n_c_e_row.xhtml#ad712fcba162df362928283b6e00b3840)([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).ObjectColumn.Par9).[IntegerValue](interface_z_o_s_a_p_i_1_1_editors_1_1_i_editor_cell.xhtml#ae449d1e2d9af965fc6cec60f2a9334ce) = 1;

 

 o4.[GetObjectCell](interface_z_o_s_a_p_i_1_1_editors_1_1_n_c_e_1_1_i_n_c_e_row.xhtml#ad712fcba162df362928283b6e00b3840)([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).ObjectColumn.Par1).[DoubleValue](interface_z_o_s_a_p_i_1_1_editors_1_1_i_editor_cell.xhtml#a448d127a24d2dee490864d76b84f94ed) = 8.223;

 o4.[GetObjectCell](interface_z_o_s_a_p_i_1_1_editors_1_1_n_c_e_1_1_i_n_c_e_row.xhtml#ad712fcba162df362928283b6e00b3840)([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).ObjectColumn.Par2).[DoubleValue](interface_z_o_s_a_p_i_1_1_editors_1_1_i_editor_cell.xhtml#a448d127a24d2dee490864d76b84f94ed) = 2.565;

 o4.[GetObjectCell](interface_z_o_s_a_p_i_1_1_editors_1_1_n_c_e_1_1_i_n_c_e_row.xhtml#ad712fcba162df362928283b6e00b3840)([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).ObjectColumn.Par3).[IntegerValue](interface_z_o_s_a_p_i_1_1_editors_1_1_i_editor_cell.xhtml#ae449d1e2d9af965fc6cec60f2a9334ce) = 200;

 o4.[GetObjectCell](interface_z_o_s_a_p_i_1_1_editors_1_1_n_c_e_1_1_i_n_c_e_row.xhtml#ad712fcba162df362928283b6e00b3840)([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).ObjectColumn.Par4).[IntegerValue](interface_z_o_s_a_p_i_1_1_editors_1_1_i_editor_cell.xhtml#ae449d1e2d9af965fc6cec60f2a9334ce) = 150;

 

 double o5_x = 10.0;

 double o5_y = 12.23;

 o5.[GetObjectCell](interface_z_o_s_a_p_i_1_1_editors_1_1_n_c_e_1_1_i_n_c_e_row.xhtml#ad712fcba162df362928283b6e00b3840)([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).ObjectColumn.Par1).[DoubleValue](interface_z_o_s_a_p_i_1_1_editors_1_1_i_editor_cell.xhtml#a448d127a24d2dee490864d76b84f94ed) = o5_x;

 o5.[GetObjectCell](interface_z_o_s_a_p_i_1_1_editors_1_1_n_c_e_1_1_i_n_c_e_row.xhtml#ad712fcba162df362928283b6e00b3840)([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).ObjectColumn.Par2).[DoubleValue](interface_z_o_s_a_p_i_1_1_editors_1_1_i_editor_cell.xhtml#a448d127a24d2dee490864d76b84f94ed) = o5_y;

 o5.[GetObjectCell](interface_z_o_s_a_p_i_1_1_editors_1_1_n_c_e_1_1_i_n_c_e_row.xhtml#ad712fcba162df362928283b6e00b3840)([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).ObjectColumn.Par3).[IntegerValue](interface_z_o_s_a_p_i_1_1_editors_1_1_i_editor_cell.xhtml#ae449d1e2d9af965fc6cec60f2a9334ce) = 100;

 o5.[GetObjectCell](interface_z_o_s_a_p_i_1_1_editors_1_1_n_c_e_1_1_i_n_c_e_row.xhtml#ad712fcba162df362928283b6e00b3840)([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).ObjectColumn.Par4).[IntegerValue](interface_z_o_s_a_p_i_1_1_editors_1_1_i_editor_cell.xhtml#ae449d1e2d9af965fc6cec60f2a9334ce) = 100;

 

 // Changes face type and coating properties

 TheNCE.[GetObjectAt](interface_z_o_s_a_p_i_1_1_editors_1_1_n_c_e_1_1_i_non_seq_editor.xhtml#a4788d547c88f21153f0d2da623c3c9ec)(3).[CoatScatterData](interface_z_o_s_a_p_i_1_1_editors_1_1_n_c_e_1_1_i_n_c_e_row.xhtml#a6dd470918d3d56195aecf4994eef560c).[GetFaceData](interface_z_o_s_a_p_i_1_1_editors_1_1_n_c_e_1_1_i_n_c_e_coat_scatter_data.xhtml#a784337a7b51eb6c4b283972986aa8039)(0).[FaceIs](interface_z_o_s_a_p_i_1_1_editors_1_1_n_c_e_1_1_i_n_c_e_coat_scatter_face_data.xhtml#a7ecc4bc5b1e69305b9e4085b22347914) = [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).FaceIsType.Absorbing;

 TheNCE.[GetObjectAt](interface_z_o_s_a_p_i_1_1_editors_1_1_n_c_e_1_1_i_non_seq_editor.xhtml#a4788d547c88f21153f0d2da623c3c9ec)(3).[CoatScatterData](interface_z_o_s_a_p_i_1_1_editors_1_1_n_c_e_1_1_i_n_c_e_row.xhtml#a6dd470918d3d56195aecf4994eef560c).[GetFaceData](interface_z_o_s_a_p_i_1_1_editors_1_1_n_c_e_1_1_i_n_c_e_coat_scatter_data.xhtml#a784337a7b51eb6c4b283972986aa8039)(1).[FaceIs](interface_z_o_s_a_p_i_1_1_editors_1_1_n_c_e_1_1_i_n_c_e_coat_scatter_face_data.xhtml#a7ecc4bc5b1e69305b9e4085b22347914) = [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).FaceIsType.ObjectDefault;

 TheNCE.[GetObjectAt](interface_z_o_s_a_p_i_1_1_editors_1_1_n_c_e_1_1_i_non_seq_editor.xhtml#a4788d547c88f21153f0d2da623c3c9ec)(3).[CoatScatterData](interface_z_o_s_a_p_i_1_1_editors_1_1_n_c_e_1_1_i_n_c_e_row.xhtml#a6dd470918d3d56195aecf4994eef560c).[GetFaceData](interface_z_o_s_a_p_i_1_1_editors_1_1_n_c_e_1_1_i_n_c_e_coat_scatter_data.xhtml#a784337a7b51eb6c4b283972986aa8039)(1).[Coating](interface_z_o_s_a_p_i_1_1_editors_1_1_n_c_e_1_1_i_n_c_e_coat_scatter_face_data.xhtml#ac3b2d7eaf1d4d95a8254349caebea43d) = "I.50";

 

 // changes scatter profile on face

 [ZOSAPI.Editors.NCE.IObjectScatteringSettings](interface_z_o_s_a_p_i_1_1_editors_1_1_n_c_e_1_1_i_object_scattering_settings.xhtml) o3_Scatter = TheNCE.[GetObjectAt](interface_z_o_s_a_p_i_1_1_editors_1_1_n_c_e_1_1_i_non_seq_editor.xhtml#a4788d547c88f21153f0d2da623c3c9ec)(3).[CoatScatterData](interface_z_o_s_a_p_i_1_1_editors_1_1_n_c_e_1_1_i_n_c_e_row.xhtml#a6dd470918d3d56195aecf4994eef560c).[GetFaceData](interface_z_o_s_a_p_i_1_1_editors_1_1_n_c_e_1_1_i_n_c_e_coat_scatter_data.xhtml#a784337a7b51eb6c4b283972986aa8039)(2).[CreateScatterModelSettings](interface_z_o_s_a_p_i_1_1_editors_1_1_n_c_e_1_1_i_n_c_e_coat_scatter_face_data.xhtml#aab27c8591e3674cede79490a9561efee)([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).ObjectScatteringTypes.Lambertian);

 o3_Scatter._S_Lambertian.ScatterFraction = 0.5;

 TheNCE.[GetObjectAt](interface_z_o_s_a_p_i_1_1_editors_1_1_n_c_e_1_1_i_non_seq_editor.xhtml#a4788d547c88f21153f0d2da623c3c9ec)(3).[CoatScatterData](interface_z_o_s_a_p_i_1_1_editors_1_1_n_c_e_1_1_i_n_c_e_row.xhtml#a6dd470918d3d56195aecf4994eef560c).[GetFaceData](interface_z_o_s_a_p_i_1_1_editors_1_1_n_c_e_1_1_i_n_c_e_coat_scatter_data.xhtml#a784337a7b51eb6c4b283972986aa8039)(2).[ChangeScatterModelSettings](interface_z_o_s_a_p_i_1_1_editors_1_1_n_c_e_1_1_i_n_c_e_coat_scatter_face_data.xhtml#aa11035827e3fe36d04a7da7c142dc6a7)(o3_Scatter);

 TheNCE.[GetObjectAt](interface_z_o_s_a_p_i_1_1_editors_1_1_n_c_e_1_1_i_non_seq_editor.xhtml#a4788d547c88f21153f0d2da623c3c9ec)(3).[CoatScatterData](interface_z_o_s_a_p_i_1_1_editors_1_1_n_c_e_1_1_i_n_c_e_row.xhtml#a6dd470918d3d56195aecf4994eef560c).[GetFaceData](interface_z_o_s_a_p_i_1_1_editors_1_1_n_c_e_1_1_i_n_c_e_coat_scatter_data.xhtml#a784337a7b51eb6c4b283972986aa8039)(2).[NumberOfRays](interface_z_o_s_a_p_i_1_1_editors_1_1_n_c_e_1_1_i_n_c_e_coat_scatter_face_data.xhtml#a6dbb88bb5802a119a890aaa4e6f9572a) = 2;

 

 // Removes pixel interpolation for the detector

 o4.TypeData.UsePixelInterpolation = false;

 

 // Setup and run the 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) NSCRayTrace = TheSystem.[Tools](interface_z_o_s_a_p_i_1_1_i_optical_system.xhtml#add3e3631eadf7955b7b341179ff1eff8).OpenNSCRayTrace();

 NSCRayTrace.SplitNSCRays = false;

 NSCRayTrace.ScatterNSCRays = true;

 NSCRayTrace.UsePolarization = false;

 NSCRayTrace.IgnoreErrors = true;

 NSCRayTrace.SaveRays = false;

 NSCRayTrace.[ClearDetectors](interface_z_o_s_a_p_i_1_1_tools_1_1_ray_trace_1_1_i_n_s_c_ray_trace.xhtml#a4b118fa79a1c9056ded4d08c34549914)(0);

 

 NSCRayTrace.[RunAndWaitForCompletion](interface_z_o_s_a_p_i_1_1_tools_1_1_i_system_tool.xhtml#a26d8cae18772fd31c1d18525a3b8d9ac)();

 NSCRayTrace.[Close](interface_z_o_s_a_p_i_1_1_tools_1_1_i_system_tool.xhtml#a5bfa126385b9d0c5619b1aff9a354d31)();

 

 

 

 // Reads in values from NCE for detector settings

 int obj = 4;

 double x_half = TheSystem.[NCE](interface_z_o_s_a_p_i_1_1_i_optical_system.xhtml#ab3cb797b606066a251c1aecd58e73f16).GetObjectAt(obj).GetObjectCell([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).ObjectColumn.Par1).DoubleValue;

 double y_half = TheSystem.[NCE](interface_z_o_s_a_p_i_1_1_i_optical_system.xhtml#ab3cb797b606066a251c1aecd58e73f16).GetObjectAt(obj).GetObjectCell([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).ObjectColumn.Par2).DoubleValue;

 double x_pixels = (double)TheSystem.[NCE](interface_z_o_s_a_p_i_1_1_i_optical_system.xhtml#ab3cb797b606066a251c1aecd58e73f16).GetObjectAt(obj).GetObjectCell([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).ObjectColumn.Par3).IntegerValue;

 double y_pixels = (double)TheSystem.[NCE](interface_z_o_s_a_p_i_1_1_i_optical_system.xhtml#ab3cb797b606066a251c1aecd58e73f16).GetObjectAt(obj).GetObjectCell([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).ObjectColumn.Par4).IntegerValue;

 

 // Creates a new detector viewer analysis reference

 [ZOSAPI.Analysis.IA\_](interface_z_o_s_a_p_i_1_1_analysis_1_1_i_a__.xhtml) d4 = TheSystem.[Analyses](interface_z_o_s_a_p_i_1_1_i_optical_system.xhtml#a830cf50c046528c752605eea3cf5e899).New_Analysis([ZOSAPI](namespace_z_o_s_a_p_i.xhtml).[Analysis](namespace_z_o_s_a_p_i_1_1_analysis.xhtml).AnalysisIDM.DetectorViewer);

 

 [ZOSAPI.Analysis.Settings.RayTracing.IAS\_DetectorViewer](interface_z_o_s_a_p_i_1_1_analysis_1_1_settings_1_1_ray_tracing_1_1_i_a_s___detector_viewer.xhtml) d4_settings = d4.[GetSettings](interface_z_o_s_a_p_i_1_1_analysis_1_1_i_a__.xhtml#af82c93423d06452642e5cb31203cc109)() as [ZOSAPI](namespace_z_o_s_a_p_i.xhtml).[Analysis](namespace_z_o_s_a_p_i_1_1_analysis.xhtml).[Settings](namespace_z_o_s_a_p_i_1_1_analysis_1_1_settings.xhtml).[RayTracing](namespace_z_o_s_a_p_i_1_1_analysis_1_1_settings_1_1_ray_tracing.xhtml).[IAS\_DetectorViewer](interface_z_o_s_a_p_i_1_1_analysis_1_1_settings_1_1_ray_tracing_1_1_i_a_s___detector_viewer.xhtml);

 d4_settings.[Detector](interface_z_o_s_a_p_i_1_1_analysis_1_1_settings_1_1_ray_tracing_1_1_i_a_s___detector_viewer.xhtml#ad949867cd677e510d3830ba9e2b02770).[SetDetectorNumber](interface_z_o_s_a_p_i_1_1_analysis_1_1_settings_1_1_i_a_s___detector.xhtml#ad1d58eebd22900f71622b83219456264)(4);

 d4_settings.ShowAs = [ZOSAPI](namespace_z_o_s_a_p_i.xhtml).[Analysis](namespace_z_o_s_a_p_i_1_1_analysis.xhtml).DetectorViewerShowAsTypes.TrueColor;

 d4.[ApplyAndWaitForCompletion](interface_z_o_s_a_p_i_1_1_analysis_1_1_i_a__.xhtml#aff285af72f196b9c4915c531ff9873a4)();

 

 [ZOSAPI.Analysis.Data.IAR\_](interface_z_o_s_a_p_i_1_1_analysis_1_1_data_1_1_i_a_r__.xhtml) d4_Results = d4.[GetResults](interface_z_o_s_a_p_i_1_1_analysis_1_1_i_a__.xhtml#a4c6f286eaffe67e97984cf1f91cc5cef)();

 [ZOSAPI.Analysis.Data.IAR\_DataGridRgb](interface_z_o_s_a_p_i_1_1_analysis_1_1_data_1_1_i_a_r___data_grid_rgb.xhtml) d4_raw = d4_Results.[GetDataGridRgb](interface_z_o_s_a_p_i_1_1_analysis_1_1_data_1_1_i_a_r__.xhtml#a7914890beda30de981931b39c0823eb5)(0) as [ZOSAPI](namespace_z_o_s_a_p_i.xhtml).[Analysis](namespace_z_o_s_a_p_i_1_1_analysis.xhtml).[Data](namespace_z_o_s_a_p_i_1_1_analysis_1_1_data.xhtml).[IAR\_DataGridRgb](interface_z_o_s_a_p_i_1_1_analysis_1_1_data_1_1_i_a_r___data_grid_rgb.xhtml);

 

 // Creates System.Single\[\] buffers to store pixel data

 // Required any time Interface Documentation shows a Single\[\] or Double\[\] output

 Single[] rData = new Single[(int)(x_pixels * y_pixels)];

 Single[] gData = new Single[(int)(x_pixels * y_pixels)];

 Single[] bData = new Single[(int)(x_pixels * y_pixels)];

 

 // Reads values from detector color raw data

 // Prints RGB data into single file

 d4_raw.[FillValues](interface_z_o_s_a_p_i_1_1_analysis_1_1_data_1_1_i_a_r___data_grid_rgb.xhtml#ae605e5fa29f55398f4f25dc0aadb3768)((uint)(x_pixels * y_pixels), rData, gData, bData);

 System.Text.StringBuilder sbReport = new System.Text.StringBuilder();

 sbReport.Append(string.Concat("Red: ", string.Join(", ", rData), "\\nGreen: ", string.Join(", ", gData), "\\nBlue: ", string.Join(", ", bData)));

 string resFile = TheApplication.SamplesDir + "\\\\API\\\\CS\\\\e24\_nsc\_detector\_rgb.txt";

 System.IO.File.WriteAllText(resFile, sbReport.ToString());

 

 

 // Changes default values for Detector Viewer

 // Plots the Incoherent Irradiance in False Color

 [ZOSAPI.Analysis.IA\_](interface_z_o_s_a_p_i_1_1_analysis_1_1_i_a__.xhtml) d5 = TheSystem.[Analyses](interface_z_o_s_a_p_i_1_1_i_optical_system.xhtml#a830cf50c046528c752605eea3cf5e899).New_Analysis([ZOSAPI](namespace_z_o_s_a_p_i.xhtml).[Analysis](namespace_z_o_s_a_p_i_1_1_analysis.xhtml).AnalysisIDM.DetectorViewer);

 [ZOSAPI.Analysis.Settings.RayTracing.IAS\_DetectorViewer](interface_z_o_s_a_p_i_1_1_analysis_1_1_settings_1_1_ray_tracing_1_1_i_a_s___detector_viewer.xhtml) d5_set = d5.[GetSettings](interface_z_o_s_a_p_i_1_1_analysis_1_1_i_a__.xhtml#af82c93423d06452642e5cb31203cc109)() as [ZOSAPI](namespace_z_o_s_a_p_i.xhtml).[Analysis](namespace_z_o_s_a_p_i_1_1_analysis.xhtml).[Settings](namespace_z_o_s_a_p_i_1_1_analysis_1_1_settings.xhtml).[RayTracing](namespace_z_o_s_a_p_i_1_1_analysis_1_1_settings_1_1_ray_tracing.xhtml).[IAS\_DetectorViewer](interface_z_o_s_a_p_i_1_1_analysis_1_1_settings_1_1_ray_tracing_1_1_i_a_s___detector_viewer.xhtml);

 d5_set.[Detector](interface_z_o_s_a_p_i_1_1_analysis_1_1_settings_1_1_ray_tracing_1_1_i_a_s___detector_viewer.xhtml#ad949867cd677e510d3830ba9e2b02770).[SetDetectorNumber](interface_z_o_s_a_p_i_1_1_analysis_1_1_settings_1_1_i_a_s___detector.xhtml#ad1d58eebd22900f71622b83219456264)(5);

 d5_set.ShowAs = [ZOSAPI](namespace_z_o_s_a_p_i.xhtml).[Analysis](namespace_z_o_s_a_p_i_1_1_analysis.xhtml).DetectorViewerShowAsTypes.FalseColor;

 d5.[ApplyAndWaitForCompletion](interface_z_o_s_a_p_i_1_1_analysis_1_1_i_a__.xhtml#aff285af72f196b9c4915c531ff9873a4)();

 [ZOSAPI.Analysis.Data.IAR\_](interface_z_o_s_a_p_i_1_1_analysis_1_1_data_1_1_i_a_r__.xhtml) d5_results = d5.[GetResults](interface_z_o_s_a_p_i_1_1_analysis_1_1_i_a__.xhtml#a4c6f286eaffe67e97984cf1f91cc5cef)();

 double[,] d5_values = d5_results.[GetDataGrid](interface_z_o_s_a_p_i_1_1_analysis_1_1_data_1_1_i_a_r__.xhtml#aa4eaa3586fe8be4dab9eea0c4ed80575)(0).[Values](interface_z_o_s_a_p_i_1_1_analysis_1_1_data_1_1_i_a_r___data_grid.xhtml#ae6517bfa9e916925419bc6d2ba796969);

 

 sbReport.Clear();

 double max_value = 0.0;

 for (int i = 0; i &lt; d5_values.GetLength(0); i++)

 {

 for (int j = 0; j &lt; d5_values.GetLength(1); j++)

 {

 if (d5_values[i, j] &gt; max_value) max_value = d5_values[i, j];

 sbReport.Append(d5_values[i, j] + "\\t");

 }

 sbReport.AppendLine("");

 }

 resFile = TheApplication.SamplesDir + "\\\\API\\\\CS\\\\e24\_nsc\_detector\_falsecolor.txt";

 System.IO.File.WriteAllText(resFile, sbReport.ToString());

 Console.WriteLine("The max value is {0:F2}", max_value);

 

 // Saves current system in memory

 TheSystem.[SaveAs](interface_z_o_s_a_p_i_1_1_i_optical_system.xhtml#a32d2f472d9a6d3277f3cda76afb6d85d)(TheApplication.[SamplesDir](interface_z_o_s_a_p_i_1_1_i_z_o_s_a_p_i___application.xhtml#ae8fc2a9409927955cc362f9262b052bb) + "\\\\API\\\\CS\\\\e24\_nsc\_detectors.zos");

 

 Console.WriteLine("Press any key to continue...");

 Console.ReadKey();

 

 // 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.Analysis.Data.IAR\_DataGridRgb](interface_z_o_s_a_p_i_1_1_analysis_1_1_data_1_1_i_a_r___data_grid_rgb.xhtml)

**Definition:** IAR_Base.cs:286



[ZOSAPI.Analysis.Data.IAR\_DataGridRgb.FillValues](interface_z_o_s_a_p_i_1_1_analysis_1_1_data_1_1_i_a_r___data_grid_rgb.xhtml#ae605e5fa29f55398f4f25dc0aadb3768)

void FillValues(uint fullSize, [MarshalAs(UnmanagedType.LPArray, SizeParamIndex=0)][In][Out]float[] rData, [MarshalAs(UnmanagedType.LPArray, SizeParamIndex=0)][In][Out]float[] gData, [MarshalAs(UnmanagedType.LPArray, SizeParamIndex=0)][In][Out]float[] bData)

Retries all RGB data at once, into the specified buffers.



[ZOSAPI.Analysis.Data.IAR\_DataGrid.Values](interface_z_o_s_a_p_i_1_1_analysis_1_1_data_1_1_i_a_r___data_grid.xhtml#ae6517bfa9e916925419bc6d2ba796969)

double[,] Values

**Definition:** IAR_Base.cs:229



[ZOSAPI.Analysis.Data.IAR\_](interface_z_o_s_a_p_i_1_1_analysis_1_1_data_1_1_i_a_r__.xhtml)

Properties and methods for retrieving analysis window data. This interface can be accessed via the IA...

**Definition:** IAR_Base.cs:21



[ZOSAPI.Analysis.Data.IAR\_.GetDataGridRgb](interface_z_o_s_a_p_i_1_1_analysis_1_1_data_1_1_i_a_r__.xhtml#a7914890beda30de981931b39c0823eb5)

IAR_DataGridRgb GetDataGridRgb(int index)



[ZOSAPI.Analysis.Data.IAR\_.GetDataGrid](interface_z_o_s_a_p_i_1_1_analysis_1_1_data_1_1_i_a_r__.xhtml#aa4eaa3586fe8be4dab9eea0c4ed80575)

IAR_DataGrid GetDataGrid(int index)



[ZOSAPI.Analysis.IA\_](interface_z_o_s_a_p_i_1_1_analysis_1_1_i_a__.xhtml)

Base interface for all analysis windows. This interface can be accessed via the I_Analyses interface.

**Definition:** IA_Base.cs:29



[ZOSAPI.Analysis.IA\_.GetResults](interface_z_o_s_a_p_i_1_1_analysis_1_1_i_a__.xhtml#a4c6f286eaffe67e97984cf1f91cc5cef)

IAR_ GetResults()

Gets the result data (if available) for the current analysis.



[ZOSAPI.Analysis.IA\_.GetSettings](interface_z_o_s_a_p_i_1_1_analysis_1_1_i_a__.xhtml#af82c93423d06452642e5cb31203cc109)

IAS_ GetSettings()

Gets the settings for the current analysis.



[ZOSAPI.Analysis.IA\_.ApplyAndWaitForCompletion](interface_z_o_s_a_p_i_1_1_analysis_1_1_i_a__.xhtml#aff285af72f196b9c4915c531ff9873a4)

IMessage ApplyAndWaitForCompletion()

Re-runs the analysis with the current settings and waits for it to finish calculating.



[ZOSAPI.Analysis.Settings.IAS\_Detector.SetDetectorNumber](interface_z_o_s_a_p_i_1_1_analysis_1_1_settings_1_1_i_a_s___detector.xhtml#ad1d58eebd22900f71622b83219456264)

IMessage SetDetectorNumber(int N)



[ZOSAPI.Analysis.Settings.RayTracing.IAS\_DetectorViewer](interface_z_o_s_a_p_i_1_1_analysis_1_1_settings_1_1_ray_tracing_1_1_i_a_s___detector_viewer.xhtml)

**Definition:** IAS_DetectorViewer.cs:23



[ZOSAPI.Analysis.Settings.RayTracing.IAS\_DetectorViewer.Detector](interface_z_o_s_a_p_i_1_1_analysis_1_1_settings_1_1_ray_tracing_1_1_i_a_s___detector_viewer.xhtml#ad949867cd677e510d3830ba9e2b02770)

IAS_Detector Detector

**Definition:** IAS_DetectorViewer.cs:25



[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.IEditorCell.IntegerValue](interface_z_o_s_a_p_i_1_1_editors_1_1_i_editor_cell.xhtml#ae449d1e2d9af965fc6cec60f2a9334ce)

int IntegerValue

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

**Definition:** InterfacesEditors.cs:319



[ZOSAPI.Editors.NCE.INCECoatScatterData.GetFaceData](interface_z_o_s_a_p_i_1_1_editors_1_1_n_c_e_1_1_i_n_c_e_coat_scatter_data.xhtml#a784337a7b51eb6c4b283972986aa8039)

INCECoatScatterFaceData GetFaceData(int faceNumber)

Gets coat/scatter data for the specified face (0 to NumberOfFaces-1).



[ZOSAPI.Editors.NCE.INCECoatScatterFaceData.NumberOfRays](interface_z_o_s_a_p_i_1_1_editors_1_1_n_c_e_1_1_i_n_c_e_coat_scatter_face_data.xhtml#a6dbb88bb5802a119a890aaa4e6f9572a)

int NumberOfRays

**Definition:** InterfacesNCE.cs:6306



[ZOSAPI.Editors.NCE.INCECoatScatterFaceData.FaceIs](interface_z_o_s_a_p_i_1_1_editors_1_1_n_c_e_1_1_i_n_c_e_coat_scatter_face_data.xhtml#a7ecc4bc5b1e69305b9e4085b22347914)

FaceIsType FaceIs

**Definition:** InterfacesNCE.cs:6260



[ZOSAPI.Editors.NCE.INCECoatScatterFaceData.ChangeScatterModelSettings](interface_z_o_s_a_p_i_1_1_editors_1_1_n_c_e_1_1_i_n_c_e_coat_scatter_face_data.xhtml#aa11035827e3fe36d04a7da7c142dc6a7)

bool ChangeScatterModelSettings(IObjectScatteringSettings newSettings)



[ZOSAPI.Editors.NCE.INCECoatScatterFaceData.CreateScatterModelSettings](interface_z_o_s_a_p_i_1_1_editors_1_1_n_c_e_1_1_i_n_c_e_coat_scatter_face_data.xhtml#aab27c8591e3674cede79490a9561efee)

IObjectScatteringSettings CreateScatterModelSettings(ObjectScatteringTypes type)



[ZOSAPI.Editors.NCE.INCECoatScatterFaceData.Coating](interface_z_o_s_a_p_i_1_1_editors_1_1_n_c_e_1_1_i_n_c_e_coat_scatter_face_data.xhtml#ac3b2d7eaf1d4d95a8254349caebea43d)

string Coating

**Definition:** InterfacesNCE.cs:6273



[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.ZPosition](interface_z_o_s_a_p_i_1_1_editors_1_1_n_c_e_1_1_i_n_c_e_row.xhtml#a45ef55e0f47af115659ba5bed47c0f9f)

double ZPosition

**Definition:** InterfacesNCE.cs:1464



[ZOSAPI.Editors.NCE.INCERow.XPosition](interface_z_o_s_a_p_i_1_1_editors_1_1_n_c_e_1_1_i_n_c_e_row.xhtml#a5365f428fb628c9ed2721772c3d7b4db)

double XPosition

**Definition:** InterfacesNCE.cs:1448



[ZOSAPI.Editors.NCE.INCERow.Material](interface_z_o_s_a_p_i_1_1_editors_1_1_n_c_e_1_1_i_n_c_e_row.xhtml#a680d0180c89f0eee5669e868ad5e92b8)

string Material

**Definition:** InterfacesNCE.cs:1484



[ZOSAPI.Editors.NCE.INCERow.CoatScatterData](interface_z_o_s_a_p_i_1_1_editors_1_1_n_c_e_1_1_i_n_c_e_row.xhtml#a6dd470918d3d56195aecf4994eef560c)

INCECoatScatterData CoatScatterData

Gets the object Coat/Scatter data.

**Definition:** InterfacesNCE.cs:1355



[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.GetObjectCell](interface_z_o_s_a_p_i_1_1_editors_1_1_n_c_e_1_1_i_n_c_e_row.xhtml#ad712fcba162df362928283b6e00b3840)

IEditorCell GetObjectCell(ObjectColumn Col)

Gets the specified object cell data.



[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.INonSeqEditor](interface_z_o_s_a_p_i_1_1_editors_1_1_n_c_e_1_1_i_non_seq_editor.xhtml)

This interface defines all properties and methods needed to interact with the Non-Sequential Componen...

**Definition:** InterfacesNCE.cs:363



[ZOSAPI.Editors.NCE.INonSeqEditor.GetObjectAt](interface_z_o_s_a_p_i_1_1_editors_1_1_n_c_e_1_1_i_non_seq_editor.xhtml#a4788d547c88f21153f0d2da623c3c9ec)

INCERow GetObjectAt(int ObjectNumber)

Gets the object at the specified position.



[ZOSAPI.Editors.NCE.INonSeqEditor.InsertNewObjectAt](interface_z_o_s_a_p_i_1_1_editors_1_1_n_c_e_1_1_i_non_seq_editor.xhtml#a93d23b9aeba9b67ea2d4690e09c64457)

INCERow InsertNewObjectAt(int ObjectNumber)

Inserts a new object at the specified position.



[ZOSAPI.Editors.NCE.IObjectScatteringSettings](interface_z_o_s_a_p_i_1_1_editors_1_1_n_c_e_1_1_i_object_scattering_settings.xhtml)

Scatter model settings for a specific face. This interface can be accessed via the INCECoatScatterFac...

**Definition:** InterfacesNCE.cs:6323



[ZOSAPI.Editors.NCE.IObjectSourceEllipse](interface_z_o_s_a_p_i_1_1_editors_1_1_n_c_e_1_1_i_object_source_ellipse.xhtml)

**Definition:** InterfacesNCE.cs:4809



[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.SystemData](interface_z_o_s_a_p_i_1_1_i_optical_system.xhtml#a4c4e9771e9ea51766885fdd6fb6627f5)

ISystemData SystemData

Data for configuring everything in the System Explorer.

**Definition:** Interfaces.cs:845



[ZOSAPI.IOpticalSystem.Analyses](interface_z_o_s_a_p_i_1_1_i_optical_system.xhtml#a830cf50c046528c752605eea3cf5e899)

I_Analyses Analyses

Gets the analyses for the current system.

**Definition:** Interfaces.cs:925



[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.CreateNewSystem](interface_z_o_s_a_p_i_1_1_i_z_o_s_a_p_i___application.xhtml#a024aef7880a5ba49d60db78b9b9140b5)

IOpticalSystem CreateNewSystem(SystemType mode)

Creates a new empty optical system, in the specified mode.



[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.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.ISystemTool.RunAndWaitForCompletion](interface_z_o_s_a_p_i_1_1_tools_1_1_i_system_tool.xhtml#a26d8cae18772fd31c1d18525a3b8d9ac)

bool RunAndWaitForCompletion()

Sames as calling Run followed by WaitForCompletion.



[ZOSAPI.Tools.ISystemTool.Close](interface_z_o_s_a_p_i_1_1_tools_1_1_i_system_tool.xhtml#a5bfa126385b9d0c5619b1aff9a354d31)

bool Close()

Closes this tool and frees up and associated resources.



[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.Tools.RayTrace.INSCRayTrace.ClearDetectors](interface_z_o_s_a_p_i_1_1_tools_1_1_ray_trace_1_1_i_n_s_c_ray_trace.xhtml#a4b118fa79a1c9056ded4d08c34549914)

ErrorType ClearDetectors(int DetectorNumber)

Clears the specified detectors.



[ZOSAPI.Analysis.Data](namespace_z_o_s_a_p_i_1_1_analysis_1_1_data.xhtml)

**Definition:** IAR_Base.cs:11



[ZOSAPI.Analysis.Settings.RayTracing](namespace_z_o_s_a_p_i_1_1_analysis_1_1_settings_1_1_ray_tracing.xhtml)

**Definition:** IAS_DetectorViewer.cs:6



[ZOSAPI.Analysis.Settings](namespace_z_o_s_a_p_i_1_1_analysis_1_1_settings.xhtml)

**Definition:** IAS_FieldCurvatureAndDistortion.cs:5



[ZOSAPI.Analysis](namespace_z_o_s_a_p_i_1_1_analysis.xhtml)

**Definition:** IAS_FieldCurvatureAndDistortion.cs:5



[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](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