Syntax ZOS API

  • 4 December 2020
  • 2 replies
  • 219 views

Badge

Dear Zemax Team I would like to pick up in surface 21 the parameter 18 from surface 17, in Matlab, something like:


    Par18 = Surface_21.GetSurfaceCell(ZOSAPI.Editors.LDE.SurfaceColumn.Par18);


    TheLDE.GetSurfaceAt(21).SurfaceColumn.Par18.PickupFrom = 17;


But I cannot get it working properly.


Thanks for your help.Best regards


Gabriele


 


2 replies

Userlevel 5
Badge +2

Hi Gabriele,


Thanks for your question here!


You will need to use the GetCellAt member function of the ZOSAPI.Editors.IEditorRow Interface Reference, and then on the resulting IEditorCell instance, you will need to use the CreateSolveType function of the ZOSAPI.Editors.IEditorCell Interface Reference to create a solver. Once the solver is created, you may set up its parameters. And then, finally, you can apply the solver on the cell you want to by using the SetSolveData member function of the ZOSAPI.Editors.IEditorCell Interface Reference. Please note, that the input of the GetCellAt function is the column number not the parameter number.


The process is shown in detail with reference code in Example 07 - Tilt and Decenter Elements. In this example, pick-up solves are set on a Coordinate Break surface. 


You may find further references about how to set up for pick-up solves on other common columns for all surface types (i.e. thickness, radius, etc.)  in Example 15 - Sequential Optimization. In this example a pick-up solve is set on the thickness parameter:



In your case the code will look like this:



ParameterPickup = TheSystem.LDE.GetSurfaceAt(21).GetCellAt(29).CreateSolveType(ZOSAPI.Editors.SolveType.SurfacePickup);
ParameterPickup.S_SurfacePickup_.Surface = 17;
ParameterPickup.S_SurfacePickup_.ScaleFactor = 1;
ParameterPickup.S_SurfacePickup_.MakePickupFromCurrentColumn();
TheSystem.LDE.GetSurfaceAt(21).GetCellAt(29).SetSolveData(ParameterPickup);

I hope this help, but if you have further questions, please let us know and we will be happy to help!


Best,


Csilla

Badge

Dear Csilla,


Thanks a lot for your explanation, it worked perfectly.


Best regards


Gabriele


 


 

Reply