The G3 GCode

MiniCups!
Nearly all the GCodes in a file generated by Skeinforge are “G1″ codes.  G1 Codes are codes which direct the CNC print head to a single point in space, at a specific speed.  This is a standard in many CNC robots, but many of them also have additional abilities.  Skeinforge uses many line segments to approximate circular motion, but many CNC systems rely on a method which can have single-step precision: firmware-based circular motion.

G2 and G3 codes both move the toolhead in a circular arc defined thus:

G3 X Y I J

Where X and Y are the coordinates after the move, and I and J are the coordinates of the center of the circle around which the toolhead is moving.  For example if your print head is at (10, 0, 0) and you give it the GCode G3 X-10 Y0 I0 J0, the toolhead will move to (-10, 0, 0) but instead of passing through the origin, the toolhead will move around the origin to that point.  Whether it moves clockwise or counterclockwise depends on whether a G2 or a G3 code is used:

g3vsg2codes

Such precision isn’t always needed– in fact, from what I’ve seen more well-tuned 3D printers accomplish, these codes are rarely necessary.  However, this does point the way towards using more precise firmware to execute movements so small they’d be lost in the conversion error between the GCode and numbers of steps.  Fractal designs whose fine structure goes down to the step size on the bot, for example.

5 Comments »

  1. nophead Said,

    August 5, 2009 @ 3:05 pm

    Its not easy to make use of G2 /G3 because all curves are approximated to lines at the conversion to STL stage.

  2. Allan Ecker Said,

    August 5, 2009 @ 4:28 pm

    This is definitely true when operating in a mesh-based modeling system. However in my Python-based parametric system, using G2/G3 is of equivalent difficulty to G1, which is how the above goblets were made.

  3. Revar Said,

    August 6, 2009 @ 2:08 am

    Your firmware supports G2/G3 codes? The source code I’ve been looking at doesn’t support them at all!

  4. Allan Ecker Said,

    August 6, 2009 @ 10:40 am

    The Arduino-only source code I modified supports G3, but not G2. Presumably there’s a fairly quick way to flip that, but I haven’t done so yet.

    G3 codes have allowed me to do some pretty nifty parametric prints, but like I said I kind of doubt their usefulness in more complex objects…

  5. Chanan Said,

    September 6, 2009 @ 8:26 pm

    Thank you. I did not quite understand I and J till you put it quite simply.

Leave a Comment