Machsupport Forum

G-Code, CAD, and CAM => G-Code, CAD, and CAM discussions => Topic started by: cherokee140d on August 11, 2012, 12:28:47 AM

Title: G-Code access to Variables
Post by: cherokee140d on August 11, 2012, 12:28:47 AM
Does any one know a way of accessing Mach3 (not user) variables from within a G-code program.
e.g. get current x,y,z,a axis position or G52 offests or current speed,feed etc.
Fingers crossed
Thanks, John
Title: Re: G-Code access to Variables
Post by: ger21 on August 11, 2012, 06:44:04 AM
You can write M code macros to do it.
Title: Re: G-Code access to Variables
Post by: cherokee140d on August 11, 2012, 08:49:07 AM
ger21

Thanks for the reply.
Will pursue.

John
Title: Re: G-Code access to Variables
Post by: Jmsandstrom on August 12, 2012, 07:18:05 PM
I have some additional questions to this thread. I now know we can use the variables such as #1, #2, etc... instead of numerical constants. I have used some very simple expressions, but I am interested to use equality expressions to perform some housekeeping function while in a subroutine. Can something like #1=[#1-.25*[#2>0]] work (I know this doesn't) to perform conditional calculations? The equation #1=[#1-.25] works fine. I presume there is more capability to this....I just need a sample or a good reference document to go by.

Can anyone help with reference manuals or good examples?

Thanks,
John
Title: Re: G-Code access to Variables
Post by: ger21 on August 12, 2012, 08:17:39 PM
The manual lists the valid operations.