Solved

SETNSCPOSITION/ SETNSCPARAMETER In ZPLM

  • 16 July 2023
  • 2 replies
  • 140 views

Userlevel 2

Hello,

 

I want to push into my model an input file with data regarding new position/ parameters.

When I execute the ZPL code through the GUI (Programing>Edit/Run, F9) it works just fine, but when I try to execute it through the merit function with a ZPLM row it seems that the SETNSCPARAMETER/ SETNSCPOSITION just isn’t working.

I know the MFE is executing the ZPLM since I made a debug output which looks just fine, feels like I’m missing something very basic.

Code snippet:

OPEN INPUT_FILENAME
OUTPUT OUTPUT_FILENAME
READ NUM_OF_PARAMS NUM_OBJ
PRINT NUM_OF_PARAMS, " ", NUM_OBJ
FOR II, 1, NUM_OF_PARAMS, 1
READ PARAM_NUMBER PARAM_VALUE
PRINT PARAM_NUMBER, " ", PARAM_VALUE
SETNSCPARAMETER 1, NUM_OBJ, PARAM_NUMBER, PARAM_VALUE
NEXT
CLOSE

 

An input/output example of the code above:

## INPUT ##

3 18
1 50
2 50000.0
3 0.005

## OUTPUT ##

3.0000 18.0000
1.0000 50.0000
2.0000 50000.0000
3.0000 0.0050

 

Edit: Wanted to point out that my ZPL files are located in Zemax/Macros

icon

Best answer by Ray 17 July 2023, 10:36

View original

2 replies

Userlevel 4
Badge

I think this section of the manual may apply to your case:

 

Userlevel 2

I think this section of the manual may apply to your case:

 

 

So, I’ve tried bypassing this limitation my making a ZPLM that creates a new object row, assigns a ZPL Macro solve on one of its parameters, and that solve is doing the work I mentioned above.

This did not solve the behavior shown above as it still wouldn’t work when running it through the MFE.

 

Oran

Reply