Know G-code, Fix Cam Package Errors

A project log for Rocking the Horses

Learn how to operate your new CNC router by making a rocking horse, then learn a lot more by setting up for mass production.

JoshJosh 06/09/2016 at 17:550 Comments

New files for SideA-1.ngc and SideA-2.ngc are posted in conjunction with the following.

So it has taken me a few weeks to get some time to look into the issue with the rockers and cutter compensation. I assumed that it was an issue with how Mach 3 interpolates between changes in cutter compensation, but it may be simpler than that.

Dxf2gcode is the software that I used to create the gcode. When the problem occured, I looked at the code and saw that it was applying what appeared to be the proper compensation in the code and Mach 3 printed what appeared to be the correct cutter compensation path. What I didn't do was take 30 seconds an confirm the actual Gcode command issued.

Assuming I needed new lead-ins each time I changed direction, I began to manually add a small offset cut at the end of each path prior to the direction change to provide a new lead in. That's when I noticed that the code was calling G40 at each direction change rather than the required G41 (LH) or G42 (RH). G40 SHUTS COMPENSATION OFF. It wasn't apparent on the Mach3 sim because the first cut produced the proper compensated path, so without rotating the view, each subsequent pass appeared to follow the last.

So only the first cut was applying compensation. Each cut depth after was just cutting on the uncompensated line.

I have replaced the G40 commands with the correct G41 and G42 commands, and I'll be giving it a shot again as soon as I can!

I'll submit a bug report to the Dxf2gcode project.

(edit: after exploring some settings)

It appears that there is an option to turn off compensation between cuts. When this option is enabled, it successfully applies the correct compensation on the next pass. So I will now utilize this option, even though I think it is still erroneous without that option.