G-Code Ripper

Read, Probe (uneven surfaces), Split, Wrap, Scale, Rotate and add Backlash Compensation to G-Code.

Download Scorch Works Home


G-Code Ripper is a g-code reading and manipulation program written in python. The root features of the program were written from scratch. The Graphic User Interface (GUI) is based heavily on the GUIs I wrote for F-Engrave and Dmap2Gcode. G-Code Ripper is a free open source program released under the GNU General Public License (GPL) Version 3.

G-Code Ripper


- Scale g-code
- Rotate g-code
- Split g-code
- Map linear axis to rotary axis (Wrap g-code like CNCWrapper)
- Origin selection allows user to select the location of g-code zero position
- Use inches or mm as export units
- Customizable g-code preamble and postamble
- Reads existing g-code
• Reads "Absolute" and "incremental" coordinates
• Evaluates expressions (i.e. [2*3])
• Understands parameters (i.e. #1,#2 and #<feed_rate>)
• Understands and interprets YZ and ZX arcs (converted to linear motions for compatibility with splitting and rotation)

Change Log

Changes in Version 0.01

- Initial Release

Changes in Version 0.02

- Added feed rate scaling
- Eliminated read abort on N codes (the N code line numbers are simply ignored now)

Changes in Version 0.03

- Added ability to map X or Y axis moves to A or B rotary axis for cutting on a cylindrical surface.
- Added more plot view orientation options

Changes in Version 0.04

- Fixed bug relating to arcs without explicit g-codes (G2, G3) on each line
- Added ability to have zero decimal places on feed rates

Changes in Version 0.05

- Added "Export" to the g-code operations. Now g-code toolpath data can be exported as DXF or CSV (Comma Separated Values) formatted files. With or without rapid motions.

Changes in Version 0.06

- Fixed code to again automatically convert arcs to lines when wrapping code (auto-convert was broken in V0.5)
- Fixed evaluation of equations using exponents "**"
- Added Auto Probe to g-code operations

Changes in Version 0.07

- Fixed bug in "Auto Probe" that caused an error when the Z offset is set to zero.
- Modified code to make it compatible with Python 2.5

Changes in Version 0.08

- Fixed bug in g-code wrapping resulting in mapping failure resulting from to zero length tool path.
- Added logic for dealing with ambiguous start positions (when the tool position is not set by G0 commands before a G1, G2 or G3 command)
- Added a warning pop-up message when assumptions are made about the tool starting position.
- Fixed automatic conversion from arcs to lines when required by conversion type selected.

Changes in Version 0.09

- Increased default decimal places to 1 for the feed rate. The adjusted feed rates for g-code mapped to a cylinder were being rounded to the nearest integer resulting in unpredictable cutting speeds.
- Added the ability to save and read probe data files for auto-probing.

Changes in Version 0.10

- Updated to be compatible with Python 3.x

Changes in Version 0.11

- Fixed a minor bug that cause a failed file read in rare cases (tries to calculate square root of negative number)

Changes in Version 0.12

- Updated the probe data file reading routine to be less sensitive to file formatting
- Fixed error in probe Z offsets when using an external probe data file

Changes in Version 0.13

- Changed "Probe & Cut" to add the "Probe Z Safe" value to the height of the rapid moves ensuring the tool does not crash
- Fixed a bug in the conversion of arcs to lines when the arc spanned more than one Z value.

Changes in Version 0.14

- Added dialog that allows users to skip over errors when reading g-code files
- Fixed bug that prevented the feed rate to return to the input value after a rapid move in a split file until a G1 command was issued
- Fixed bug that resulted in the feed rate being scaled at the z axis scale value
- Fixed variable handling for some cases

Changes in Version 0.16

- Added support for MACH4 auto-probing
- Added pass through for G43 values
- Fixed bug in splitting code

Changes in Version 0.17

- Fixed low travel speed problem with rotary conversion
- Updated icon

Changes in Version 0.18

- Changed how height of rapid moves is calculated in adjusted g-code. No longer adds Z offset value to the rapid height.
- Fixed problem that made the rapid height too high in adjusted g-code because the calculated maximum probe value would never go below zero.
- Added option for selecting if all points are probed or just required points
- Added option for selecting if probe data is saved when running probe and cut operation
- G-code ripper no longer takes into account the rapid moved when determining the design size
- Changed so G-Code Ripper does not try to load a file on startup.

Changes in Version 0.19

- Changed auto-probe safe height calculation with MACH3/4 for "Probe and Cut" Mach was unable to perform the calculated height like LinuxCNC.

Changes in Version 0.20

- Fixed problem that occurred when the Z position was not set by a rapid move before and X,Y move when probing.
(It now uses the first Z position in the g-code for the z-safe for probe moves before a z position is specified.)

Changes in Version 0.21

- Added option to disable the g-code path display (might speed things up for large g-code files
- Fixed handling of G43 commands with G0 moves mixed in on the same line (who writes g-code like that anyway...)
- Bounding box now displays when in auto-probe mode

Changes in Version 0.22

- Added support for DDCS probing to file
- Added pass through for G53 commands
- Changed icon behavior
- fixed problem with comments with parentheses inside parentheses
- Fixed a small problem with Python 3.x

Changes in Version 0.23

- Removed warning message about controlled moves before rapid moves in all three axes. I can see som applications where this is needed so G-Code Ripper now trusts that the user knows what they are doing.
- Added rudimentary backlash compensation to the operations that can be performed on g-code


(Right click on the link and select "Save target as" or "Save link as")
Source files
(zip file)
Windows Executable Files
(zip file)
Python Files Only (zip file)

If the windows executable does not work right away install the
“Microsoft Visual C++ 2008 Redistributable Package (x86)”. The program I use to create the Windows executables (py2exe) has a dependency to this package.


Manual page for G-Code Ripper is here: G-Code Ripper manual

Sample Items Made with Wrapped G-Code

These are lithophanes made from a PVC pipe. The pictures on the left are the lithophanes with backlighting (candle inside pipe). The pictures on the right are the same lithophanes without backlighting.

Sample G-Code Splitting Work flow

This example shows how I cut a design twice the size of my CNC machine travel.
1. Open Existing g-code file using G-Code Ripper.

2. Make the origin "Mid-Center". Enable splitting.
Make the split angle 90degrees

3. Select "Rotate Black" in G-Code Ripper
to rotate the black cuts 180 degrees.
Save the "white" and "Black" g-code files.
4. Prepare the CNC machine and work piece.
I used pins to maintain good alignment
when rotating the work piece 180 degrees
5. Machine the first of the two CNC file that
were generated ("Black" or "White"). It doesn't
matter which one is first)
6. Remove the work piece from the machine and
remount it rotated 180 degrees from the original
orientation. (My pins made this an easy task)
7. Machine the second of the two CNC file that
were generated ("Black" or "White")

8. Here is the final result of the eagle cut into
a piece of scrap. The smaller eagle is the max
size my machine could do without splitting.

9. The finished eagle plague with a little paint


Related Links

F-Engrave: Used to create the V-Carved text on the lake map plaques shown above.
Dmap2Gcode: Dmap2gcode is a depth map image cutting program
CNCWrapper: CNCWrapper is commercial program (~$25) that maps a g-code linear axis to a rotary axis. CNCWrapper also includes context-based g-code editing.