Hello Guest it is October 19, 2019, 07:16:40 PM

Author Topic: Getting current GCode States  (Read 2039 times)

0 Members and 1 Guest are viewing this topic.

Getting current GCode States
« on: April 23, 2015, 09:42:37 PM »
Is there an easier way to see if am in G90, G0, etc without calling

mc.mcCtrlGetModalGroup();

and then doing clumsy Lua string manipulation to find if they are in the returned string?

I just really want to be able to know if I am in certain G-code modes so I can set it back later after zeroing my tools. 

Re: Getting current GCode States
« Reply #1 on: April 24, 2015, 10:36:27 AM »
Hey guys, answered my own question.  These things are stored as # variables.  I found the Mach 4 Scripting Manual today in the manuals section where the Mach 4 is downloaded , which seems to be new unless I missed it previously.

2134 stores last feed rate
4001 stores G00 or G01 and results as 00 or 10
4003 stores G90 or G91 and results as 910 or 900

How to set variables (excerpt):
Code: [Select]
local CurFeed = mc.mcCntlGetPoundVar(inst, 2134)
local CurFeedMode = mc.mcCntlGetPoundVar(inst, 4001)
local CurAbsMode = mc.mcCntlGetPoundVar(inst, 4003)

Re: Getting current GCode States
« Reply #2 on: April 25, 2015, 10:36:35 AM »
Hey guys, answered my own question.  These things are stored as # variables.  I found the Mach 4 Scripting Manual today in the manuals section where the Mach 4 is downloaded , which seems to be new unless I missed it previously.

2134 stores last feed rate
4001 stores G00 or G01 and results as 00 or 10
4003 stores G90 or G91 and results as 910 or 900

How to set variables (excerpt):
Code: [Select]
local CurFeed = mc.mcCntlGetPoundVar(inst, 2134)
local CurFeedMode = mc.mcCntlGetPoundVar(inst, 4001)
local CurAbsMode = mc.mcCntlGetPoundVar(inst, 4003)


Thanks for all your input to this forum Gerber Baby. I can't find "Mach 4 Scripting Manual" in the Docs folder of the Mach4Hobby install (2336) and it's not where Mach 4 is downloaded. I don't see a "manuals section" either. Appreciate any help. Thanks, Tony
 
Re: Getting current GCode States
« Reply #3 on: April 25, 2015, 10:51:15 AM »
Left side of the screen under 'Help and Learning'.

Didn't know it was there until Gerber Baby's post.  Thanks!

Peter
Re: Getting current GCode States
« Reply #4 on: April 25, 2015, 11:04:00 AM »
Thanks, I didn't see that before either.

Tony
Re: Getting current GCode States
« Reply #5 on: April 26, 2015, 12:22:32 AM »
Thanks guys.  Happy to be here.  Let me know if you see a list of the pound vars, b/c I'm kind of wandering around in the dark on that one.  This thread has the best list I've seen so far: http://www.machsupport.com/forum/index.php/topic,27264.20.html

Also, here's the link to the LUA Scripting Manual if anybody wants it:
http://www.machsupport.com/help-learning/product-manuals/

Offline dude1

*
  •  1,253 1,253
    • View Profile
Re: Getting current GCode States
« Reply #6 on: April 26, 2015, 01:39:56 AM »
A lot of what you boys require is in M4 tool box