Skip to main content

ZOS-API interface 2024 R2

ZOSAPI.Tools.General.IExportCAD Interface Reference

Last update: 17.07.2025

Interfaces and methods for exporting the current system to various CAD formats. This interface can be accessed via the IOpticalSystemTools interface. More...

Inheritance diagram for ZOSAPI.Tools.General.IExportCAD:

Public Member Functions

void SetWavelengthAll ()
 
void SetFieldAll ()
 
void SetSingleConfiguration (int ConfigurationNumber)
 Set it to export a single configuration of the current system.
 
void SetCurrentConfiguration ()
 
void SetConfigurationAllByLayer ()
 
void SetConfigurationAllByFile ()
 
void SetConfigurationAllAtOnce ()
 
- Public Member Functions inherited from ZOSAPI.Tools.ISystemTool
bool Run ()
 Start the tool. Note that for synchronous tools (see IsAsynchronous), this call will block until completion. If it is asynchronous it will start running but return immediately.
 
bool RunAndWaitForCompletion ()
 Sames as calling Run followed by WaitForCompletion.
 
bool WaitForCompletion ()
 Waits for the asynchronous tool to complete.
 
bool Cancel ()
 Cancels the currently running asynchronous tool.
 
bool Close ()
 Closes this tool and frees up and associated resources.
 
RunStatus WaitWithTimeout (double timeOutSeconds)
 Waits for the currently running tool to complete, with a specified time out value. Note that if the timeout is exceeded this method will return, however the tool will continue to run. Also note that this method will not start the tool running if it is not already.
 
RunStatus RunAndWaitWithTimeout (double timeOutSeconds)
 Starts the tool running, and waits for it to complete with the specified timeout value. Note that if the timeout is exceeded this method will return, however the tool will continue to run.
 

Properties

int FirstSurface [get, set]
 Gets or sets the first surface to include in the CAD file (0 to ZOSAPI.Editors.LDE.ILensDataEditor.NumberOfSurfaces-2).
 
int LastSurface [get, set]
 Gets or sets the last surface to include in the CAD file (1 to ZOSAPI.Editors.LDE.ILensDataEditor.NumberOfSurfaces-1).
 
bool CanChangeSurface [get]
 Gets a value indicating whether the surface is modifiable. For non-sequential systems, the surface will be fixed at surface 1.
 
int FirstObject [get, set]
 Gets or sets the first object to include in the CAD file (1 to ZOSAPI.Editors.NCE.INonSeqEditor.NumberOfObjects). Note that this settings is only valid for pure non-sequential systems.
 
int LastObject [get, set]
 Gets or sets the last object to include in the CAD file (1 to ZOSAPI.Editors.NCE.INonSeqEditor.NumberOfObjects).
 
bool SequentialSettingsEnabled [get]
 Gets a value indicating whether or not the sequential-only settings are used. These settings include:
 
RayPatternType RayPattern [get, set]
 
int NumberOfRays [get, set]
 
int Wavelength [get, set]
 
int Field [get, set]
 
bool DeleteVignetted [get, set]
 
int RayLayer [get, set]
 Gets or sets the ray layer (0 to 20).
 
int LensLayer [get, set]
 Gets or sets the lens layer (0 to 20).
 
double DummyThickness [get, set]
 
SplineSegmentsType SplineSegments [get, set]
 
CADFileType FileType [get, set]
 
CADToleranceType Tolerance [get, set]
 
CADAngularToleranceType AngularTolerance [get, set]
 
int Configuration [get]
 Gets the current configuration setting. Use one of the following methods to change the configuration setting:
 
bool ExportDummySurfaces [get, set]
 
bool SurfacesAsSolids [get, set]
 
bool ScatterNSCRays [get, set]
 
bool SplitNSCRays [get, set]
 
bool UsePolarization [get, set]
 
string OutputFileName [get, set]
 
bool AutoNameFaces [get, set]
 
ACISExportVersion FileVersion [get, set]
 
- Properties inherited from ZOSAPI.Tools.ISystemTool
int Progress [get]
 Gets the progress of the current tool, if supported.
 
string Status [get]
 Gets the status of the current tool, if supporoted.
 
