Hello Guest it is April 19, 2024, 04:37:12 AM

Author Topic: Trying to use variables in g code - not working - must be something obvious?  (Read 1610 times)

0 Members and 1 Guest are viewing this topic.

Hi

I'm trying to get started writing some macros of my own. As a starting point I'm writing some simple g-code and running that like any normal job but the variables don't seem to be working. I've a really simple example below, define x, y and z coordinates as variables and then move to that location but when I run the job the machine simply moves to 0,0,0?

I'm running Mach 4. Suggestions on a postcard?

N000 G00G21G17G90G40G49G80
N010 G91.1
N020 G94
N030 #1001=75.0
N040 #1002=57.5
N050 #1003=-20
N060 G0 X#1001 Y#1002 Z#1003
N060 G0 X[#1001] Y[#1002] Z[#1003]
Thanks but I'd tried that and every combination I could think of i.e. declarations in square brackets, values in square brackets, wearing a pair of square brackets while typing the code, etc. :-) Still just returns to zero.

I'm running the latest development build of Mach 4, 3130. Might try rolling back to the GA build.

thanks

tommy
Your code works in my early version: 4.2.0.2803