Mode: X ruler
Y ruler
X and Y ruler
Perimeter ruler
Squareness marks
Z test four corners
Z test grid
Dense segments
X Acceleration
Y Acceleration
Text
Surfacing
Hog-Out
Start with G92 X0 Y0 Z0:
Z level for pen-down: mm
Z level for pen-up: mm
Rapid Feedrate: mm/min
Raise/lower Feedrate: mm/min
Draw Feedrate: mm/min
Draw Feedrate (slow): mm/min
Low Acceleration: mm/sec^2
High Acceleration: mm/sec^2
Number of Accel Tests: (count)
X Extent: mm
Y Extent: mm
Z Test Cross Size: mm
Dense segments min: mm
Dense segments max: mm
Save bandwidth:
Draw diagonally:
Surfacing stepover: mm
Cutting direction: (N, S, E, or W)
Perimeter:
Orientation: (X or Y)
Pattern count:
Pattern offset: mm
Final feedrate: mm
Final stepover: mm

Ruler Mode

This mode draws many short (~10 mm) segments 1mm apart, with the end result resembling a ruler. These rulers are drawn in pairs, with two rulers drawn next to each other, but drawn in opposite directions.

These are potentially useful for identifying errors in steps per mm, not only for uniform spacing error, but also for nonuniform errors in spacing. These should be uncommon but the test pattern can help identify it or rule it out. By drawing two rulers in opposite directions, backlash (or other similar effects) can be detected. The "perimeter ruler" can also be used to determine whether the machine is square by comparing the diagonals (although it is not a particularly efficient test pattern for just determining squareness).

  • X ruler draws a pair of adjacent rulers along the positive X axis. The "X Extent" setting determines the length to be created.
  • Y ruler draws a pair of adjacent rulers along the positive Y axis. The "Y Extent" setting determines the length to be created.
  • X and Y ruler draws both of the above.
  • Perimeter ruler draws four (pairs of) rulers around the perimeter within a rectangle whose dimensions are specified by X extent and Y extent.

Squareness Marks

Draws four "L" shape marks in the corners of the specified X and Y extent. These marks are possibly useful for indicating the extent of the workspace and can also be useful for testing squarenes.

Z-Test Mode

These modes, Z-Test four corners and Z-Test grid, are for checking whether the work surface is level and flat.

These work by drawing "X" shaped marks, where the pen descends (lowers Z) at a shallow angle as it approaches the center of the X, and then slowly rises (increasing Z) as it moves away from the center of the X. Small differences in the height of the surface create longer or shorter pen marks, effectively amplifying surface height errors to be more easily visible.

The Z Test Cross Size setting specifies the horizontal and vertical dimension of the "X" shape. The default value of 14 mm has a corner-to-corner diagonal length of about 20 mm, or corner-to-center length of about 10 mm. With a Z travel of 1 mm (from +0.5 to -0.5) the shallow descent and ascent is at a slope of about 1:10. This means a Z displacement is reflected in segment length amplified by a factor of 20.

For Z-Test grid mode, as many as possible "X" shapes are fit, evenly spaced, within the specified X and Y extent.

Dense Segments

To test parsing and communication speed, this generates line segments that are drawn using a large number of very short G1 segments end-to-end in the same direction.

The lines are drawn in the positive X direction, and the total length is determined by X Extent. Multiple subdivision lengths are tested, each offset by 1 mm in the Y direction. The Y Extent determines the Y size of the final drawn pattern, which is also the number of subdivision lengths to be tested. The "Dense segments min" is the smallest subdivision length that is tested, and the "Dense segments max" is the largest subdivision length. For each 1 mm increment in the Y direction, the subdivision length is increased linearly between the min and max.

The g-code also contains comments showing the subdivision lengths before each line is drawn.

As an additional option to see the possible influence on processing speed, a more efficient mode can be enabled by checking "Save bandwidth". This generates the same toolpath but does not repeat the Z, Y, or F values any more than necessary.

Acceleration Test

Generates gcode to test acceleration. Assumes junction deviation is being used, in which case "jerk" (instantaneous speed change for low enough speed difference) should not be in effect.

The generated g-code will issue M501 at the beginning and at the end, to minimize the chance that modified acceleration settings will leave the machine in a bad state.

