I own a CNC machine (Shapeoko 3 XXL) which I use to make projects that require good 90° angles, and I have been through several steps of improvement/calibration of the machine that are described in the documentation. However the rails of the machine's frame are nearly impossible to "square" below a deviation of about 1mm/meter or 2mm/meter. Besides that, the rails may be slightly different and some unknown factors can play a role an reduce precision of the machine. I suppose however that repeatability is far better than actual precision.

So I have though of something: why not measure the difference between the CAD and the result on several points on the xy plane of the machine and apply a correction to recalculate the CAD model, or even better, just the Gcode?

It makes so much sense that I thought I would easily find a computer program that already has been designed to apply such corrections on the Gcode, but I didn't fin any result on any search engine. Have you ever heard of such a project?

  • $\begingroup$ This exists already in 3D printer firmware - have a look at that $\endgroup$ – Jonathan R Swift Mar 17 at 14:11
  • 1
    $\begingroup$ Adjusting the process to measurements is an established concept. It is sometimes done for dimensions of size, on a per-batch basis -- on "real" CNC machines (often via "cutter comp"), on injection molded parts (temperature and time settings can be used to tweak dimensions via effect on shrink rate), even in microchip type lithography. In your case, it sounds like you want to correct the XY squareness (?) so you may be fighting lack of machine stiffness too. That would make it a little more complicated. I don't see why it shouldn't work, if the errors are reproducible. Cut a "square" test part. $\endgroup$ – Pete W Mar 17 at 16:04
  • 2
    $\begingroup$ As Jonathan R Swift suggests, it's inherent in many 3d printer designs. Consider to search for mesh bed leveling, which does what you describe on the x-y plane of the printer bed. $\endgroup$ – fred_dot_u Mar 17 at 18:59

After searching for solutions online I decided to write my own code to do this task.

The python script is available here: https://github.com/studioadrienlucca/studioadrienlucca/blob/gcode_corrector/Gcode3stepsCorrector.py

This script assumes that you have a Gcode file that uses G0, G1, G2, G3 commands as well as plane changes G17, G18, G19

It assumes also that you have made a 60x60 cm square on your machine and measured the sides and diagonals of the real output.

The script will revrite your Gcode using only G1 commands, with parameters associated to arc linearization.

Unfortunately I haven't had the time yet to switch my system ti Python 3 so it is 2.7. The code is a bit messy, but it works.

Anyone owning a Shapeoko 3 and Fusion 360 sould be able to benefit directly from this tool that will automatically correct Gcodes. The Z axis is not corrected because I assume the errors are very small in Z. I also assumes that the bed of the machine has been surfaced parallel to the spindle.

  • 1
    $\begingroup$ Thanks for sharing ☺️ $\endgroup$ – Jonathan R Swift Mar 26 at 15:30
  • 1
    $\begingroup$ if you're interested, I've just fixed some bugs it works perfectly now. I had 6 mm differences on diagonals with my Shapeoko, using this code, the difference is virtually none, the dimensions are perfect and the right angles are right ;) $\endgroup$ – adrienlucca.wordpress.com Mar 28 at 9:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.