Machsupport Forum

Mach Discussion => Mach4 General Discussion => Topic started by: TommyG on August 15, 2016, 09:15:49 AM

Title: Trying to use variables in g code - not working - must be something obvious?
Post by: TommyG on August 15, 2016, 09:15:49 AM
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
Title: Re: Trying to use variables in g code - not working - must be something obvious?
Post by: rhtuttle on August 15, 2016, 11:35:41 AM
N060 G0 X[#1001] Y[#1002] Z[#1003]
Title: Re: Trying to use variables in g code - not working - must be something obvious?
Post by: TommyG on August 15, 2016, 11:53:02 AM
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
Title: Re: Trying to use variables in g code - not working - must be something obvious?
Post by: rhtuttle on August 15, 2016, 12:38:25 PM
Your code works in my early version: 4.2.0.2803