Adding M Codes after a specific distance

I designed and built a specialized CNC plasma cutting machine for work that is designed to cut long narrow parts, Mainly cutting holes in angle material to be used as flanges on duct work.
It has a work envelope of 280 inches in the Y direction and 15 inches in the X direction.
It is all together and working well except that there is more smoke while cutting than we would like to see, so I am working on an extraction system for it. The duct for that extraction system is the full length of the machine, which at that length would take a much bigger fan than we want to use.

So what I am doing is building a system of movable gates, 4 in total effectively cutting the duct length by 75%

The controller is a MASSO G3 Touch.

My Idea to control the gates is to use M Codes
M62 - Turn on digital output synchronized with motion,
M63 - Turn off digital output synchronized with motion
Or
M64 - Turn on digital output immediately, and
M65 - Turn off digital output immediately.

In order for this to work I would need SheetCAM to output the M codes based on distance traveled, roughly every 70 inches. Is this something that is doable? If so would need to be done in the post or could it be done with other methods? Variable’s or cutting rules for example

Thanks!!

It seems likely that the gate management with M codes can be handled by the post processor. It seems like the algorithm is something such as:

if Y absolute position => 0 and < 70" then do case1.
if Y abs pos => 70 and < 140 then do case2.
etc.

Is that right ? If so then, further define case 1, 2, etc.

Alternatively, if you want something done from any Y starting position for a distance of 70", or to begin after 70" of travel, then either of those cases can be handled with Path Rules.

Here is the logic I have in mind:

At start of program output M62 P1
At 75.990 output M63 P1 (New Line) M62 P2
At 143.990 output M63 P2 (New Line) M62 P3
At 210.990 output M63 P3 (New Line) M63 P4
Line before M30 output M63 P4 (New Line) M62 P1

Just as an FYI.
The way this machine is setup Machine Zero and Work Zero are always the same

take a look at this pp code, and run the pp as is and review the gcode, even though the gcode may not run on your controller, visually check it for sanity.

in the pp, see the function ppChkExhaustGate(), you should be able to copy and paste it. And search for all cases in how it’s used, you should be able to copy and paste those uses also.

ChkExhaustGate test1.tap (2.1 KB)
ChkExhaustGate test1.job (11.8 KB)
GRBL plasma V2-2 w ChkExhaustGate.scpost (4.9 KB)

That is exactly what I asked for, But now that see the GCode, I see an issue that I didn’t foresee… My test file will show this, but basically what happens is I will get 2 gates “bouncing” if a hole falls in the switchover area.
Is there a way to only post out the M Codes when in G00?

GateTest.tap (24.0 KB)
GateTest.job (41.8 KB)
MASSO G3 Plasma with Scribe and GateControl.scpost (9.6 KB)

Thanks for the help!!!

Can you program some overlap in your gates, so they stay open if the torch moves a certain distance outside of the actual area. This way you would have 2 gates open at the same time when the torch moves between them.

@FabLab - yes, just limit the call to ppChkExhaustGate() to occur in OnRapid(), that is, don’t use it in OnMove() and OnArc().

@djreiswig - that’s a good plan B, but I believe since he’s only cutting holes, the OnRapid()-only solution may work fine and accomplish the same result.

I did as you suggested and looking at the Gcode it looks like this will work just perfect. Once I get everything built and tested I’ll let you know if I see any issues…

Thanks again!!!

1 Like

So, maybe I am trying to get to fancy here, but I thought it would be nice to be able to change the distances from within the GUI, but I cant seem to make it work… Can anyone tell me what I am doing wrong?

Thanks!!
MASSO G3 Plasma with Scribe And GateControl_GUI_Alpha.scpost (10.3 KB)

DefineVariable() does not have a default arg, drop the 211 args in the function calls.
DefineVariable(varName,units,min,max)