Hello Guest it is April 24, 2024, 09:12:43 PM

Author Topic: G-Code access to Variables  (Read 2740 times)

0 Members and 1 Guest are viewing this topic.

G-Code access to Variables
« 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

Offline ger21

*
  • *
  •  6,295 6,295
    • View Profile
    • The CNC Woodworker
Re: G-Code access to Variables
« Reply #1 on: August 11, 2012, 06:44:04 AM »
You can write M code macros to do it.
Gerry

2010 Screenset
http://www.thecncwoodworker.com/2010.html

JointCAM Dovetail and Box Joint software
http://www.g-forcecnc.com/jointcam.html
Re: G-Code access to Variables
« Reply #2 on: August 11, 2012, 08:49:07 AM »
ger21

Thanks for the reply.
Will pursue.

John
Re: G-Code access to Variables
« Reply #3 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

Offline ger21

*
  • *
  •  6,295 6,295
    • View Profile
    • The CNC Woodworker
Re: G-Code access to Variables
« Reply #4 on: August 12, 2012, 08:17:39 PM »
The manual lists the valid operations.
Gerry

2010 Screenset
http://www.thecncwoodworker.com/2010.html

JointCAM Dovetail and Box Joint software
http://www.g-forcecnc.com/jointcam.html