G-Code Question

Greetings. I am adding code to my Fusion360 generated G-Code to turn on the router, pause, turn on the vacuum, pause again and then complete the code.

I ran the code on the simulator at Buildbotics. https://demo.buildbotics.com/#control

When it ran, it appears as if both loads (router and vacuum) are turning on AFTER the first pause. I am sure I have something messed up here and I suspect it will be something easy.

Here is the beginning of my code:

%
(DUST TOP)
(MACHINE)
( VENDOR AUTODESK)
( DESCRIPTION GENERIC 3-AXIS)
(T1 D=0.25 CR=0 - ZMIN=-0.8 - FLAT END MILL)
N10 G90 G94 G17 G91.1
N15 G20
(WHEN USING FUSION 360 FOR PERSONAL USE, THE FEEDRATE OF)
(RAPID MOVES IS REDUCED TO MATCH THE FEEDRATE OF CUTTING)
(MOVES, WHICH CAN INCREASE MACHINING TIME. UNRESTRICTED RAPID)
(MOVES ARE AVAILABLE WITH A FUSION 360 SUBSCRIPTION.)
N20 G53 G0 Z0

(11 INCH)
(T1)
N25 S20000 M3
N26 G4 P5
N27 M8
N28 G4 P5
N30 G54
N35 G0 X-0.1281 Y-5.361
N40 G43 Z1.5 H1
N45 G1 Z0.6 F160

I found something similar in this thread but I don’t know if this would be the same issue since I am just running a simulation. Also… Where are these settings he is talking about at the end?
https://forum.onefinitycnc.com/t/auto-router-turn-on-code-question-re-pause/8253/6

Doesn’t the s param need to be after the m3? Also it may be a simulate vs actual controller difference. I use the tool enable pins on the breakout and not the load circuits though too. Also not using a spindle so speed settings don’t apply.

1 Like

That is on the machine itself. I was the one who posted that video and solution. I am not in front of my machine at the moment, but if you open the side menu on the controller interface, go to tool settings and you will find them there.

Hey Ziggy,

This would be the case if with your relays, you have connected the router and the dust collection on ‘load-1’ and/or ‘load-2’ instead of ‘tool-enable’ pin. Is this the case? In your G-code example, the “M3 spindle forward run” command is before the first “G4 Px” pause and the “M8 workpiece flood coolant on” command is after this pause.

The ‘load-1’ and ‘load-2’ outputs on Buildbotics & Onefinity Controllers are for workpiece coolant because they are switched on with the commands “M7 mist coolant on” and “M8 flood coolant on”. However turning the milling motor on is done with “M3Sxxx” command. On Buildbotics & Onefinity Controller, the latter works out-of-the-box for ModBus-controlled VFDs, and for milling motors on a relay, it is supported by them via the ‘tool-enable’ pin, which is switched on by “M3Sxxx” too.

By the way, the spindle coolant pump always has to be controlled via a relay attached to VFD, not to CNC Controller. This is because the VFD knows whether the spindle runs (and needs cooling) or not.

So if the relay with which your router is switched on and off is connected to ‘load-x’ pins of CNC Controller (instead of ‘tool-enable’ pin), then it is switched on with M7 or M8 commands instead of (correctly) M3Sxxx – thus the first pause is not honored then.

Hey BJ,

you may set the speed separately, see example here.

Thanks for the replies!

I tried it today on the actual machine and it worked perfectly. I guess it has something to do with the Buildbotics simulator.