bool IsRunning [get]
 Gets a value indicating whether the tool is currently running asynchronously.
 
bool CanCancel [get]
 Gets a value indicating whether the tool can be cancelled.
 
bool IsAsynchronous [get]
 Gets a value indicating whether the tool runs asynchronously (i.e. on a thread).
 
bool IsFiniteDuration [get]
 Gets a value indicating whether this tool will complete on its own.
 
bool IsValid [get]
 Gets a value indicating whether the input settings are valid.
 
bool Succeeded [get]
 Gets a value indicating whether the tool execution succeeded.
 
string ErrorMessage [get]
 If Succeeded is false, get the error messages; otherwise, null.
 

Detailed Description

Interfaces and methods for exporting the current system to various CAD formats. This interface can be accessed via the IOpticalSystemTools interface.

Usage (see Example 20 for a full sample)

C#

// default option settings
ToolExportCAD.FirstObject = 1;
ToolExportCAD.LastObject = 8;
ToolExportCAD.RayLayer = 1;
ToolExportCAD.LensLayer = 0;
ToolExportCAD.DummyThickness = 1;
ToolExportCAD.SplineSegments = SplineSegmentsType.N_032;
ToolExportCAD.FileType = CADFileType.STEP;
ToolExportCAD.Tolerance = CADToleranceType.N_TenEMinus4;
ToolExportCAD.SetCurrentConfiguration();
// For other configuration choices, use following methods.
//ToolExportCAD.SetConfigurationAllAtOnce();
//ToolExportCAD.SetConfigurationAllByFile();
//ToolExportCAD.SetConfigurationAllByLayer();
//ToolExportCAD.SetSingleConfiguration(1);
CADFileType
Definition: Tools.cs:1022
CADToleranceType
Definition: Tools.cs:1055
SplineSegmentsType
Definition: Tools.cs:1010

C++

// default option settings
ToolExportCAD->FirstObject = 1;
ToolExportCAD->LastObject = 8;
ToolExportCAD->RayLayer = 1;
ToolExportCAD->LensLayer = 0;
ToolExportCAD->DummyThickness = 1;
ToolExportCAD->SplineSegments = SplineSegmentsType_N_032;
ToolExportCAD->FileType = CADFileType_STEP;
ToolExportCAD->Tolerance = CADToleranceType_N_TenEMinus4;
ToolExportCAD->SetCurrentConfiguration();
// For other configuration choices, use following methods.
//ToolExportCAD->SetConfigurationAllAtOnce();
//ToolExportCAD->SetConfigurationAllByFile();
//ToolExportCAD->SetConfigurationAllByLayer();
//ToolExportCAD->SetSingleConfiguration(1);

Matlab

% default option settings
ToolExportCAD.FirstObject = 1;
ToolExportCAD.LastObject = 8;
ToolExportCAD.RayLayer = 1;
ToolExportCAD.LensLayer = 0;
ToolExportCAD.DummyThickness = 1;
ToolExportCAD.SplineSegments = ZOSAPI.Tools.General.SplineSegmentsType.N_032;
ToolExportCAD.FileType = ZOSAPI.Tools.General.CADFileType.STEP;
ToolExportCAD.Tolerance = ZOSAPI.Tools.General.CADToleranceType.N_TenEMinus4;
ToolExportCAD.SetCurrentConfiguration();
% For other configuration choices, use following methods.
%ToolExportCAD.SetConfigurationAllAtOnce();
%ToolExportCAD.SetConfigurationAllByFile();
%ToolExportCAD.SetConfigurationAllByLayer();
%ToolExportCAD.SetSingleConfiguration(1);
Definition: Tools.cs:697
Definition: FileSource.cs:4
The ZOSAPI namespace contains classes for initially connecting to zemax. See also ZOSAPI_Connection,...
Definition: IAS_FieldCurvatureAndDistortion.cs:5

Python

