Archive for the “Cnc” Category

In some cases it might be convenient if we can split a gcode file into smaller pieces so they can be milled in small sections.

How does a typical gcode file, produced by pcb-gcode-3.5.2.11 look like? I suspect to find a header section like:

  • Initialisation
  • Move spindle up.

Sample of the top 15 lines of a test file. The section I consider header is in bold.

G21
(Absolute Coordinates)
G90
G00 X0.0000 Y0.0000
M03
G04 P3.000000
G00 Z2.5400
G00 X1.6917 Y9.2837
G01 Z-0.1778 F254
G01 X3.3883 Y9.2837 F508
G01 X3.5576 Y9.3174
G01 X3.7171 Y9.3834
G01 X3.8606 Y9.4793
etc
etc

First of all it looks like the file indeed has a header section. Let’s see what the codes mean.

[table id=1 /]

That’s it. All there is to the header. I suspect to find a footer as well, but let’s look at the miling parts first.

When milling a line segment it can simply be defined as:

  • Position the spindly just above the linesegment to be milled
  • Move spindle down into the pcb (negative Z movement)
  • Move the spindle around (mill the line segment) without any changes to the height (Z movement)
  • Move spindle up from the pcb (positive Z movement)

G00 X1.6917  Y9.2837
G01 Z-0.1778 F254
G01 X3.3883  Y9.2837  F508
G01 X3.5576  Y9.3174
etc
G01 X1.5224  Y9.3174
G01 X1.6917  Y9.2837
G00 Z2.5400

[table id=2 /]

Milling a line segment by means of the G01 linear Interpolation is in fact pretty straight forward it seems.

Let’s try to identify the footer. It wraps up operation so it will look like:

  •  Move the spindle out of the way
  • Stop the spindle
  • Stop the program

 

G01 X-0.6316 Y0.4907
G01 X-0.6316 Y0.4907
etc
G01 X1.8840  Y0.9641
G00 Z2.5400
G00 Z12.7000
M05
M02

[table id=3 /]

All in all it looks like a relative simple gcode file like this can be split into smaller sub programs complete with header and footer.

 

Comments Comments Off on Gcode analysis – can we split it?