Skip to main content

ZOS-API interface 2024 R1

ZOSAPI.Tools.General.IScale Interface Reference

Last update: 17.07.2025

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

Inheritance diagram for ZOSAPI.Tools.General.IScale:

Public Member Functions

string GetComponentAt (int idx)
 Get the 'Avaiable Component List' at index 'idx'.
 
- 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

double ScaleFactor [get, set]
 How much do we scale the System.
 
int FirstComponent [get, set]
 Which is the First Surface/Object to Scale.
 
int LastComponent [get, set]
 Which is the Last Surface/Object to Scale.
 
ScaleToUnits ScaleToUnit [get, set]
 To which unit type are we Scaling.
 
bool ScaleByFactor [get, set]
 How much do we scale the System using 'ScaleFactor'.
 
bool ScaleByUnits [get, set]
 Scale from the Current Unit to this new Unit. ScaleFactor comes from the coversion from one metric to another. If true, ScaleByUnits is set to false and vice versa.
 
int NumberOfComponents [get]
 How many components are in the 'Avaiable Component List'. If true, ScaleByFactor is set to false and vice versa.
 
- 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 Scaling the Currently active Lens System. This interface can be accessed via the IOpticalSystemTools interface.

Usage (see Example 11 for a full sample)

C#

// 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 unit = TheSystemData.Units.LensUnits;
// Open Scale Lens tool
ScaleLens = TheSystem.Tools.OpenScale();
// Apply Tool Settings
ScaleLens.ScaleByUnits = true;
ScaleLens.ScaleToUnit = ScaleToUnits.Inches;
ScaleLens.RunAndWaitForCompletion();
ScaleLens.Close();
ZemaxSystemUnits
Definition: InterfacesSE.cs:27
ScaleToUnits
Definition: Tools.cs:1413

C++

// 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 unit = TheSystemData->Units->LensUnits;
// Open Scale Lens tool
IScalePtr ScaleLens = TheSystem->Tools->OpenScale();
// Apply Tool Settings
ScaleLens->ScaleByUnits = true;
ScaleLens->ScaleToUnit = ScaleToUnits_Inches;
ISystemToolPtr baseTool = ScaleLens;
baseTool->RunAndWaitForCompletion();
baseTool->Close();

Matlab

% Set system lens units to inches, scale all values with Scale Lens tool
unit = TheSystemData.Units.LensUnits; % For demonstration only. This file is new, so it has default units mm.
ScaleLens = TheSystem.Tools.OpenScale(); % Open Scale Lens tool
% Apply Tool Settings
ScaleLens.ScaleByUnits = true;
ScaleLens.ScaleToUnit = ZOSAPI.Tools.General.ScaleToUnits.Inches;
ScaleLens.RunAndWaitForCompletion();
ScaleLens.Close();
Definition: Tools.cs:696
Definition: FileSource.cs:4
The ZOSAPI namespace contains classes for initially connecting to zemax. See also ZOSAPI_Connection,...
Definition: IAS_FieldCurvatureAndDistortion.cs:5

Python

# Set system lens units to inches, scale all values with Scale Lens tool
unit = TheSystemData.Units.LensUnits # For demonstration only. This file is new, so it has default units mm.
ScaleLens = TheSystem.Tools.OpenScale() # Open Scale Lens tool
# Apply Tool Settings
ScaleLens.ScaleByUnits = True
ScaleLens.ScaleToUnit = 2 # 0=millimeters; 1=centimeters; 2=inches; 3=meters
# Cast to ISystemTool interface to gain access to Run
ScaleLens.RunAndWaitForCompletion()
ScaleLens.Close()
Examples
CSharpStandalone_11_Basic_Seq.cs.

Member Function Documentation

◆ GetComponentAt()

string ZOSAPI.Tools.General.IScale.GetComponentAt ( int  idx)

Get the 'Avaiable Component List' at index 'idx'.

Parameters
idxGet the idx-th Component.
Returns
The idx-th Component

Property Documentation

◆ FirstComponent

int ZOSAPI.Tools.General.IScale.FirstComponent
getset

Which is the First Surface/Object to Scale.

◆ LastComponent

int ZOSAPI.Tools.General.IScale.LastComponent
getset

Which is the Last Surface/Object to Scale.

◆ NumberOfComponents

int ZOSAPI.Tools.General.IScale.NumberOfComponents
get

How many components are in the 'Avaiable Component List'. If true, ScaleByFactor is set to false and vice versa.

◆ ScaleByFactor

bool ZOSAPI.Tools.General.IScale.ScaleByFactor
getset

How much do we scale the System using 'ScaleFactor'.

◆ ScaleByUnits

bool ZOSAPI.Tools.General.IScale.ScaleByUnits
getset

Scale from the Current Unit to this new Unit. ScaleFactor comes from the coversion from one metric to another. If true, ScaleByUnits is set to false and vice versa.

◆ ScaleFactor

double ZOSAPI.Tools.General.IScale.ScaleFactor
getset

How much do we scale the System.

◆ ScaleToUnit

ScaleToUnits ZOSAPI.Tools.General.IScale.ScaleToUnit
getset

To which unit type are we Scaling.

Connect with Ansys