Quote Originally Posted by zedodia View Post
Thanks Deadlykitten for the long winded answer.
Hello zedodia,
Empty vessels make the most noise.

With regards to your question,

In your example code below, there would be no requirement to pass #100 and #101 in MACRO1 PROG and MACRO2 PROG respectively, as they are Common Variable, seen by all programs.

MAIN PROG
#100=40
#101=60
G0 X0 Y0 Z0
G1 X100 Y100 Z0
G65 <MACRO1> A20 <----A20 MAKES LOCAL VARIABLE #1=20
G0 X0 Y0
M2

MACRO1 PROG
G1 Z#1
G1 Z0
G65 <MACRO2> B#100
M99

MACRO2 PROG
G1 Z#2
G1 Z0
G65 <MACRO3> C#101
M99

MACRO3 PROG
G1 Z#3
G1 Z0
M99

If you wanted to pass Local Variables through Nested Macro Programs and not set Common Variables in your Main program, you could pass all of the Local Variables used in MACRO1 PROG, MACRO2 PROG and MACRO3 PROG via the Call Block in MAIN PROG.

G65 A20 B40 C60 (IN MAIN PROG)

then

G65 B#2 C#3 (IN MACRO1 PROG)

and

G65 C#3 (IN MACRO2 PROG)


Regards,

Bill