Hi Mike,
With help of Allie, I found your forum poste. Sorry I did not find your poste yesterday and sent you a general solution in case you have lots of parameters to modify.
The modified macro can be:
!parameter calcualtion
T3 = THIC(3) # Varies from unity during op
R7 = RADI(7) * T3
R8 = RADI(8) * T3
R9 = RADI(9) * T3
T7 = THIC(7) * T3
T8 = THIC(8) * T3
! set parameter
SETSURFACEPROPERTY 7, THIC, T7
SETSURFACEPROPERTY 8, THIC, T8
SETSURFACEPROPERTY 7, CURV, 1/R7
SETSURFACEPROPERTY 8, CURV, 1/R8
SETSURFACEPROPERTY 7, CURV, 1/R9
UPDATE
Do you intend to use this as a ZPLM? I am worried as everytime you run it, it scales the related parameters. Please pay attention to this when use.
Best regards,
Yuan Chen
Optical Engineer
yuan.chen@zemax.com
And the general solution if more parameters are involved:
Use SPRO to get the surface data and scale them, then use SETSURFACEPROPERTY to set up the scaled data.
Since not all parameters are needed to modify, you can build a vector and put the type codes to be scaled into this vector and call it every time.
Here is an example
!put the data into a vector
vec1(1)=2
vec1(2)=3
vec1(3)=5
vec1(4)=6
vec1(5)=10
for i=1,5,1
!call data out of the vector
k=vec1(i)
next
Here is an example of SETSURFACEPROPERTY
Set the thickness of surface 2 to the thickness of surface 1
SETSURFACEPROPERTY 2, THIC, THIC(1)
! Set the value of parameter 4 on surface 11 to 7.3
SURP 11, PARM, 7.3, 4
For more information, please refer to:
The Programming Tab > About the ZPL > Numeric Functions
The Programming Tab > About the ZPL > KEYWORDS (about the zpl) > SETSURFACEPROPERTY, SURP