gcode
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
By earthtojake · 6,727 installs
npx skills add earthtojake/text-to-cad --skill gcode
Source repository · Upstream listing
G code
Provenance: maintained in [earthtojake/text to cad](https://github.com/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
1. Confirm the input is a supported mesh: .stl , .obj , unsliced .3mf , .ply , .glb , or .gltf .
2. Require an explicit printer/profile wrapper JSON. Do not invent real printer profiles.
3. Discover slicer backends when the backend is unknown:
4. Inspect the input:
5. Dry run the slicer command before executing:
6. Execute only after the dry run command and profile are appropriate:
7. Validate the generated G code:
Profile Contract
Every slice requires a wrapper profile JSON with an absolute native slicer profile path:
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:
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. inspect and slice fail with a structured remediation object naming the skill and command that produce a sliceable mesh; use it instead of inferring a conversion workflow:
.step , .stp : boundary representation CAD, not a mesh. Export an STL sidecar with $cad ( cadgen stl build <input.step <output .stl — the door takes the STEP document; a model script is refused, run python <model .py first), then slice the exported .stl here.
.dxf , .svg : 2D drawings with no 2D to mesh conversion in this toolchain. Model the 3D solid in $cad as a @step model script and export an STL sidecar, then slice that. If the part is a flat cut rather than a print, use $sendcutsend instead of this skill.
.urdf , .sdf : robot descriptions that reference per link mesh files. Slice the referenced .stl / .obj meshes one at a time; regenerate stale or missing ones from the owning CAD source with $cad first. Use $urdf or $sdf for the robot description itself.
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.