# default option settings
ToolExportCAD.FirstObject = 1
ToolExportCAD.LastObject = 8
ToolExportCAD.RayLayer = 1
ToolExportCAD.LensLayer = 0
ToolExportCAD.DummyThickness = 1
ToolExportCAD.SplineSegments = ZOSAPI.Tools.General.SplineSegmentsType.N_032
ToolExportCAD.FileType = ZOSAPI.Tools.General.CADFileType.STEP
ToolExportCAD.Tolerance = ZOSAPI.Tools.General.CADToleranceType.N_TenEMinus4
ToolExportCAD.SetCurrentConfiguration()
# For other configuration choices, use following methods.
# ToolExportCAD.SetConfigurationAllAtOnce()
# ToolExportCAD.SetConfigurationAllByFile()
# ToolExportCAD.SetConfigurationAllByLayer()
# ToolExportCAD.SetSingleConfiguration(1)
Examples
CSharpStandalone_20_export_CAD_File.cs.

Member Function Documentation

◆ SetConfigurationAllAtOnce()

void ZOSAPI.Tools.General.IExportCAD.SetConfigurationAllAtOnce ( )

◆ SetConfigurationAllByFile()

void ZOSAPI.Tools.General.IExportCAD.SetConfigurationAllByFile ( )

◆ SetConfigurationAllByLayer()

void ZOSAPI.Tools.General.IExportCAD.SetConfigurationAllByLayer ( )

◆ SetCurrentConfiguration()

void ZOSAPI.Tools.General.IExportCAD.SetCurrentConfiguration ( )

◆ SetFieldAll()

void ZOSAPI.Tools.General.IExportCAD.SetFieldAll ( )

◆ SetSingleConfiguration()

void ZOSAPI.Tools.General.IExportCAD.SetSingleConfiguration ( int  ConfigurationNumber)

Set it to export a single configuration of the current system.

Parameters
ConfigurationNumberThe configuration number (0 to ZOSAPI.Editors.MCE.IMultiConfigEditor.NumberOfConfigurations). Use 0 for the current configuration.

◆ SetWavelengthAll()

void ZOSAPI.Tools.General.IExportCAD.SetWavelengthAll ( )

Property Documentation

◆ AngularTolerance

CADAngularToleranceType ZOSAPI.Tools.General.IExportCAD.AngularTolerance
getset

◆ AutoNameFaces

bool ZOSAPI.Tools.General.IExportCAD.AutoNameFaces
getset

◆ CanChangeSurface

bool ZOSAPI.Tools.General.IExportCAD.CanChangeSurface
get

Gets a value indicating whether the surface is modifiable. For non-sequential systems, the surface will be fixed at surface 1.

true if the surface can be changed; otherwise, false.

◆ Configuration

int ZOSAPI.Tools.General.IExportCAD.Configuration
get

Gets the current configuration setting. Use one of the following methods to change the configuration setting:

SetSingleConfiguration

SetConfigurationAllByLayer

SetConfigurationAllByFile

SetConfigurationAllAtOnce

The configuration.

◆ DeleteVignetted

bool ZOSAPI.Tools.General.IExportCAD.DeleteVignetted
getset

◆ DummyThickness

double ZOSAPI.Tools.General.IExportCAD.DummyThickness
getset

◆ ExportDummySurfaces

bool ZOSAPI.Tools.General.IExportCAD.ExportDummySurfaces
getset

◆ Field

int ZOSAPI.Tools.General.IExportCAD.Field
getset

◆ FileType

CADFileType ZOSAPI.Tools.General.IExportCAD.FileType
getset

◆ FileVersion

ACISExportVersion ZOSAPI.Tools.General.IExportCAD.FileVersion
getset

◆ FirstObject

int ZOSAPI.Tools.General.IExportCAD.FirstObject
getset

Gets or sets the first object to include in the CAD file (1 to ZOSAPI.Editors.NCE.INonSeqEditor.NumberOfObjects). Note that this settings is only valid for pure non-sequential systems.

The first object.

◆ FirstSurface

int ZOSAPI.Tools.General.IExportCAD.FirstSurface
getset

Gets or sets the first surface to include in the CAD file (0 to ZOSAPI.Editors.LDE.ILensDataEditor.NumberOfSurfaces-2).

The first surface.

◆ LastObject

int ZOSAPI.Tools.General.IExportCAD.LastObject
getset

Gets or sets the last object to include in the CAD file (1 to ZOSAPI.Editors.NCE.INonSeqEditor.NumberOfObjects).

