$ show cnc-club/gcodetools
This repository is an Inkscape extension (gcodetools) that converts SVG vector paths into G-code for CNC machines. It supports a wide range of manufacturing processes including path-to-Gcode export, area clearing (pocketing), engraving with shaped cutters, lathe turning, plasma/laser cutting, box cutter path preparation, graffiti plotting, and bender operations. The extension is activated through Inkscape's extension menu and presents a multi-tabbed interface defined by .inx descriptor files. The core logic resides in a monolithic Python script (gcodetools-dev.py, ~3500 lines) that implements geometric algorithms such as biarc interpolation, cubic superpath offsetting, curvature-based clipping, and a genetic algorithm for part arrangement. The system also includes a post-processor that allows users to apply custom transformations (scale, flip, regex) to the generated G-code via Python expressions. External dependencies include Inkscape's inkex module, Python 2, and optionally numpy/scipy. The codebase is heavily tied to the Inkscape extension API and is not designed as a standalone library. It is primarily targeted at CNC hobbyists and small workshops, with documentation and support in Russian and English.
The LLM identified 3 files worth highlighting for reuse:
A self-contained 2D point class (P) with vector arithmetic, rotation, normalization, and distance calculations. It is used as a foundational building block by csp.py, biarc.py, and other modules. The class is generic and could be extracted for any project requiring 2D point manipulation.
A pure Python PNG image encoder and decoder (pypng) included verbatim. It provides read/write support for PNG images without external dependencies. This is a standalone utility that can be reused in any Python project needing PNG I/O.
A script that generates multiple .inx descriptor files from a single template definition. It demonstrates a pattern for programmatically creating Inkscape extension menus, reducing duplication. The approach can be adapted to generate extension descriptors for other Inkscape plugins or similar XML-based configuration files.