Skip to main content
Solved

Record GUI interaction as ZPL commands?

  • September 20, 2023
  • 2 replies
  • 100 views

Michael.Young
Ultraviolet
Forum|alt.badge.img+1

I was helping a colleague with ZPL the other day. He wanted to know how to set a field as a variable and then constrain it. Additionally, he wanted to do this through a ZPL.

The first part is easy enough. My approach was to expose the field as a variable through the multi-configuration editor using “YFIE”, declaring the solve as “Variable” and then constraining it in the merit function editor with “MCOL”, “MCOG”, or “MCOV”.

For the ZPL portion, I wrote a small script for him demonstrating how to assign a variable in the MCE with ZPL.

CLOSEWINDOW						
! INSERTMCO, 1					# insert a row into the mce.
SETMCOPERAND 1, 0, "YFIE", 0 	# changes the operand to "YFIE"
SETMCOPERAND 1, 0, 1, 1			# assigns YFIE to field no. 1		
SETMCOPERAND 1, 1, 15, 0		# changes the value of row 1 config 1 to 15
SETMCOPERAND 1, 1, 1, 3			# changes the solve type to "V"
BEEP		

This made me think that it would be useful if there were a way to record GUI interactions as lines in a ZPL. For example, I could turn on the proposed feature and a text window would open in the background. When I click on row 1 of the multi-configuration editor and press “insert” a line would appear in the text editor “INSERTMCO, 1”. Once I have completed my task, I would turn off the feature, review the text file and could use it as reference for writing my own ZPL.

I realize that this is easy to conceptualize but perhaps difficult to implement. I didn’t see anything in the help file that resembled this idea. It there a way to do this with Zemax currently? If not, it would be useful as a feature request.

Best answer by David.Nguyen

I’m quite sure OpticStudio doesn’t have this feature, and I like the idea.

I know that ImageJ (or Fiji) has a macro language as well, and I’ve used their macro recorder countless times, see this as an example.

I imagine it must not be easy to implement though.

Take care,

 

David

 

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

David.Nguyen
Luminary
Forum|alt.badge.img+2

I’m quite sure OpticStudio doesn’t have this feature, and I like the idea.

I know that ImageJ (or Fiji) has a macro language as well, and I’ve used their macro recorder countless times, see this as an example.

I imagine it must not be easy to implement though.

Take care,

 

David

 


Michael.Young
Ultraviolet
Forum|alt.badge.img+1

Hi @David.Nguyen ,

Thank you for the reply. The comparison to ImageJ is apropos and the best example that I could think of to offer the Zemax team.

For reference, here is a link to ImageJ’s recorder function,

ImageJ Recorder

Sincerely,

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