zospy.zpcore.OpticStudioSystem#
- class zospy.zpcore.OpticStudioSystem#
Bases:
objectWrapper for OpticStudio System instances.
- Attributes:
AnalysesAnalyses for the current system.
IsNonAxialIndicates whether the optical system is axial and sequential.
LDELens Data Editor.
LensUpdateModeLens update mode of the optical system.
MCEMulti-Configuration Editor.
MFEMerit Function Editor.
ModeMode of the optical system.
NCENon-Sequential Component Editor.
NeedsSaveIndicates if the optical system contains unsaved changes.
SessionModesSession mode of the optical system.
SystemDataData for configuring everything in the system explorer.
SystemFileFile path to the current optical system.
SystemIDUnique identifier for the optical system.
SystemNameName of the current optical system.
TDETolerance Data Editor.
TheApplicationApplication in which the optical system is opened.
ToolsInterface to run various tools on the optical system.
Methods
close([saveifneeded])Close the optical system.
Copy the current OpticStudioSystem instance.
Get the last status of the optical system.
load(filepath[, saveifneeded])Load an earlier defined Zemax file.
Set the optical system to non-sequential mode if it is not already.
Set the optical system to sequential mode if it is not already.
new([saveifneeded])Create a new session file.
save()Save the current OpticStudio session.
save_as(filepath)Save the current session under a specified name.
Force an update of the system, and returns the current status.
- property Analyses: ZOSAPI.Analysis.I_Analyses#
Analyses for the current system.
- property IsNonAxial: bool#
Indicates whether the optical system is axial and sequential.
True if the system is non-axial, False otherwise.
- property LDE: ZOSAPI.Editors.LDE.ILensDataEditor#
Lens Data Editor.
- property LensUpdateMode: str#
Lens update mode of the optical system.
Possible values are [‘None’, ‘EditorsOnly’, ‘AllWindows’] or zospy.constants.LensUpdateMode.
- property MCE: ZOSAPI.Editors.MCE.IMultiConfigEditor#
Multi-Configuration Editor.
- property MFE: ZOSAPI.Editors.MFE.IMeritFunctionEditor#
Merit Function Editor.
- property Mode: str#
Mode of the optical system. Either “Sequential” or “NonSequential”.
- property NCE: ZOSAPI.Editors.NCE.INonSeqEditor#
Non-Sequential Component Editor.
- property NeedsSave: bool#
Indicates if the optical system contains unsaved changes.
- property SessionModes: str#
Session mode of the optical system.
Possible values are [‘FromPreferences’, ‘SessionOn’, ‘SessionOff’], or zospy.constants.SessionModes.
- property SystemData: ZOSAPI.SystemData.ISystemData#
Data for configuring everything in the system explorer.
Examples
Change the aperture type to “FloatByStopSize”:
>>> oss.SystemData.Aperture.ApertureType = zp.constants.SystemData.ZemaxApertureType.FloatByStopSize
Add a wavelength of 543 nm with weight 1:
>>> oss.SystemData.Wavelengths.AddWavelength(0.543, 1)
- property SystemFile: str#
File path to the current optical system.
- property SystemID: int#
Unique identifier for the optical system.
This identifier can be used to differentiate between multiple OpticStudioSystem instances.
Examples
Create two different optical systems in a single instance of OpticStudio:
>>> import zospy as zp >>> zos = zp.ZOS() >>> oss1 = zos.connect_as_standalone(return_primary_system=True) >>> oss2 = zos.create_new_system() >>> oss1.SystemID != oss2.SystemID True
- property SystemName: str#
Name of the current optical system.
- property TDE: ZOSAPI.Editors.TDE.IToleranceDataEditor#
Tolerance Data Editor.
- property TheApplication: ZOSAPI.IZOSAPI_Application#
Application in which the optical system is opened.
- property Tools: ZOSAPI.Tools.IOpticalSystemTools#
Interface to run various tools on the optical system.
- __init__(zos_instance, system_instance)#
Initiate the OpticStudioSystem.
- Parameters:
- zos_instance: ZOS
A ZOS instance
- system_instance: ZOS.Application.PrimarySystem
A PrimarySystem instance obtained from the zos_instance.
- close(saveifneeded: bool = False) bool#
Close the optical system. Only works on secondary systems (See OpticStudio documentation).
- Parameters:
- saveifneededbool
Defines if the current file is saved before opening the new file. Defaults to False.
- copy_system() OpticStudioSystem#
Copy the current OpticStudioSystem instance.
- Returns:
- zospy.zpcore.OpticStudioSystem
A ZOSPy OpticStudioSystem instance. Should be sequential.
- get_current_status() str#
Get the last status of the optical system. If null or the length is 0, then the system has no errors.
- Returns:
- str
Current status of the optical system.
- load(filepath: str | PathLike, saveifneeded: bool = False)#
Load an earlier defined Zemax file.
- Parameters:
- filepath: str | PathLike
Path to the file that should be loaded
- saveifneeded: bool
Defines if the current file is saved before opening the new file. Defaults to False.
- make_nonsequential() bool#
Set the optical system to non-sequential mode if it is not already.
- make_sequential() bool#
Set the optical system to sequential mode if it is not already.
- new(saveifneeded: bool = False)#
Create a new session file.
- Parameters:
- saveifneeded: bool
Defines if the current file is saved before opening the new file. Defaults to False.
- save() bool#
Save the current OpticStudio session.
If the file name for the current session is not known (e.g. when a new file was created), a warning is raised. On these occurences, save_as() should be used once.
Returns (bool): A boolean indicating if the saving was successful.
- save_as(filepath: str | PathLike)#
Save the current session under a specified name.
- Parameters:
- filepath: str | PathLike
The filepath where the system should be saved. Note that a partial path or relative path does not work.
- update_status() str#
Force an update of the system, and returns the current status.
- Returns:
- str
Current status of the optical system.