The last object.

◆ LastSurface

int ZOSAPI.Tools.General.IExportCAD.LastSurface
getset

Gets or sets the last surface to include in the CAD file (1 to ZOSAPI.Editors.LDE.ILensDataEditor.NumberOfSurfaces-1).

The last surface.

◆ LensLayer

int ZOSAPI.Tools.General.IExportCAD.LensLayer
getset

Gets or sets the lens layer (0 to 20).

The desired lens layer.

◆ NumberOfRays

int ZOSAPI.Tools.General.IExportCAD.NumberOfRays
getset

◆ OutputFileName

string ZOSAPI.Tools.General.IExportCAD.OutputFileName
getset

Usage (see Example 20 for a full sample)

C#

// set output file name
ToolExportCAD.OutputFileName = TheApplication.ObjectsDir + "\\CAD Files\\e20_export_CAD_File.step";

C++

// set output file name
ToolExportCAD->OutputFileName = TheApplication->ObjectsDir + "\\CAD Files\\API_CADexport_sample.step";

Matlab

% set output file name
ToolExportCAD.OutputFileName = System.String.Concat(TheApplication.ObjectsDir, '\\CAD Files\\API_CADexport_sample.step');

Python

# set output file name
ToolExportCAD.OutputFileName = TheApplication.ObjectsDir + '\\CAD Files\\API_CADexport_sample.step'

◆ RayLayer

int ZOSAPI.Tools.General.IExportCAD.RayLayer
getset

Gets or sets the ray layer (0 to 20).

The desired ray layer.

◆ RayPattern

RayPatternType ZOSAPI.Tools.General.IExportCAD.RayPattern
getset

◆ ScatterNSCRays

bool ZOSAPI.Tools.General.IExportCAD.ScatterNSCRays
getset

Usage (see Example 20 for a full sample)

C#

// default check boxes settings
ToolExportCAD.SurfacesAsSolids = true;
ToolExportCAD.ScatterNSCRays = false;
ToolExportCAD.ExportDummySurfaces = false;
ToolExportCAD.SplitNSCRays = false;
ToolExportCAD.UsePolarization = false;

C++

// default check boxes settings
ToolExportCAD->SurfacesAsSolids = true;
ToolExportCAD->ScatterNSCRays = false;
ToolExportCAD->ExportDummySurfaces = false;
ToolExportCAD->SplitNSCRays = false;
ToolExportCAD->UsePolarization = false;

Matlab

% default check boxes settings
ToolExportCAD.SurfacesAsSolids = true;
ToolExportCAD.ScatterNSCRays = false;
ToolExportCAD.ExportDummySurfaces = false;
ToolExportCAD.SplitNSCRays = false;
ToolExportCAD.UsePolarization = false;

Python

# default check boxes settings
ToolExportCAD.SurfacesAsSolids = True
ToolExportCAD.ScatterNSCRays = False
ToolExportCAD.ExportDummySurfaces = False
ToolExportCAD.SplitNSCRays = False
ToolExportCAD.UsePolarization = False

◆ SequentialSettingsEnabled

bool ZOSAPI.Tools.General.IExportCAD.SequentialSettingsEnabled
get

Gets a value indicating whether or not the sequential-only settings are used. These settings include:

RayPattern

NumberOfRays

Wavelength

SetWavelengthAll

Field

SetFieldAll

DeleteVignetted

true if the sequentials settings are available; otherwise, false.

◆ SplineSegments

SplineSegmentsType ZOSAPI.Tools.General.IExportCAD.SplineSegments
getset

◆ SplitNSCRays

bool ZOSAPI.Tools.General.IExportCAD.SplitNSCRays
getset

◆ SurfacesAsSolids

bool ZOSAPI.Tools.General.IExportCAD.SurfacesAsSolids
getset

◆ Tolerance

CADToleranceType ZOSAPI.Tools.General.IExportCAD.Tolerance
getset

◆ UsePolarization

bool ZOSAPI.Tools.General.IExportCAD.UsePolarization
getset

◆ Wavelength

int ZOSAPI.Tools.General.IExportCAD.Wavelength
getset

Connect with Ansys