The basic idea for (let's say x acceleration) is:

  1. Draw a short segment in the positive y direction
  2. Set high acceleration using M204 to set the default travel acceleration and M201 to set the max acceleration for the axis being tested (X or Y)
  3. Move slowly ramping up speed in +x direction and change direction suddenly to the -x direction and gradually slow to a stop
  4. Set default and max acceleration back to default value of 180
  5. Draw a short segment directly above the line from step 1
  6. Move over in +x direction a bit and repeat from step 1
  • The low acceleration is the minimum acceleration of the test.
  • The high acceleration is the maximum acceleration of the test
  • The number of accel tests is the number of segment, high acceleration sequence, segment iterations
  • The segments are always 10mm long with a 1mm gap between them
  • The drawing feedrate is used to draw the two segments
  • The sideways step between acceleration tests is always 2mm
  • The rapid feedrate is the speed at which the acceleration is tested
  • The X (or Y) extent is the length of the speed ramp
  • A short diagonal move is performed before each segment is drawn, so the line position would be consistent even if there were backlash.

Text Generation

Generates toolpaths from text, using a fixed-width font, which is potentially useful for ASCII art.

This requires firmware support for G5 (Bezier splines)! This is not enabled by default in MPCNC firmware, but it is fairly straightforward to enable.

The text is stretched to fill a rectangle defined by X Extent and Y Extent. This can create extremely stretched or squished characters which might not be desirable. Strongly recommended: look in the g-code comments at the x pitch and y pitch and y/x aspect ratio, which can indicate if the generated text is likely to be of the size and proportion you want.

Spoil Board (or Workpiece) Surfacing

Generates strokes at a given depth traveling in only one direction.

If the router is not quite perpendicular, then one side will cut slightly deeper than the other. This is not normally an issue for small-diameter bits but the amplitude is larger for large-diameter bits.

It is assumed that the bits are intended for cutting radially and not on axially, so the deeper-cutting side should be the leading side. A standard pocketing tool path from Estlcam for example will traverse back and forth in opposite directions. With the deeper side leading, it will cut radially, but in the opposite direction the leading edge will cut slightly shallow and the trailing edge will cut axially or possibly rub and generate heat.

Therefore the cutting strategy for this cut is to cut only one direction, lifting the bit between cuts. The cutting direction is specified and must be "N", "S", "E", or "W", which cut in the +Y, -Y, +X, and -X directions, respectively.

As an added feature, the cutting toolpath is split into relatively small segments instead of being single, very long G1 movements, which allows dynamic adjustment of the feedrate via the Octoprint interface or the LCD.

Note the recommended feedrates for surfacing are quite a bit slower than for drawing and must be chosen manually. The defaults are unlikely to work well!

Note that the X extent and Y extent are the extent of travel of the center of the cutting bit. The pocket size will be larger by the diameter of the cutting bit.

The 'perimeter' option is for endgrain cutting boards or other situations where some cuts can cause tearout. Before surfacing, the tool traces the perimeter clockwise (twice) to ensure the perimeter is cut with the tool cutting into the workpiece instead of cutting out ofthe workpiece. Here is an example of using the perimeter option to surface some endgrain veneer, which is prone to chip-out if the perimeter option is not used:

Hog-Out Optimization

This test is intended to answer the following question: for a given material and a given combination of tool, stepover, and depth, how does feedrate affect accuracy (deflection), and how high a feedrate is possible? Using arbitrary conservative numbers without experimenting might leave a lot of performance on the table. Knowing the behavior at high speeds allows a more informed choice of speeds.

The test works by first preparing a "top-hat" shape at low speed, first with a slotting cut and then a finishing pass so the top-hat profile is fairly precise. Then at high speed, the tool cuts through (see video). If the tool deflects due to the cutting load, it can be measured. Higher speeds are expected to produce higher loads and higher deflection. The sound and overall quality can also be evaluated subjectively.

This allows determining the highest viable speed by pushing higher and higher feedrates experimentally without generating a lot of wasted parts.

Recommended starting values for wood with 1/8" bit:
Z height of cut: -6 mm
Z clearance level: 0.5 mm
Rapid Feedrate: 2000 mm/min
Raise/lower Feedrate: 180 mm/min
Cutting Feedrate: 600 mm/min
Slotting Feedrate (slow): 300 mm/min
Stepover: 1.5 mm

Text:
Github repository here: https://github.com/vector76/gcode_tpgen
Questions, suggestions, feature requests are welcome.