Page 1 of 1

Macro - validation of arguments

Posted: Tue Jan 17, 2023 8:46 pm
by dplain
Is there a way to test macro arguments to see if they are present?

In Haas if I call "G65 P100 A1 B2" I can check in the macro if the argument is or is not present by testing it against #0 (which is not-a-number)

O100 (macro)
(test for argument 1)
if [#1 NE #0] GOTO1
#3000 = 1 (argument #1 is not valid)
N1
argument #1 is valid

(test for argument 2)
if [#2 NE #0] GOTO1
#3000 = 1 (argument #2 is not valid)
N1
argument #1 is valid

If I call "G65 P100 B2" the first argument test will fail because it doesn't exist.

Re: Macro - validation of arguments

Posted: Tue Jan 17, 2023 9:12 pm
by cncsnw
Unfortunately no.

On the Centroid control, any non-specified argument will appear to have been passed with a value of 0.0

If, in the context of your macro, zero is not allowed, then you can usefully test against it. If zero is a legitimate value, then there is nothing you can do.