Skip to main content

ZOS-API interface 2024 R2 SP02

ZOSAPI.Tools.General.IQuickFocus Interface Reference

Last update: 17.07.2025

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

Inheritance diagram for ZOSAPI.Tools.General.IQuickFocus:

Properties

bool UseCentroid [get, set]
 
QuickFocusCriterion Criterion [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.
 

Additional Inherited Members

- 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.
 

Detailed Description

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

Usage (see Example 15 for a full sample)

C#

//change BFL & run quick focus
Surface_Last.Thickness = 40.0;
IQuickFocus QFocus = tools.OpenQuickFocus();
QFocus.Criterion = QuickFocusCriterion.SpotSizeRadial;
QFocus.UseCentroid = true;
QFocus.Close();
SampleFile = System.IO.Path.Combine(TheApplication.SamplesDir, @"API\CS\e15_Seq_Optimization\OptimizedFile2.zos");
TheSystem.SaveAs(SampleFile);
Interfaces and methods for running the Quick Focus tool. This interface can be accessed via the IOpti...
Definition: Tools.cs:793
bool RunAndWaitForCompletion()
Sames as calling Run followed by WaitForCompletion.
bool Close()
Closes this tool and frees up and associated resources.
QuickFocusCriterion
Definition: Tools.cs:767

C++

// change BFL & run quick focus
Surface_Last->Thickness = 40.0;
IQuickFocusPtr QFocus = tools->OpenQuickFocus();
QFocus->Criterion = QuickFocusCriterion::QuickFocusCriterion_SpotSizeRadial;
QFocus->UseCentroid = true;
ISystemToolPtr baseTool = QFocus;
baseTool->RunAndWaitForCompletion();
baseTool->Close();
SampleFile = _bstr_t(TheApplication->SamplesDir) + "\\API\\CPP\\e15_Seq_Optimization\\OptimizedFile2.zos";
TheSystem->SaveAs(SampleFile);

Matlab

%change BFL & run quick focus
Surface_Last.Thickness = 40.0;
QFocus = tools.OpenQuickFocus();
QFocus.Criterion = ZOSAPI.Tools.General.QuickFocusCriterion.SpotSizeRadial;
QFocus.UseCentroid = true;
QFocus.RunAndWaitForCompletion();
QFocus.Close();
SampleFile = System.String.Concat(TheApplication.SamplesDir, '\API\Matlab\e15_Seq_Optimization\OptimizedFile2.zos');
TheSystem.SaveAs(SampleFile);
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

# change BFL & run quick focus
Surface_Last.Thickness = 40.0
QFocus = tools.OpenQuickFocus()
QFocus.Criterion = ZOSAPI.Tools.General.QuickAdjustCriterion.SpotSizeRadial
QFocus.UseCentroid = True
QFocus.RunAndWaitForCompletion()
QFocus.Close()
SampleFile = TheApplication.SamplesDir + '\\API\\Python\\e15_Seq_Optimization\\OptimizedFile2.zos'
TheSystem.SaveAs(SampleFile)
Examples
CSharpStandalone_01_new_file_and_quickfocus.cs, CSharpStandalone_11_Basic_Seq.cs, CSharpStandalone_15_Seq_Optimization.cs, and CSharpStandalone_18_SetMulticonfiguration.cs.

Property Documentation

◆ Criterion

QuickFocusCriterion ZOSAPI.Tools.General.IQuickFocus.Criterion
getset

Usage (see Example 01 for a full sample)

C#

// QuickFocus
IQuickFocus quickFocus = TheSystem.Tools.OpenQuickFocus();
quickFocus.Criterion = QuickFocusCriterion.SpotSizeRadial;
quickFocus.UseCentroid = true;
quickFocus.Close();

C++

// QuickFocus
IQuickFocusPtr quickFocus = TheSystem->Tools->OpenQuickFocus();
quickFocus->Criterion = QuickFocusCriterion_SpotSizeRadial;
quickFocus->UseCentroid = true;
ISystemToolPtr baseTool = quickFocus;
baseTool->RunAndWaitForCompletion();
baseTool->Close();

Matlab

% QuickFocus
quickFocus = TheSystem.Tools.OpenQuickFocus();
quickFocus.Criterion = ZOSAPI.Tools.General.QuickFocusCriterion.SpotSizeRadial;
quickFocus.UseCentroid = true;
quickFocus.RunAndWaitForCompletion();
quickFocus.Close();

Python

# QuickFocus
quickFocus = TheSystem.Tools.OpenQuickFocus()
quickFocus.Criterion = ZOSAPI.Tools.General.QuickFocusCriterion.SpotSizeRadial
quickFocus.UseCentroid = True
quickFocus.RunAndWaitForCompletion()
quickFocus.Close()

◆ UseCentroid

bool ZOSAPI.Tools.General.IQuickFocus.UseCentroid
getset

Connect with Ansys