Question

Get Primary system file name

  • 2 November 2023
  • 2 replies
  • 31 views

Hello all,

I am new to the ZOS API, and would like to know how to get the file name once the connection has been done. I am using Python and I have tried :

 

TheApplication = TheConnection.ConnectAsExtension(0)

TheSystem = TheApplication.PrimarySystem

print(TheSystem.SystemName) 

 

but I can’t get the name of the zemax file. Any idea how get it?


2 replies

Userlevel 6
Badge +2

Use

TheSystem.SystemFile

This returns the full file path.  If you just want the file name, you can import os and use:

file_name = os.path.basename(TheSystem.SystemFile);

 

Use

TheSystem.SystemFile

This returns the full file path.  If you just want the file name, you can import os and use:

file_name = os.path.basename(TheSystem.SystemFile);

 

Thank you Michael.

Reply