
Gcode
Turn a 3D mesh into printer-profiled G-code and validate the file before sending it to a slicer or printer.
Install
npx skills add https://github.com/earthtojake/text-to-cad --skill gcodeWhat is this skill?
- Generate printer-profiled G-code from mesh files via the $gcode skill entry point
- Static validation through scripts/gcode_tool.py validate
- MIT-licensed tooling from the text-to-cad repo
- Validation enforces required structural checks and fails on defined rule violations
- Does not simulate extrusion physics, firmware state, or slicer-specific semantics—static checks only
Adoption & trust: 455 installs on skills.sh; 5.8k GitHub stars.
Recommended Skills
Lark Drivelarksuite/cli
Lark Sharedlarksuite/cli
Lark Minuteslarksuite/cli
Tzstxixu-me/skills
Runcomfy Cliagentspace-so/runcomfy-agent-skills
Caveman Helpjuliusbrussee/caveman
Journey fit
Primary fit
Mesh-to-G-code is a physical prototype step before you trust a print run—not distribution, growth, or app shipping. Prototype is the canonical shelf because the skill converts design artifacts into machine instructions for first-off prints.
SKILL.md
READMESKILL.md - Gcode
interface: display_name: "G-code" short_description: "Generate G-code from 3D mesh files" default_prompt: "Use $gcode to generate printer-profiled G-code from a mesh file." MIT License Copyright (c) 2026 earthtojake Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # G-code Validation `scripts/gcode_tool.py validate` performs static checks only. It does not simulate extrusion physics, firmware state, acceleration limits, or slicer-specific semantics. ## Required Checks Validation fails when: - The file is empty. - No `G0`, `G1`, `G2`, or `G3` movement commands are present. - No extrusion moves are present. - No nozzle or bed temperature commands are present. - Parsed absolute `X`, `Y`, or `Z` moves exceed the wrapper profile motion bounds. Validation warns when: - Unknown or unsupported G-code commands are encountered. - Relative positioning is used; bounds checking is skipped while relative mode is active. Warnings do not rewrite or delete commands. Treat them as review prompts, especially before sending G-code to unfamiliar firmware. ## Bounds Policy The validator assumes absolute positioning until `G91` appears, and resumes absolute bounds checks after `G90`. This avoids false hard failures for relative motion blocks while still catching obvious out-of-bed absolute moves. The wrapper profile provides printable bounds: - `machine.bed_size_mm[0]`: maximum `X` - `machine.bed_size_mm[1]`: maximum `Y` - `machine.z_height_mm`: maximum `Z` By default, motion bounds are `X=0..bed_size_mm[0]`, `Y=0..bed_size_mm[1]`, and `Z=0..z_height_mm`. If a native printer profile intentionally uses safe off-bed wipe, purge, or maintenance positions, set `machine.motion_bounds_mm` with explicit `x`, `y`, and/or `z` `[min, max]` ranges. Do this only from a real printer/profile source, not as a way to silence unknown G-code. ## Interpreting Results `ok: true` means the file passed these static checks. It does not mean the G-code is safe to print on real hardware. Still review: - Printer/profile match. - Filament and temperature settings. - Start and end G-code. - Bed origin and coordinate system. - Any unknown command warnings. # Slicer Backends Use real slicer CLIs for mesh-to-G-code work. Do not rely on Bambu Studio as the default backend for this skill. ## Backend Order 1. `orcaslicer` 2. `prusa-slicer` 3. `curaengine` If no preferred backend is installed, install OrcaSlicer first instead of treating the missing slicer as a user-facing blocker. On macOS: ```bash brew install --cask orcaslicer ``` After installation, rerun `scripts/gcode_tool.py discover`. The helper checks `PATH`, backend-specific environment variables, and common macOS app bundle locations such as `/Applications/OrcaSlicer.app/Contents/MacOS/OrcaSlicer`. `scripts/gcode_tool.py discover` checks PATH and backend-specific environment variables: - `ORCASLICER_BIN` - `PRUSASLICER_BIN` - `CURAENGINE_BIN` Bambu Studio may also be reported as available but not preferred. It is intentionally exc