Menu

Home

gralfca

Py2g

This is a set of tools to generate g-code from python. This g-code can then be used in cnc machines (such as this or this).

Sometimes you just want to carve a 2d surface to different depths. Py2g helps doing that by providing simple to use methods that you can use to perform carving primitives.

For instance, let's say you want to build a piece for holding a wheel to a motor in a small robot toy. You could create the hole for the rotor, then extrude an octagon (easier to manually handle than a circle) and add holes for the screws. Py2g provides python primitives for each of these operations. You just need to initialize the system by providing some basic data, and then py2g helps you generate a string with the g_code_generator. The code for the wheel attachment or better wheel coupling is given as an example in the code.

A picture of axis (linuxcnc) running the wheel coupling generated g-code is provided with the screenshots.

screenshot

If you're new to python, you can copy the code and base your programs on the wheel attachment example. And then run it: "python wheel_attachment.py".

This is simple code but I consider it very useful for me. I hope it will be useful for you as well.

Py2g is released under the LGPL license.


MongoDB Logo MongoDB