1
Mach4 General Discussion / Re: A few MCode questions - Mach 4
« on: May 09, 2019, 03:48:24 PM »
Thanks for the ideas...
1st question - yes the G0 in front of the line solves the problem but... My post processor does not issue the G0 in front of the code (it is going to be a punching machine so no G0 is in front of the line.) and off course M25/M20 are fixed commands and in the same line as movement commands.
Maybe something like this can solve it:
if (mc.mcInEditor()==1) then
mc.mcCntlGcodeExecuteWait(inst,"G0""X"..go to code.."Y"..go to code)
m25()
end
off course ..go to code.. has to be something that makes sence
2nd Question:
The script is just an example - the real script should make the movement on every line an then fire the output on 50ms and turn it off and repeat this procedure on every line until it hits M20.
3rd question:
I may have explained wrong - I was thinking about the the tool path display on the screen.
Thanks,
Zvo
1st question - yes the G0 in front of the line solves the problem but... My post processor does not issue the G0 in front of the code (it is going to be a punching machine so no G0 is in front of the line.) and off course M25/M20 are fixed commands and in the same line as movement commands.
Maybe something like this can solve it:
if (mc.mcInEditor()==1) then
mc.mcCntlGcodeExecuteWait(inst,"G0""X"..go to code.."Y"..go to code)
m25()
end
off course ..go to code.. has to be something that makes sence
2nd Question:
The script is just an example - the real script should make the movement on every line an then fire the output on 50ms and turn it off and repeat this procedure on every line until it hits M20.
3rd question:
3) Yup. In the M125 have it draw the square. In the top of script you should also check the feed rate and G90/91 mode and set them back to what they were before M125 changes them. CV will not work on the square doing it like this. But, why not just run a sb-program each time you want the square? Why reinvent the wheel? Doing it in a macro seems like going around your elbow to get to your thumb.Code: [Select]function m125()
local inst = mc.mcGetInstance()
local rc = mc.mcCntlGcodeExecuteWait(inst, "G91\nG1 F5.00 X1.00\nY1.00\nX-1.00\nY-1.00\nG90")
end
if (mc.mcInEditor() == 1) then
m125()
end
I may have explained wrong - I was thinking about the the tool path display on the screen.
Thanks,
Zvo