    

 ## On this page

  

 

 # Example 11 - C# 

 Last update: 16.07.2025 

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

using System;

using [ZOSAPI](namespace_z_o_s_a_p_i.xhtml);

using [ZOSAPI.SystemData](namespace_z_o_s_a_p_i_1_1_system_data.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.Analysis.Settings.Spot](namespace_z_o_s_a_p_i_1_1_analysis_1_1_settings_1_1_spot.xhtml);

using [ZOSAPI.Editors.LDE](namespace_z_o_s_a_p_i_1_1_editors_1_1_l_d_e.xhtml);

using [ZOSAPI.Tools.General](namespace_z_o_s_a_p_i_1_1_tools_1_1_general.xhtml);

 

namespace CSharpStandaloneApplication

{

 class Program

 {

 public static [IScale](interface_z_o_s_a_p_i_1_1_tools_1_1_general_1_1_i_scale.xhtml) ScaleLens { get; private set; }

 

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

 

 // Add your custom code here...

 // Create New Sequential File

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

 // Name File

 [String](namespace_z_o_s_a_p_i_1_1_common.xhtml#a3f54742c5ea7ea3449f67a65dea61289a27118326006d3829667a400ad23d5d98) fileName = TheApplication.SamplesDir + "\\\\API\\\\CS\\\\e11\_basic\_seq.zos";

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

 

 // Changing System Explorer Settings

 // Set Aperture

 [ISystemData](interface_z_o_s_a_p_i_1_1_system_data_1_1_i_system_data.xhtml) TheSystemData = TheSystem.[SystemData](interface_z_o_s_a_p_i_1_1_i_optical_system.xhtml#a4c4e9771e9ea51766885fdd6fb6627f5);

 TheSystemData.Aperture.ApertureValue = 20;

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

 

 // Set Apodization Type to Gaussian, and set apodization factor to 1

 TheSystemData.Aperture.ApodizationType = [ZemaxApodizationType](namespace_z_o_s_a_p_i_1_1_system_data.xhtml#af229d8fc12249c2081ea3e10f32bbecb).Gaussian;

 TheSystemData.Aperture.ApodizationFactor = 1;

 // Set Wavelength

 TheSystemData.[Wavelengths](interface_z_o_s_a_p_i_1_1_system_data_1_1_i_system_data.xhtml#adc3ab867ef04c79e760a3726b9509fa7).[SelectWavelengthPreset](interface_z_o_s_a_p_i_1_1_system_data_1_1_i_wavelengths.xhtml#a8d96b6f0046e8e23bf6a9b60525b95a0)([WavelengthPreset](namespace_z_o_s_a_p_i_1_1_system_data.xhtml#af09b97b3888a6e2576ed1e0baa359b92).FdC_Visible);

 

 // Insert and Track New Surfaces, set STOP to surface 1

 [ILensDataEditor](interface_z_o_s_a_p_i_1_1_editors_1_1_l_d_e_1_1_i_lens_data_editor.xhtml) TheLDE = TheSystem.[LDE](interface_z_o_s_a_p_i_1_1_i_optical_system.xhtml#a942995136e3c3cf875cc1fde38d33477);

 TheLDE.[InsertNewSurfaceAt](interface_z_o_s_a_p_i_1_1_editors_1_1_l_d_e_1_1_i_lens_data_editor.xhtml#a921fc6dbf53c68b79b520193e1907dc9)(1);

 TheLDE.[InsertNewSurfaceAt](interface_z_o_s_a_p_i_1_1_editors_1_1_l_d_e_1_1_i_lens_data_editor.xhtml#a921fc6dbf53c68b79b520193e1907dc9)(1);

 TheLDE.[InsertNewSurfaceAt](interface_z_o_s_a_p_i_1_1_editors_1_1_l_d_e_1_1_i_lens_data_editor.xhtml#a921fc6dbf53c68b79b520193e1907dc9)(1);

 [ILDERow](interface_z_o_s_a_p_i_1_1_editors_1_1_l_d_e_1_1_i_l_d_e_row.xhtml) Surf_1 = TheLDE.[GetSurfaceAt](interface_z_o_s_a_p_i_1_1_editors_1_1_l_d_e_1_1_i_lens_data_editor.xhtml#a25b725fa7de9dd2713ed949ac2199b05)(1);

 [ILDERow](interface_z_o_s_a_p_i_1_1_editors_1_1_l_d_e_1_1_i_l_d_e_row.xhtml) Surf_2 = TheLDE.[GetSurfaceAt](interface_z_o_s_a_p_i_1_1_editors_1_1_l_d_e_1_1_i_lens_data_editor.xhtml#a25b725fa7de9dd2713ed949ac2199b05)(2);

 [ILDERow](interface_z_o_s_a_p_i_1_1_editors_1_1_l_d_e_1_1_i_l_d_e_row.xhtml) Surf_3 = TheLDE.[GetSurfaceAt](interface_z_o_s_a_p_i_1_1_editors_1_1_l_d_e_1_1_i_lens_data_editor.xhtml#a25b725fa7de9dd2713ed949ac2199b05)(3);

 [ILDERow](interface_z_o_s_a_p_i_1_1_editors_1_1_l_d_e_1_1_i_l_d_e_row.xhtml) Surf_4 = TheLDE.[GetSurfaceAt](interface_z_o_s_a_p_i_1_1_editors_1_1_l_d_e_1_1_i_lens_data_editor.xhtml#a25b725fa7de9dd2713ed949ac2199b05)(4);

 Surf_1.IsStop = true;

 // Set some baseline parameters

 Surf_1.Thickness = 5;

 Surf_2.Thickness = 5;

 Surf_2.Radius = 100;

 Surf_2.Material = "N-BK7";

 Surf_3.Thickness = 3;

 Surf_3.Radius = -30;

 Surf_3.Material = "F2";

 Surf_4.Radius = -80;

 

 // Set system lens units to inches, scale all values with Scale Lens tool

 // For demonstration only. This file is new, so it has default units mm.

 [ZemaxSystemUnits](namespace_z_o_s_a_p_i_1_1_system_data.xhtml#aee6855a5e7c0b638c250e8f0214ca6aa) unit = TheSystemData.[Units](interface_z_o_s_a_p_i_1_1_system_data_1_1_i_system_data.xhtml#ae3b377657650d4b024fe9fc3f17f8f21).[LensUnits](interface_z_o_s_a_p_i_1_1_system_data_1_1_i_s_d_units_data.xhtml#a5b3a7c3db715f4a2a6891ed9a13d8afe);

 // Open Scale Lens tool

 ScaleLens = TheSystem.[Tools](interface_z_o_s_a_p_i_1_1_i_optical_system.xhtml#add3e3631eadf7955b7b341179ff1eff8).OpenScale();

 // Apply Tool Settings

 ScaleLens.ScaleByUnits = true;

 ScaleLens.ScaleToUnit = [ScaleToUnits](namespace_z_o_s_a_p_i_1_1_tools_1_1_general.xhtml#a2bab2eb2ac3f633c7e800bb5d52595d6).Inches;

 ScaleLens.RunAndWaitForCompletion();

 ScaleLens.Close();

 

 // Add Rectangular Aperture to Surface 1

 // Get surface 1, create aperture settings

 Surf_1 = TheSystem.[LDE](interface_z_o_s_a_p_i_1_1_i_optical_system.xhtml#a942995136e3c3cf875cc1fde38d33477).GetSurfaceAt(1);

 [ISurfaceApertureType](interface_z_o_s_a_p_i_1_1_editors_1_1_l_d_e_1_1_i_surface_aperture_type.xhtml) rAperture = Surf_1.[ApertureData](interface_z_o_s_a_p_i_1_1_editors_1_1_l_d_e_1_1_i_l_d_e_row.xhtml#ac0a3ea5103e2dda26276cfcb90c38432).[CreateApertureTypeSettings](interface_z_o_s_a_p_i_1_1_editors_1_1_l_d_e_1_1_i_l_d_e_aperture_data.xhtml#a4dbb443475e2249c33d73b10c50c8ece)([SurfaceApertureTypes](namespace_z_o_s_a_p_i_1_1_editors_1_1_l_d_e.xhtml#a15ca451182bc7f44b720da80d58d9830).RectangularAperture);

 // Set aperture size

 rAperture._S_RectangularAperture.XHalfWidth = 0.1;

 rAperture._S_RectangularAperture.YHalfWidth = 0.1;

 // Apply aperture settings to surface 1

 Surf_1.[ApertureData](interface_z_o_s_a_p_i_1_1_editors_1_1_l_d_e_1_1_i_l_d_e_row.xhtml#ac0a3ea5103e2dda26276cfcb90c38432).[ChangeApertureTypeSettings](interface_z_o_s_a_p_i_1_1_editors_1_1_l_d_e_1_1_i_l_d_e_aperture_data.xhtml#a14089fd69c14646e13d066f718d084d1)(rAperture);

 

 // Run Quick Focus

 [IQuickFocus](interface_z_o_s_a_p_i_1_1_tools_1_1_general_1_1_i_quick_focus.xhtml) QuickFocus = TheSystem.[Tools](interface_z_o_s_a_p_i_1_1_i_optical_system.xhtml#add3e3631eadf7955b7b341179ff1eff8).OpenQuickFocus();

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

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

 

 // Open Universal Plot of RMS Spot Size vs Surface3 Thickness

 [IA\_](interface_z_o_s_a_p_i_1_1_analysis_1_1_i_a__.xhtml) UnivPlot = 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).UniversalPlot1D);

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

 Console.WriteLine("Universal Plot has analysis specific settings? " + UnivPlot.[HasAnalysisSpecificSettings](interface_z_o_s_a_p_i_1_1_analysis_1_1_i_a__.xhtml#a96db558bda38b70d914811e7fd652c8f).ToString());

 // Above is False; Universal Plot Settings must be changed via ModifySettings (changing a config (.cfg) file)

 [String](namespace_z_o_s_a_p_i_1_1_common.xhtml#a3f54742c5ea7ea3449f67a65dea61289a27118326006d3829667a400ad23d5d98) cfg = TheApplication.ZemaxDataDir + "\\\\Configs\\\\UNI.CFG";

 UnivPlot_Settings.[Save](interface_z_o_s_a_p_i_1_1_analysis_1_1_settings_1_1_i_a_s__.xhtml#a7e7874f49a22e3762c632821669532ca)(); // Create new .cfg file, named "UNI.CFG" in \\Configs\\ folder

 UnivPlot_Settings.[ModifySettings](interface_z_o_s_a_p_i_1_1_analysis_1_1_settings_1_1_i_a_s__.xhtml#a0bd90efa9aecf2f0f3dc7f8e9ad6f309)(cfg, "UN1\_SURFACE", (TheSystem.[LDE](interface_z_o_s_a_p_i_1_1_i_optical_system.xhtml#a942995136e3c3cf875cc1fde38d33477).NumberOfSurfaces - 2).ToString());

 UnivPlot_Settings.[ModifySettings](interface_z_o_s_a_p_i_1_1_analysis_1_1_settings_1_1_i_a_s__.xhtml#a0bd90efa9aecf2f0f3dc7f8e9ad6f309)(cfg, "UN1\_STARTVAL", (Surf_4.[Thickness](interface_z_o_s_a_p_i_1_1_editors_1_1_l_d_e_1_1_i_l_d_e_row.xhtml#a06e8f1479eeba5ae70b2f6082bb5ee71) - 0.4 / 25.4).ToString()); // Change universal plot settings

 UnivPlot_Settings.[ModifySettings](interface_z_o_s_a_p_i_1_1_analysis_1_1_settings_1_1_i_a_s__.xhtml#a0bd90efa9aecf2f0f3dc7f8e9ad6f309)(cfg, "UN1\_STOPVAL", (Surf_4.[Thickness](interface_z_o_s_a_p_i_1_1_editors_1_1_l_d_e_1_1_i_l_d_e_row.xhtml#a06e8f1479eeba5ae70b2f6082bb5ee71) + 0.1 / 25.4).ToString());

 UnivPlot_Settings.[ModifySettings](interface_z_o_s_a_p_i_1_1_analysis_1_1_settings_1_1_i_a_s__.xhtml#a0bd90efa9aecf2f0f3dc7f8e9ad6f309)(cfg, "UN1\_STEPS", 20.ToString());

 UnivPlot_Settings.[ModifySettings](interface_z_o_s_a_p_i_1_1_analysis_1_1_settings_1_1_i_a_s__.xhtml#a0bd90efa9aecf2f0f3dc7f8e9ad6f309)(cfg, "UN1\_PAR1", 10.ToString());

 UnivPlot_Settings.[ModifySettings](interface_z_o_s_a_p_i_1_1_analysis_1_1_settings_1_1_i_a_s__.xhtml#a0bd90efa9aecf2f0f3dc7f8e9ad6f309)(cfg, "UN1\_OPERAND", "RSRE");

 // For ModifySettings keycodes (UN1\_STARTVAL, UN1\_STEPS, etc.), see MODIFYSETTINGS page in ZPL&gt;keywords help files

 // LoadFrom allows you to load any CFG file, not just default; not available via GUI

 UnivPlot_Settings.[LoadFrom](interface_z_o_s_a_p_i_1_1_analysis_1_1_settings_1_1_i_a_s__.xhtml#a62cf3f062ab2e3015ffca22e5173d650)(cfg);

 

 // Open Spot Diagram to See Result!

 [IA\_](interface_z_o_s_a_p_i_1_1_analysis_1_1_i_a__.xhtml) newSpot = TheSystem.[Analyses](interface_z_o_s_a_p_i_1_1_i_optical_system.xhtml#a830cf50c046528c752605eea3cf5e899).New_StandardSpot();

 Console.WriteLine("Spot has analysis specific settings? " + newSpot.[HasAnalysisSpecificSettings](interface_z_o_s_a_p_i_1_1_analysis_1_1_i_a__.xhtml#a96db558bda38b70d914811e7fd652c8f).ToString()); // True; no ModifySettings

 [IAS\_Spot](interface_z_o_s_a_p_i_1_1_analysis_1_1_settings_1_1_spot_1_1_i_a_s___spot.xhtml) spotSet = newSpot.[GetSettings](interface_z_o_s_a_p_i_1_1_analysis_1_1_i_a__.xhtml#af82c93423d06452642e5cb31203cc109)() as [IAS\_Spot](interface_z_o_s_a_p_i_1_1_analysis_1_1_settings_1_1_spot_1_1_i_a_s___spot.xhtml);

 spotSet.RayDensity = 15;

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

 

 // save!

 TheSystem.[Save](interface_z_o_s_a_p_i_1_1_i_optical_system.xhtml#a8e1c511cdf7f6048f1287532edd3aadd)();

 

 Console.WriteLine("Finished! Press any key to leave...");

 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.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\_.HasAnalysisSpecificSettings](interface_z_o_s_a_p_i_1_1_analysis_1_1_i_a__.xhtml#a96db558bda38b70d914811e7fd652c8f)

bool HasAnalysisSpecificSettings

Gets a value indicating whether this instance has a fully-implemented settings interface available....

**Definition:** IA_Base.cs:55



[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\_.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.Analysis.Settings.IAS\_.Save](interface_z_o_s_a_p_i_1_1_analysis_1_1_settings_1_1_i_a_s__.xhtml#a7e7874f49a22e3762c632821669532ca)

void Save()

Saves the current settings to the default CFG file.



[ZOSAPI.Analysis.Settings.Spot.IAS\_Spot](interface_z_o_s_a_p_i_1_1_analysis_1_1_settings_1_1_spot_1_1_i_a_s___spot.xhtml)

**Definition:** IAS_Spot.cs:50



[ZOSAPI.Editors.LDE.ILDEApertureData.ChangeApertureTypeSettings](interface_z_o_s_a_p_i_1_1_editors_1_1_l_d_e_1_1_i_l_d_e_aperture_data.xhtml#a14089fd69c14646e13d066f718d084d1)

bool ChangeApertureTypeSettings(ISurfaceApertureType settings)

Updates the surface aperture with the specified settings. Use CurrentTypeSettings or CreateApertureTy...



[ZOSAPI.Editors.LDE.ILDEApertureData.CreateApertureTypeSettings](interface_z_o_s_a_p_i_1_1_editors_1_1_l_d_e_1_1_i_l_d_e_aperture_data.xhtml#a4dbb443475e2249c33d73b10c50c8ece)

ISurfaceApertureType CreateApertureTypeSettings(SurfaceApertureTypes type)

Creates the a settings interface for the specified aperture type. Note that changing these settings w...



[ZOSAPI.Editors.LDE.ILDERow](interface_z_o_s_a_p_i_1_1_editors_1_1_l_d_e_1_1_i_l_d_e_row.xhtml)

All data for a Lens Data Editor surface. This interface can be accessed via the ILensDataEditor inter...

**Definition:** InterfacesLDE.cs:791



[ZOSAPI.Editors.LDE.ILDERow.Thickness](interface_z_o_s_a_p_i_1_1_editors_1_1_l_d_e_1_1_i_l_d_e_row.xhtml#a06e8f1479eeba5ae70b2f6082bb5ee71)

double Thickness

Gets or sets the surface thickness.

**Definition:** InterfacesLDE.cs:1009



[ZOSAPI.Editors.LDE.ILDERow.ApertureData](interface_z_o_s_a_p_i_1_1_editors_1_1_l_d_e_1_1_i_l_d_e_row.xhtml#ac0a3ea5103e2dda26276cfcb90c38432)

ILDEApertureData ApertureData

Gets the surface Aperture data.

**Definition:** InterfacesLDE.cs:919



[ZOSAPI.Editors.LDE.ILensDataEditor](interface_z_o_s_a_p_i_1_1_editors_1_1_l_d_e_1_1_i_lens_data_editor.xhtml)

This interface defines all properties and methods needed to interact with the Lens Data Editor....

**Definition:** InterfacesLDE.cs:265



[ZOSAPI.Editors.LDE.ILensDataEditor.GetSurfaceAt](interface_z_o_s_a_p_i_1_1_editors_1_1_l_d_e_1_1_i_lens_data_editor.xhtml#a25b725fa7de9dd2713ed949ac2199b05)

ILDERow GetSurfaceAt(int SurfaceNumber)

Gets the data for the specified surface.



[ZOSAPI.Editors.LDE.ILensDataEditor.InsertNewSurfaceAt](interface_z_o_s_a_p_i_1_1_editors_1_1_l_d_e_1_1_i_lens_data_editor.xhtml#a921fc6dbf53c68b79b520193e1907dc9)

ILDERow InsertNewSurfaceAt(int SurfaceNumber)

Inserts a new surface at the specified position.



[ZOSAPI.Editors.LDE.ISurfaceApertureType](interface_z_o_s_a_p_i_1_1_editors_1_1_l_d_e_1_1_i_surface_aperture_type.xhtml)

Base interface for settings specific to a SurfaceApertureTypes. This interface can be retrieved from ...

**Definition:** InterfacesLDE.cs:4976



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

void Save()

Saves the current system.



[ZOSAPI.IOpticalSystem.LDE](interface_z_o_s_a_p_i_1_1_i_optical_system.xhtml#a942995136e3c3cf875cc1fde38d33477)

ILensDataEditor LDE

Gets the lens data editor.

**Definition:** Interfaces.cs:865



[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.SystemData.ISDUnitsData.LensUnits](interface_z_o_s_a_p_i_1_1_system_data_1_1_i_s_d_units_data.xhtml#a5b3a7c3db715f4a2a6891ed9a13d8afe)

ZemaxSystemUnits LensUnits

**Definition:** InterfacesSE.cs:633



[ZOSAPI.SystemData.ISystemData](interface_z_o_s_a_p_i_1_1_system_data_1_1_i_system_data.xhtml)

Interfaces and methods for changing all System Explorer data. This interface can be accessed via the ...

**Definition:** InterfacesSE.cs:275



[ZOSAPI.SystemData.ISystemData.Wavelengths](interface_z_o_s_a_p_i_1_1_system_data_1_1_i_system_data.xhtml#adc3ab867ef04c79e760a3726b9509fa7)

IWavelengths Wavelengths

**Definition:** InterfacesSE.cs:277



[ZOSAPI.SystemData.ISystemData.Units](interface_z_o_s_a_p_i_1_1_system_data_1_1_i_system_data.xhtml#ae3b377657650d4b024fe9fc3f17f8f21)

ISDUnitsData Units

**Definition:** InterfacesSE.cs:298



[ZOSAPI.SystemData.IWavelengths.SelectWavelengthPreset](interface_z_o_s_a_p_i_1_1_system_data_1_1_i_wavelengths.xhtml#a8d96b6f0046e8e23bf6a9b60525b95a0)

bool SelectWavelengthPreset(WavelengthPreset preset)

Replaces all system wavelengths with a preset definition.



[ZOSAPI.Tools.General.IQuickFocus](interface_z_o_s_a_p_i_1_1_tools_1_1_general_1_1_i_quick_focus.xhtml)

Interfaces and methods for running the Quick Focus tool. This interface can be accessed via the IOpti...

**Definition:** Tools.cs:800



[ZOSAPI.Tools.General.IScale](interface_z_o_s_a_p_i_1_1_tools_1_1_general_1_1_i_scale.xhtml)

Interfaces and methods for Scaling the Currently active Lens System. This interface can be accessed v...

**Definition:** Tools.cs:1453



[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.Analysis.Settings.Spot](namespace_z_o_s_a_p_i_1_1_analysis_1_1_settings_1_1_spot.xhtml)

**Definition:** IAS_Spot.cs:5



[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.SettingsDataType.String](namespace_z_o_s_a_p_i_1_1_common.xhtml#a3f54742c5ea7ea3449f67a65dea61289a27118326006d3829667a400ad23d5d98)

@ String



[ZOSAPI.Editors.LDE](namespace_z_o_s_a_p_i_1_1_editors_1_1_l_d_e.xhtml)

**Definition:** InterfacesLDE.cs:8



[ZOSAPI.Editors.LDE.SurfaceApertureTypes](namespace_z_o_s_a_p_i_1_1_editors_1_1_l_d_e.xhtml#a15ca451182bc7f44b720da80d58d9830)

SurfaceApertureTypes

**Definition:** InterfacesLDE.cs:4844



[ZOSAPI.SystemData](namespace_z_o_s_a_p_i_1_1_system_data.xhtml)

**Definition:** InterfacesSE.cs:11



[ZOSAPI.SystemData.ZemaxSystemUnits](namespace_z_o_s_a_p_i_1_1_system_data.xhtml#aee6855a5e7c0b638c250e8f0214ca6aa)

ZemaxSystemUnits

**Definition:** InterfacesSE.cs:27



[ZOSAPI.SystemData.WavelengthPreset](namespace_z_o_s_a_p_i_1_1_system_data.xhtml#af09b97b3888a6e2576ed1e0baa359b92)

WavelengthPreset

**Definition:** InterfacesSE.cs:138



[ZOSAPI.SystemData.ZemaxApodizationType](namespace_z_o_s_a_p_i_1_1_system_data.xhtml#af229d8fc12249c2081ea3e10f32bbecb)

ZemaxApodizationType

**Definition:** InterfacesSE.cs:117



[ZOSAPI.Tools.General](namespace_z_o_s_a_p_i_1_1_tools_1_1_general.xhtml)

**Definition:** Tools.cs:704



[ZOSAPI.Tools.General.ScaleToUnits](namespace_z_o_s_a_p_i_1_1_tools_1_1_general.xhtml#a2bab2eb2ac3f633c7e800bb5d52595d6)

ScaleToUnits

**Definition:** Tools.cs:1427



[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