    

 ## On this page

  

 

 # Example 17 - C# 

 Last update: 16.07.2025 

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

using System;

using [ZOSAPI](namespace_z_o_s_a_p_i.xhtml);

using [ZOSAPI.Analysis](namespace_z_o_s_a_p_i_1_1_analysis.xhtml);

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

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

using [ZOSAPI.Tools.RayTrace](namespace_z_o_s_a_p_i_1_1_tools_1_1_ray_trace.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);

 

 // Add your custom code here...

 // NSC (bulk\_volume)

 // This example recreates Non-sequential\\Scattering\\Bulk Scatter.zos

 

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

 

 //Create a New File

 TheSystem.[New](interface_z_o_s_a_p_i_1_1_i_optical_system.xhtml#a77b5517fb230d393cf7db82d8fee8a86)(false);

 TheSystem.[MakeNonSequential](interface_z_o_s_a_p_i_1_1_i_optical_system.xhtml#ad333f24403925f539e8deff2027e7269)();

 

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

 

 //Define path locations

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

 string SampleFile = 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\\\\e17\_NSC\_BulkdScatter.zos");

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

 

 //Non-sequential component editor

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

 TheNCE = TheSystem.[NCE](interface_z_o_s_a_p_i_1_1_i_optical_system.xhtml#ab3cb797b606066a251c1aecd58e73f16);

 [INCERow](interface_z_o_s_a_p_i_1_1_editors_1_1_n_c_e_1_1_i_n_c_e_row.xhtml) Object_1 = 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)(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) Object_2 = 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)(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) Object_3 = 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);

 

 //Source point

 [IObjectTypeSettings](interface_z_o_s_a_p_i_1_1_editors_1_1_n_c_e_1_1_i_object_type_settings.xhtml) oType_1 = Object_1.[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.SourcePoint);

 Object_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)(oType_1);

 [IObjectSourcePoint](interface_z_o_s_a_p_i_1_1_editors_1_1_n_c_e_1_1_i_object_source_point.xhtml) Source1_data = Object_1.ObjectData as [IObjectSourcePoint](interface_z_o_s_a_p_i_1_1_editors_1_1_n_c_e_1_1_i_object_source_point.xhtml);

 Source1_data.NumberOfLayoutRays = 3;

 Source1_data.NumberOfAnalysisRays = 1000000;

 

 //Rectangular Volume

 //Scattering properties

 //Draw:opacity set to 50%

 [IObjectTypeSettings](interface_z_o_s_a_p_i_1_1_editors_1_1_n_c_e_1_1_i_object_type_settings.xhtml) oType_2 = Object_2.[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.RectangularVolume);

 Object_2.[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)(oType_2);

 Object_2.ZPosition = 2;

 Object_2.Material = "N-BK7";

 [IObjectRectangularVolume](interface_z_o_s_a_p_i_1_1_editors_1_1_n_c_e_1_1_i_object_rectangular_volume.xhtml) RectVolume2_data = Object_2.ObjectData as [IObjectRectangularVolume](interface_z_o_s_a_p_i_1_1_editors_1_1_n_c_e_1_1_i_object_rectangular_volume.xhtml);

 RectVolume2_data.X1HalfWidth = 12;

 RectVolume2_data.Y1HalfWidth = 12;

 RectVolume2_data.ZLength = 40;

 RectVolume2_data.X2HalfWidth = 12;

 RectVolume2_data.Y2HalfWidth = 12;

 [INCEVolumePhysicsData](interface_z_o_s_a_p_i_1_1_editors_1_1_n_c_e_1_1_i_n_c_e_volume_physics_data.xhtml) RectVolume2_volphysdata = Object_2.[VolumePhysicsData](interface_z_o_s_a_p_i_1_1_editors_1_1_n_c_e_1_1_i_n_c_e_row.xhtml#a37ab9bc8a1099589978c636a800dd96f);

 RectVolume2_volphysdata.Model = [VolumePhysicsModelType](namespace_z_o_s_a_p_i_1_1_editors_1_1_n_c_e.xhtml#a53a7179cd83319c494f80d9972e2e30e).AngleScattering;

 RectVolume2_volphysdata.ModelSettings._S_AngleScattering.MeanPath = 5;

 RectVolume2_volphysdata.ModelSettings._S_AngleScattering.Angle = 30;

 [INCEDrawData](interface_z_o_s_a_p_i_1_1_editors_1_1_n_c_e_1_1_i_n_c_e_draw_data.xhtml) RectVolume2_Drawdata = Object_2.[DrawData](interface_z_o_s_a_p_i_1_1_editors_1_1_n_c_e_1_1_i_n_c_e_row.xhtml#a47997f33e2ce8683e2cac5d001a0faa0);

 RectVolume2_Drawdata.Opacity = [ZOSAPI](namespace_z_o_s_a_p_i.xhtml).[Common](namespace_z_o_s_a_p_i_1_1_common.xhtml).ZemaxOpacity.P50;

 

 //Detector Rectangle

 [IObjectTypeSettings](interface_z_o_s_a_p_i_1_1_editors_1_1_n_c_e_1_1_i_object_type_settings.xhtml) oType_3 = Object_3.[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);

 Object_3.RefObject = 2;

 Object_3.ZPosition = 42;

 Object_3.Material = "ABSORB";

 Object_3.[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)(oType_3);

 [IObjectDetectorRectangle](interface_z_o_s_a_p_i_1_1_editors_1_1_n_c_e_1_1_i_object_detector_rectangle.xhtml) DetRect3_data = Object_3.ObjectData as [IObjectDetectorRectangle](interface_z_o_s_a_p_i_1_1_editors_1_1_n_c_e_1_1_i_object_detector_rectangle.xhtml);

 DetRect3_data.XHalfWidth = 15;

 DetRect3_data.YHalfWidth = 15;

 DetRect3_data.NumberXPixels = 25;

 DetRect3_data.NumberYPixels = 25;

 DetRect3_data.DataType = 0;

 DetRect3_data.Color = 2;

 DetRect3_data.Smoothing = 1;

 

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

 

 //Open a shaded model

 [IA\_](interface_z_o_s_a_p_i_1_1_analysis_1_1_i_a__.xhtml) analysis = TheSystem.[Analyses](interface_z_o_s_a_p_i_1_1_i_optical_system.xhtml#a830cf50c046528c752605eea3cf5e899).New_Analysis([AnalysisIDM](namespace_z_o_s_a_p_i_1_1_analysis.xhtml#a0a5cf0f456b9510dd8070610bf696de7).NSCShadedModel);

 analysis.[Terminate](interface_z_o_s_a_p_i_1_1_analysis_1_1_i_a__.xhtml#a764ca87cbb1df1a48d2c6353538094aa)();

 analysis.[WaitForCompletion](interface_z_o_s_a_p_i_1_1_analysis_1_1_i_a__.xhtml#a8ef153c1ce41e66e3352e717905bf543)();

 [IAS\_](interface_z_o_s_a_p_i_1_1_analysis_1_1_settings_1_1_i_a_s__.xhtml) analysisSettings = analysis.[GetSettings](interface_z_o_s_a_p_i_1_1_analysis_1_1_i_a__.xhtml#af82c93423d06452642e5cb31203cc109)();

 string cfgFile = System.IO.Path.GetTempFileName();

 // Save the current settings to the temp file

 analysisSettings.[SaveTo](interface_z_o_s_a_p_i_1_1_analysis_1_1_settings_1_1_i_a_s__.xhtml#a3c196d30f275d5d8e17363b3b702bed7)(cfgFile);

 // make your modifications to it

 //MODIFYSETTINGS are defined in the ZPL help files: The Programming Tab &gt; About the ZPL &gt; Keywords

 analysisSettings.[ModifySettings](interface_z_o_s_a_p_i_1_1_analysis_1_1_settings_1_1_i_a_s__.xhtml#a0bd90efa9aecf2f0f3dc7f8e9ad6f309)(cfgFile, "SHA\_ROTX", "20");

 analysisSettings.[ModifySettings](interface_z_o_s_a_p_i_1_1_analysis_1_1_settings_1_1_i_a_s__.xhtml#a0bd90efa9aecf2f0f3dc7f8e9ad6f309)(cfgFile, "SHA\_ROTY", "-20");

 analysisSettings.[ModifySettings](interface_z_o_s_a_p_i_1_1_analysis_1_1_settings_1_1_i_a_s__.xhtml#a0bd90efa9aecf2f0f3dc7f8e9ad6f309)(cfgFile, "SHA\_ROTZ", "30");

 // now load in the modified settings

 analysisSettings.[LoadFrom](interface_z_o_s_a_p_i_1_1_analysis_1_1_settings_1_1_i_a_s__.xhtml#a62cf3f062ab2e3015ffca22e5173d650)(cfgFile);

 // If you want to overwrite your default CFG, copy it after you are done modifying the settings:

 //string CFG\_fullname = "\\\\zmedc02\\\\users\\\\sandrine.auriol\\\\Documents\\\\Zemax\\\\Configs\\\\POP.CFG";

 //System.IO.File.Copy(cfgFile, CFG\_fullname, true);

 // We don't need the temp file any more, so delete it

 System.IO.File.Delete(cfgFile);

 // Run the analysis with the new settings

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

 

 //Open a detector viewer

 analysis = TheSystem.[Analyses](interface_z_o_s_a_p_i_1_1_i_optical_system.xhtml#a830cf50c046528c752605eea3cf5e899).New_Analysis([AnalysisIDM](namespace_z_o_s_a_p_i_1_1_analysis.xhtml#a0a5cf0f456b9510dd8070610bf696de7).DetectorViewer);

 analysisSettings = analysis.[GetSettings](interface_z_o_s_a_p_i_1_1_analysis_1_1_i_a__.xhtml#af82c93423d06452642e5cb31203cc109)();

 cfgFile = System.IO.Path.GetTempFileName();

 analysisSettings.[SaveTo](interface_z_o_s_a_p_i_1_1_analysis_1_1_settings_1_1_i_a_s__.xhtml#a3c196d30f275d5d8e17363b3b702bed7)(cfgFile);

 analysisSettings.[ModifySettings](interface_z_o_s_a_p_i_1_1_analysis_1_1_settings_1_1_i_a_s__.xhtml#a0bd90efa9aecf2f0f3dc7f8e9ad6f309)(cfgFile, "DVW\_SHOW", "2");

 analysisSettings.[ModifySettings](interface_z_o_s_a_p_i_1_1_analysis_1_1_settings_1_1_i_a_s__.xhtml#a0bd90efa9aecf2f0f3dc7f8e9ad6f309)(cfgFile, "DVW\_SMOOTHING", "1");

 analysisSettings.[LoadFrom](interface_z_o_s_a_p_i_1_1_analysis_1_1_settings_1_1_i_a_s__.xhtml#a62cf3f062ab2e3015ffca22e5173d650)(cfgFile);

 System.IO.File.Delete(cfgFile);

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

 

 //Run a ray trace

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

 

 

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

 

 // 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.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\_.Terminate](interface_z_o_s_a_p_i_1_1_analysis_1_1_i_a__.xhtml#a764ca87cbb1df1a48d2c6353538094aa)

bool Terminate()

Attempt to cancel the currently running the analysis.



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

void WaitForCompletion()

Waits for the current analysis to finish running (if applicable).



[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\_](interface_z_o_s_a_p_i_1_1_analysis_1_1_settings_1_1_i_a_s__.xhtml)

Base class for all analysis settings interfaces. This class can be accessed via the IA_ interface.

**Definition:** IAS_Base.cs:25



[ZOSAPI.Analysis.Settings.IAS\_.ModifySettings](interface_z_o_s_a_p_i_1_1_analysis_1_1_settings_1_1_i_a_s__.xhtml#a0bd90efa9aecf2f0f3dc7f8e9ad6f309)

bool ModifySettings(string settingsFile, string typeCode, string newValue)

Changes a single setting in the specified file. See the MODIFYSETTINGS DDE command help documentation...



[ZOSAPI.Analysis.Settings.IAS\_.SaveTo](interface_z_o_s_a_p_i_1_1_analysis_1_1_settings_1_1_i_a_s__.xhtml#a3c196d30f275d5d8e17363b3b702bed7)

bool SaveTo(string settingsFile)

Saves the current settings to the specified file.



[ZOSAPI.Analysis.Settings.IAS\_.LoadFrom](interface_z_o_s_a_p_i_1_1_analysis_1_1_settings_1_1_i_a_s__.xhtml#a62cf3f062ab2e3015ffca22e5173d650)

bool LoadFrom(string settingsFile)

Replaces the current settings with settings read from the specified file.



[ZOSAPI.Editors.NCE.INCEDrawData](interface_z_o_s_a_p_i_1_1_editors_1_1_n_c_e_1_1_i_n_c_e_draw_data.xhtml)

Object properties Draw tab. This interface can be accessed via the INCERow interface.

**Definition:** InterfacesNCE.cs:5789



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

INCEVolumePhysicsData VolumePhysicsData

Gets the object Volume Physics data.

**Definition:** InterfacesNCE.cs:1383



[ZOSAPI.Editors.NCE.INCERow.DrawData](interface_z_o_s_a_p_i_1_1_editors_1_1_n_c_e_1_1_i_n_c_e_row.xhtml#a47997f33e2ce8683e2cac5d001a0faa0)

INCEDrawData DrawData

Gets the object Draw data.

**Definition:** InterfacesNCE.cs:1341



[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.INCEVolumePhysicsData](interface_z_o_s_a_p_i_1_1_editors_1_1_n_c_e_1_1_i_n_c_e_volume_physics_data.xhtml)

Object properties Volume Physics tab. This interface can be accessed via the INCERow interface.

**Definition:** InterfacesNCE.cs:6551



[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.IObjectDetectorRectangle](interface_z_o_s_a_p_i_1_1_editors_1_1_n_c_e_1_1_i_object_detector_rectangle.xhtml)

**Definition:** InterfacesNCE.cs:3274



[ZOSAPI.Editors.NCE.IObjectRectangularVolume](interface_z_o_s_a_p_i_1_1_editors_1_1_n_c_e_1_1_i_object_rectangular_volume.xhtml)

**Definition:** InterfacesNCE.cs:4582



[ZOSAPI.Editors.NCE.IObjectSourcePoint](interface_z_o_s_a_p_i_1_1_editors_1_1_n_c_e_1_1_i_object_source_point.xhtml)

**Definition:** InterfacesNCE.cs:4937



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

void New(bool saveIfNeeded)

Clears all data in the current system and resets it to a default state.



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

bool MakeNonSequential()

Makes the system non-sequential if it is not already. Note that any sequential data will be lost.



[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.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.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.Analysis.AnalysisIDM](namespace_z_o_s_a_p_i_1_1_analysis.xhtml#a0a5cf0f456b9510dd8070610bf696de7)

AnalysisIDM

All available analysis types. See the I_Analyses interface for more information.

**Definition:** I_Analyses.cs:15



[ZOSAPI.Common](namespace_z_o_s_a_p_i_1_1_common.xhtml)

**Definition:** InterfacesCommon.cs:9



[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.VolumePhysicsModelType](namespace_z_o_s_a_p_i_1_1_editors_1_1_n_c_e.xhtml#a53a7179cd83319c494f80d9972e2e30e)

VolumePhysicsModelType

**Definition:** InterfacesNCE.cs:6537



[ZOSAPI.Editors](namespace_z_o_s_a_p_i_1_1_editors.xhtml)

**Definition:** InterfacesEditors.cs:12



[ZOSAPI.Tools.RayTrace](namespace_z_o_s_a_p_i_1_1_tools_1_1_ray_trace.xhtml)

**Definition:** RayTrace.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