G20 vs G21 Sizing of Test Cut

Post technical questions about the Buildbotic Controller here.
Forum rules
No profanity, no gambling, no illegal activity, so sexual or pornographic material.

Posts not related to the Buildbotic CNC Controller are likely to be moved or deleted.
Post Reply
Midnight-Maker.com
Posts: 3
Joined: Wed Apr 27, 2022 8:16 pm

G20 vs G21 Sizing of Test Cut

Post by Midnight-Maker.com » Sat Jun 11, 2022 8:09 am

In Carbide Create, I'm using inches. I create a test file that fits within an 18" square. I then export it and the gcode has a G21. When I do the 3D preview, it's the correct size. When I run the program, it goes to mm and runs off the end of the table. When I change the G21 to G20, the 3D preview is huge and the program says NO FIT. What am I doing wrong?

User avatar
Doug
Posts: 343
Joined: Fri Feb 02, 2018 4:56 pm

Re: G20 vs G21 Sizing of Test Cut

Post by Doug » Sat Jun 11, 2022 3:40 pm

If the gcode program that is exported from Carbide Create has a G21, then the distances in the gcode must be in millimeters. G21 sets the state to 'Metric'.

However, if the Buildbotics controller somehow misinterpreted the gcode to be Imperial but the program was written for Metric, then the result would be very large.

One way this can happen is if your program encounters a tool change after the G21 and the tool change sequence changes the units to Imperial but then does not change it back at the end of the sequence. This is prevented by inserting an M70 at the beginning of the tool change sequence and an M72 at the end of the tool change sequence. M70 pushes the state (including units) and M72 recovers the state that was pushed with the most recent M70. That way, the tool change sequence can change the units and they get changed back when it is done.

The tool-change sequence is defined in the 'tool-change' text box on the Settings->General page.

Post Reply