gcode
earthtojake/text-to-cad
Generate, inspect, and validate FDM G-code from 3D meshes using local slicer CLIs.
What is gcode?
This skill orchestrates real slicer backends (OrcaSlicer, Prusa Slicer, Cura) to convert 3D mesh files into printer-profiled G-code. Use it when you need to slice STL, OBJ, 3MF, PLY, GLB, or GLTF files, discover available slicer backends, validate mesh readiness, or verify G-code before handoff to printer workflows.
- Discover available slicer backends on the local system
- Inspect 3D mesh files for slice-readiness and geometry issues
- Dry-run slicer commands before execution to validate settings
- Generate plain FDM G-code with printer-specific profiles
- Statically validate generated G-code for completeness and safety
- Support multiple mesh formats: STL, OBJ, 3MF, PLY, GLB, GLTF
How to install gcode
npx skills add https://github.com/earthtojake/text-to-cad --skill gcode- Python 3.7+
- At least one supported slicer CLI installed locally: OrcaSlicer (preferred), Prusa Slicer, or Cura Engine
- Absolute path to a native slicer profile JSON for the target printer
- Optional: trimesh library for PLY/GLB/GLTF conversion (or provide STL/OBJ/3MF instead)
How to use gcode
- 1.Run `python scripts/gcode_tool.py discover` to find available slicer backends on your system
- 2.Prepare a printer profile JSON with machine bounds, filament settings, and native slicer config path
- 3.Inspect your input mesh with `python scripts/gcode_tool.py inspect --input model.stl --json`
- 4.Execute a dry-run: `python scripts/gcode_tool.py slice --input model.stl --output /tmp/model.gcode --profile profile.json --backend auto --dry-run`
- 5.Review the dry-run output and adjust the profile if needed
- 6.Execute the slice: `python scripts/gcode_tool.py slice --input model.stl --output /tmp/model.gcode --profile profile.json --backend auto --execute`
- 7.Validate the output: `python scripts/gcode_tool.py validate --gcode /tmp/model.gcode --profile profile.json --json`
- 8.Hand the G-code file path to `$cad-viewer` for preview and diagnostic inspection
Use cases
- Slice a 3D model to G-code using OrcaSlicer with a custom printer profile
- Inspect an STL file to check if it is manifold and ready for slicing
- Validate generated G-code to ensure temperature commands, movement, and extrusion are present before sending to a printer
- Convert GLB/GLTF models to G-code by automatically converting to temporary STL
- Dry-run a slice operation with different profiles to compare settings without committing to execution
- 3D printing engineers and technicians
- CAD/CAM workflow automation
- Agents orchestrating multi-step manufacturing pipelines
- Users managing multiple printer profiles and backends
gcode FAQ
STL, OBJ, unsliced 3MF, PLY, GLB, and GLTF. STEP, STP, DXF, SVG, URDF, and SDF are not supported; convert them to a supported format first.
Yes. Every slice requires an explicit printer profile JSON with machine bounds, filament settings, and an absolute path to the native slicer profile. Do not invent profiles; use real printer configurations.
Run `python scripts/gcode_tool.py discover` to check available backends. If none are found, install OrcaSlicer (e.g., `brew install --cask orcaslicer` on macOS) and rerun discover.
No. This skill generates plain G-code only and never contacts printers, uploads files, or starts jobs. For Bambu printer workflows, hand off validated G-code to `$bambu-labs`.
Review `references/gcode-validation.md` in the skill to interpret warnings. The validator checks for temperature commands, movement, extrusion, and XYZ bounds; some warnings may be acceptable depending on your printer and workflow.
Full instructions (SKILL.md)
Source of truth, from earthtojake/text-to-cad.
name: gcode
description: Generate, inspect, dry-run, and statically validate plain FDM .gcode from 3D mesh files by orchestrating real slicer CLIs. Use when Codex needs to slice .stl, .obj, unsliced .3mf, .ply, .glb, or .gltf into printer-profiled G-code, discover local slicer backends, inspect whether a mesh is slice-ready, or validate generated G-code before any printer-specific handoff.
G-code
Provenance: maintained in earthtojake/text-to-cad. Use the installed local skill files as the runtime source of truth; the repository link is only for provenance and release review.
Use this skill for plain .gcode generation from mesh files. It is printer-agnostic and never uploads, starts, or packages print jobs.
Workflow
- Confirm the input is a supported mesh:
.stl,.obj, unsliced.3mf,.ply,.glb, or.gltf. - Require an explicit printer/profile wrapper JSON. Do not invent real-printer profiles.
- Discover slicer backends when the backend is unknown:
python scripts/gcode_tool.py discover
- Inspect the input:
python scripts/gcode_tool.py inspect --input path/to/model.stl --json
- Dry-run the slicer command before executing:
python scripts/gcode_tool.py slice \
--input path/to/model.stl \
--output /tmp/model.gcode \
--profile path/to/profile.json \
--backend auto \
--dry-run
- Execute only after the dry-run command and profile are appropriate:
python scripts/gcode_tool.py slice \
--input path/to/model.stl \
--output /tmp/model.gcode \
--profile path/to/profile.json \
--backend auto \
--execute
- Validate the generated G-code:
python scripts/gcode_tool.py validate \
--gcode /tmp/model.gcode \
--profile path/to/profile.json \
--json
CAD Viewer Handoff
After completing G-code work that creates or modifies a plain .gcode, you must ALWAYS hand the explicit file path to $cad-viewer when that skill is installed. $cad-viewer must start CAD Viewer if it is not already running and return link(s) to the relevant created or updated file(s); the preview is diagnostic only and does not replace this skill's static validation. If $cad-viewer is unavailable or startup fails, report that instead of silently omitting the handoff.
Profile Contract
Every slice requires a wrapper profile JSON with an absolute native slicer profile path:
{
"backend": "orcaslicer",
"native_config": "/absolute/path/to/native-slicer-profile",
"machine": {
"name": "Example Printer",
"bed_size_mm": [180, 180],
"z_height_mm": 180,
"motion_bounds_mm": {
"x": [0, 180],
"y": [0, 180],
"z": [0, 180]
}
},
"filament": {
"type": "PLA",
"nozzle_temp_c": 220,
"bed_temp_c": 65
}
}
The wrapper supplies validation bounds and backend selection. machine.motion_bounds_mm is optional; omit it for the default 0..bed_size and 0..z_height bounds, or set it from a native printer profile when start/end G-code intentionally uses safe wipe/purge positions outside the printable area. The native slicer profile remains the source of detailed process, printer, and filament behavior.
For OrcaSlicer, use native_settings and native_filaments when the real profile is split across machine, process, and filament JSON files. Keep native_config as an absolute path to the primary native profile for compatibility:
{
"backend": "orcaslicer",
"native_config": "/absolute/path/to/machine-or-process.json",
"native_settings": [
"/absolute/path/to/machine.json",
"/absolute/path/to/process.json"
],
"native_filaments": [
"/absolute/path/to/filament.json"
],
"machine": {
"name": "Example Printer",
"bed_size_mm": [180, 180],
"z_height_mm": 180
},
"filament": {
"type": "PLA",
"nozzle_temp_c": 220,
"bed_temp_c": 65
}
}
Backends And Inputs
Preferred slicer backend order is orcaslicer, prusa-slicer, then curaengine. Prefer installing OrcaSlicer when no preferred backend is available; on macOS use brew install --cask orcaslicer and then rerun discover. The helper checks both PATH and the usual /Applications/OrcaSlicer.app cask location. Bambu Studio may be reported by discovery as available but is not preferred because its CLI export path has shown macOS instability.
Pass .stl, .obj, and unsliced .3mf directly to the slicer. Convert .ply, .glb, and .gltf to temporary STL at execution time with optional trimesh; if trimesh is unavailable, ask the user to install it or provide .stl, .obj, or unsliced .3mf.
Reject .step, .stp, .dxf, .svg, .urdf, and .sdf in v1. Use the existing CAD/render workflows to convert those to a supported mesh format before using this skill.
Read references/slicer-backends.md when backend behavior, profile expectations, or source links matter.
Validation
Always validate generated G-code before handing it to printer-specific workflows. The validator checks for non-empty content, temperature commands, movement commands, extrusion moves, XYZ bounds, and unknown command warnings.
Read references/gcode-validation.md when interpreting validation output or deciding whether a warning is acceptable.
Bambu Boundary
This skill generates plain .gcode only. It does not create Bambu .gcode.3mf archives and does not contact printers. For Bambu upload/start workflows, hand off the validated plain .gcode to $bambu-labs. Let $bambu-labs choose the printer-specific LAN handoff, such as an A1 Mini template project or an explicitly enabled bambox project package.
Related skills
More from earthtojake/text-to-cad and the wider catalog.

implicit-cad
Create browser-native implicit CAD models using GLSL signed-distance fields and shader primitives.

render
Render CAD and robot files in CAD Explorer with review links and snapshots.

sdf
Generate, validate, and hand off SDFormat models and worlds for Gazebo and other simulators.

sendcutsend
Preflight validation for SendCutSend.com DXF and STEP/STP orders against official specs and ordering rules.

srdf
MoveIt2 SRDF generation, validation, and planning-semantics workflow for robot manipulation.

step-parts
Search and download off-the-shelf CAD parts from step.parts catalog—actuators, motors, connectors, fasteners, and more.