Skip to main content

Loading User Defined Surface dll with ZOS API python and Matlab

  • February 17, 2022
  • 0 replies
  • 472 views

Sahil
Forum|alt.badge.img+1

In opticStudio ,we can set User defined surface through Python and Matlab program using standalone and Interactive Extension.

-Set the user defined surface 

-Select the User defined surface from directory

-Get the User defined surface

Matlab Code:

You can directly copy the code in Standalone or Interactive Extension:

   import ZOSAPI.*;

    % Set up primary optical system

    TheSystem = TheApplication.PrimarySystem;

    sampleDir = TheApplication.SamplesDir;

    testFile = System.String.Concat('C:\test\ABCD\ABCD Simple_lens.zmx');

    TheSystem.LoadFile(testFile, false);

    TheLDE = TheSystem.LDE;

    surf2 = TheLDE.GetSurfaceAt(2);

    typeSettings = surf2.GetSurfaceTypeSettings(ZOSAPI.Editors.LDE.SurfaceType.UserDefined);

    filesAvailable = typeSettings.GetFileNames();

    typeSettings.Filename = filesAvailable(5);

    surf2.ChangeType(typeSettings);

    d=typeSettings.Filename;

    disp(d)

 

Interactive Extension Matlab 

Python  Code:

You can directly copy the code in Standalone or Interactive Extension:

# Insert Code Here

testFile =r"C:\Double Gauss 28 degree field.zmx"

TheSystem.LoadFile(testFile,False)

test = str(TheSystem.GetCurrentStatus())

print(test)

TheLDE = TheSystem.LDE;

surf2 = TheLDE.GetSurfaceAt(1);

typeSettings = surf2.GetSurfaceTypeSettings(ZOSAPI.Editors.LDE.SurfaceType.UserDefined);

filesAvailable = typeSettings.GetFileNames();

typeSettings.Filename = filesAvailable(5);

surf2.ChangeType(typeSettings);

print(typeSettings.Filename)

Interactive Extension Python

Download

Did this topic help you find an answer to your question?

0 replies

Be the first to reply!

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