Most G Code programs should have a preamble that resets any state which could change the behavior of your program. This includes setting the current plane (G17-G19), setting absolute vs incremental distance mode (G90 vs G91), setting your feed rate mode (G93-G95) as well as others. If your preamble is missing key settings, then your program may run differently based on the current state of the machine (i.e. it may run differently when the machine is first turned on vs after another program has run or even partially run).

Below is a G Code program with a poorly constructed preamble. Try running this program, then make sure the simulator is at the very end of the program by using the program slider. Press the Stop Program button. This will simulate the program completing on your machine. Pressing the Run Program button will reinterpret the whole program beginning with the current state of the machine. Since the preamble doesn’t properly set the state of the machine, it runs differently the second time through.

Rapid VS Feed Rate Moves

Rapid moves are issued with the G0 command. Rapid moves assume the tool will not be in contact with material and can move at the fastest speed the machine is capably of. Rapid moves can be used to position the tool before machining any material. Feed rate moves are used to control the speed at which the tool moves. Often, the feed rate is specified in units per minute (the feed rate mode specified by G94). For the linear axes this is either inches per minute or mm per minute depending on your programmed units (G20 is inches, G21 is mm; one of these should be set in your preamble). When issuing only rotary axes, G94 will switch to degrees per minute. This cause confusion when mixing rotary and linear moves. The recommended way to issue combined rotary and linear moves is to use G93, inverse time feed rate mode.

Run the program below. Notice how when G94 is active the move slows dramatically when issuing the rotary move. Using G93 we can more accurately control the speed by specifying how much time we want the entire move to take.