Machsupport Forum
Mach Discussion => Mach4 General Discussion => Topic started by: gabedrummin on June 20, 2022, 11:15:54 AM
-
Can any one help me and explain G53 G0\nG53 G1 F3000 A% 4.4F, What dose all this do or mean ? Thank you
-
Hi,
the block of code does not look complete.
G53 G0\nG53 G1 F3000 A% 4.4F
G53 G0, the first line, say in machince coords (G53) execute a G0 (rapid traverse move) to..... there is no destination, ie the block is incomplete. In the event it will do nothing
\n is a new line, so all code that comes after is a new line or block of code.
G53 G1 F3000 A% 4.4F G53, says in machine coordinates, G1 is a cutting move at feedrate F=3000 to location A (A axis) with the number of format 4.4f, thats is four significant digits before the decimal point and
four digits after the decimal point. The issue here is that no source for the number has been nominated, who xcares about its format if there is no number?
Craig
-
function m6()
local inst = mc.mcGetInstance() --Get the instance of Mach4
mc.mcCntlGcodeExecuteWait(inst, "g04 p500")
mc.mcCntlCycleStart(inst)
local currentTool = mc.mcToolGetCurrent(inst) --looks for the tool currently selected
local selectedTool = mc.mcToolGetSelected(inst) -- looks at the tool you have selected
local tpos = (selectedTool * 60) --Tool position is the current tool number * 60 (example tpos = (selected tool) Example tool 2 --> 2 * 60 = tpos = 120)
local Out = mc.mcSignalGetHandle(inst, mc.OSIG_OUTPUT21) --Get handle for output 22 and set to "out" variable
local release = ((currentTool * 60) + .5)
--local currentTool = 1
--local selectedTool = 4
if (selectedTool ~= currentTool) then --Change tool: if the selected tool isnt = to the current tool, you want to change your tool
local hReg, rc = mc.mcRegGetHandle(inst, "iRegs0/CurrentSlot")
if (selectedTool > currentTool) then
mc.mcCntlGcodeExecuteWait(inst, string.format("G53 G0 \nG53 G1 F3000 A%4.4f", ( tpos + .1 )))
mc.mcCntlGcodeExecuteWait(inst, string.format("G53 G0 \nG53 G1 F3000 A%4.4f" , tpos)) --Reference, move to position, back up to lock position
mc.mcCntlGcodeExecuteWait(inst, "g04 p500")
mc.mcCntlGcodeExecuteWait(inst, string.format("G53 G0 \nG53 G1 F3000 A%4.4f", ( tpos - 35 )))
rc = mc.mcRegSetValue(hReg, selectedTool)
mc.mcToolSetCurrent(inst, selectedTool)
elseif(selectedTool < currentTool) then
--mc.mcSignalSetState(Out, 1) --Turn OUTPUT21 on
--mc.mcCntlGcodeExecuteWait(inst, string.format("G53 G0 \nG53 G1 F3000 A%4.4f", ( tpos - 30 )))
mc.mcCntlGcodeExecuteWait(inst, string.format("G53 G1 F3000 A%4.4f", ( release )))
mc.mcCntlGcodeExecuteWait(inst, "g04 p1000")
mc.mcSignalSetState(Out, 1) --Turn OUTPUT21 on
mc.mcCntlGcodeExecuteWait(inst, "g04 p1000")
--mc.mcSignalWait(inst, out, WAIT_MODE_HIGH, 2.); -- we waitup to 2 seconds for input 21 to go high
mc.mcCntlGcodeExecuteWait(inst, string.format("G53 G0 \nG53 G1 F3000 A%4.4f" , tpos)) --Reference, move to position, back up to lock position
--mc.mcSignalSetState(Out, 0) --Turn OUTPUT21 off
mc.mcCntlGcodeExecuteWait(inst, "g04 p1000")
mc.mcSignalSetState(Out, 0) --Turn OUTPUT21 off
mc.mcCntlGcodeExecuteWait(inst, string.format("G53 G0 \nG53 G1 F3000 A%4.4f", ( tpos - 35)))
rc = mc.mcRegSetValue(hReg, selectedTool)
mc.mcToolSetCurrent(inst, selectedTool)
end
end
--This function is here to allow the debugging from the Lua editor
if (mc.mcInEditor() == 1) then
m6()
end
end
--end
-
Hi,
mc.mcCntlGcodeExecuteWait(inst, string.format("G53 G0 \nG53 G1 F3000 A%4.4f", ( tpos + .1 )))
To my way of thinking the G53 G0 does nothing other than put the mode in G0 or rapid mode. Note G53 is not modal, it has to be specifically mentioned whenever
you want a machine coord move.
The second line 'G53 G1 F3000 A%4.4f", ( tpos + .1 )' will cause the machine to drive the A axis to machine location 'tpos+0.1' at feedrate 0f 3000, the '%4.4f' just represents a formatted placeholder for the number.
Craig
-
Thank you sir , so my tool changer has 6 positions divided by 6 positions it should move 60 degrees . Dose the
+.1 mean it will move 61 ?or is it 60.1 ? Thanks again sir.
-
Hi,
I would guess if tpos=60 degrees then tpos + .1 = 60.1 degree.
Doesn't seem enough. I would have thought that you want to go past the detent by a few, say 5 degrees, and then back up into the lock.
0.1 degree does not seem like you could reliably have gone beyond the lock.
Craig