Skip to main content
Question

Get Primary system file name


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

MichaelH
Ansys Staff
Forum|alt.badge.img+2
  • Ansys Staff
  • 355 replies
  • November 2, 2023

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);

 


MichaelH wrote:

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


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings