81
Mach4 General Discussion / Re: Setting zero positions for G30
« on: November 16, 2021, 09:17:07 AM »
I have the following in my RefAllHome script.
--Set G30 # variables, S1000, and turn on Soft Limits
mc.mcCntlSetPoundVar(inst,5181,11.7)
mc.mcCntlSetPoundVar(inst,5182,-.5)
mc.mcCntlSetPoundVar(inst,5183,-.02)
mc.mcCntlSetPoundVar(inst,5184,2.00)
mc.mcCntlGcodeExecuteWait(inst, "S1000")
mc.mcCntlSetLastError(inst, "G30 # Variables set, S1000 set")
SetSoftlimits()
end
That sets the # variables for G30 to a distance from machine coordinate zero, where ever you want it to be. I'm sure this code could be elsewhere, but the goal is to set the # variables. You might could even set the registers or something, but I chose to code it to be safe!!
Then a Gcode line, G0 G91 G30 X0, goes there.
Strangely, to me, G0 G90 G30 X0 goes to G54 X0 first, or whatever work coordinate you're currently in, then to G30 X0. I learned this the hard way, and for me, at least, I'm usually in G90. I changed my post to post G30's this way, but if you MDI it you gotta remember that.
OH, and you need the P1 G30 # variable, IN the text file Craig referenced, but not stated explicitly as P1. P1 is just my guess and they're way outta the range of the other G30 # variables!!!
I learned all this working with Chad Byrd after he tricked Autodesk into implementing proper G30 a few years ago!!
Tom
--Set G30 # variables, S1000, and turn on Soft Limits
mc.mcCntlSetPoundVar(inst,5181,11.7)
mc.mcCntlSetPoundVar(inst,5182,-.5)
mc.mcCntlSetPoundVar(inst,5183,-.02)
mc.mcCntlSetPoundVar(inst,5184,2.00)
mc.mcCntlGcodeExecuteWait(inst, "S1000")
mc.mcCntlSetLastError(inst, "G30 # Variables set, S1000 set")
SetSoftlimits()
end
That sets the # variables for G30 to a distance from machine coordinate zero, where ever you want it to be. I'm sure this code could be elsewhere, but the goal is to set the # variables. You might could even set the registers or something, but I chose to code it to be safe!!
Then a Gcode line, G0 G91 G30 X0, goes there.
Strangely, to me, G0 G90 G30 X0 goes to G54 X0 first, or whatever work coordinate you're currently in, then to G30 X0. I learned this the hard way, and for me, at least, I'm usually in G90. I changed my post to post G30's this way, but if you MDI it you gotta remember that.
OH, and you need the P1 G30 # variable, IN the text file Craig referenced, but not stated explicitly as P1. P1 is just my guess and they're way outta the range of the other G30 # variables!!!
I learned all this working with Chad Byrd after he tricked Autodesk into implementing proper G30 a few years ago!!
Tom