Skip to main content
Solved

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

  • December 23, 2022
  • 2 replies
  • 346 views

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

Best answer by David.Nguyen

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

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

2 replies

David.Nguyen
Luminary
Forum|alt.badge.img+2
  • Luminary
  • 1089 replies
  • Answer
  • December 24, 2022

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


  • Author
  • Single Emitter
  • 1 reply
  • January 4, 2023

Thank you!


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