Skip to main content
Solved

concatenate string and variable in ZPL

  • September 17, 2021
  • 1 reply
  • 626 views

John.Hygelund
Fully Spectral
Forum|alt.badge.img+1

Regarding the SETVAR ZLP keyword, want to use a variable to define the ‘Pn for parameter n’. I need to concatenate “P” with my index variable i. How do I accomplish this?

Thank you,

John 

Best answer by Csilla Timar-Fulep

Hi John,

Thanks for you question here on the forums.

You may use the following ZPL macro syntax, where param and surf are integers:

code$ = "P" + $STR(param)
SETVAR surf, code$, 1

For more details about how to use strings in the ZPL macro language, please check out this knowledgebase article:
Working with strings in ZPL Macros – Knowledgebase (zemax.com)

Best,
Csilla

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

1 reply

Csilla Timar-Fulep
Zemax Staff
Forum|alt.badge.img+2

Hi John,

Thanks for you question here on the forums.

You may use the following ZPL macro syntax, where param and surf are integers:

code$ = "P" + $STR(param)
SETVAR surf, code$, 1

For more details about how to use strings in the ZPL macro language, please check out this knowledgebase article:
Working with strings in ZPL Macros – Knowledgebase (zemax.com)

Best,
Csilla


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