Solved

How do I retrieve coordinate break tilt about x data using GETVARDATA operand in a ZPL macro?

  • 23 December 2022
  • 2 replies
  • 52 views

How do I retrieve coordinate break value (Tilt About X) from a particular surface number using GETVARDATA operand in a ZPL macro?

icon

Best answer by David.Nguyen 24 December 2022, 12:17

View original

2 replies

Userlevel 6
Badge +2

Hi Victoria,

 

 I don’t think you can easily specify the surface number with this method. Instead, GETVARDATA works on the number of variables. Here is a dummy example:

In this example, I have 3 variables: Decenter X, Decenter Y, and Tilt About X. Tilt About X is the third variable. Therefore, I can use the following ZPL macro:

# Get variable data in VEC1
GETVARDATA 1

# Print third variable value (3 x 5 = 15)
print VEC1(15)

Variable values are multiples of five. 5 is the value of the first variable, 10 the second, and 15 the third, as documented in the Help File (The Programming Tab > About the ZPL > KEYWORDS (about the zpl) > GETVARDATA). The result is as follow:

If you want the Tilt About X parameter of a specific Coordinate Break surface, why don’t you use the numeric function PARM(<parameter_number>, <surface_number>). This function returns the specified surface parameter value. In the same dummy example you can simply write:

PRINT PARM(3, 2)

And it should give you the same result. Note that 3 is the parameter number ( Tilt About X ) and 2 is the surface number.

GETVARDATA returns the surface number associated with each variable, and you could have a for loop that checks whether it matches your specified surface, something like so:


# Target Surface
surface = 2

# Target Parameter
parameter = 3

# Number of variables
num_of_var = VEC1(0)

# Loop over all variables data
FOR ii, 1, num_of_var, 1
# Surface of variable
surf_of_var = VEC1( ii * 5 - 3 )

# Parameter of variable
par_of_var = VEC1( ii * 5 - 2 )

# Test if surface and parameter match
IF ( surface == surf_of_var )
IF ( parameter == par_of_var )
# Print matching variable value
FORMAT 2 INT
PRINT "Surface ", surface,
PRINT ", Parameter ", parameter,
FORMAT 5.5
PRINT ": ", VEC1( ii * 5 )
ENDIF
ENDIF
NEXT

But I think its quite heavier than PARM.

I hope this helps.

Take care,

 

David

Thank you!

Reply