PluginBench
Skill
Pass
Audit score 90

gcode

earthtojake/text-to-cad

Generate and validate FDM G-code from 3D meshes using local slicer CLIs.

What is gcode?

Converts 3D mesh files (.stl, .obj, .3mf, .ply, .glb, .gltf) into printer-profiled G-code by orchestrating real slicer backends like OrcaSlicer, Prusa Slicer, and Cura. Use this when you need to slice meshes, validate G-code before printing, or discover available slicer backends on the system.

  • Slice supported mesh formats into plain FDM G-code with printer profiles
  • Discover available slicer backends (OrcaSlicer, Prusa Slicer, Cura) on the local system
  • Inspect mesh files to verify they are slice-ready
  • Dry-run slicer commands before execution to validate settings
  • Statically validate generated G-code for completeness and correctness
  • Convert .ply, .glb, and .gltf to temporary STL for slicing

How to install gcode

npx skills add https://github.com/earthtojake/text-to-cad --skill gcode
Prerequisites
  • At least one supported slicer backend installed locally (OrcaSlicer, Prusa Slicer, or Cura)
  • Python with the gcode_tool.py script available
  • For .ply, .glb, .gltf conversion: optional trimesh library (or provide .stl/.obj/.3mf instead)
  • A printer profile JSON file with machine and filament specifications
Claude Code
Cursor
Windsurf
Cline

How to use gcode

  1. 1.Run `python scripts/gcode_tool.py discover` to find available slicer backends on your system
  2. 2.Prepare a printer profile JSON with machine bounds, bed size, nozzle/bed temperatures, and the path to your native slicer profile
  3. 3.Inspect your input mesh with `python scripts/gcode_tool.py inspect --input model.stl --json` to confirm it is slice-ready
  4. 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. 5.Run the actual slice with `--execute` flag after confirming the dry-run output
  6. 6.Validate the generated G-code with `python scripts/gcode_tool.py validate --gcode /tmp/model.gcode --profile profile.json --json`

Use cases

Good for
  • Prepare 3D models for FDM printing by converting meshes to printer-specific G-code
  • Validate that a generated G-code file contains required temperature, movement, and extrusion commands before sending to a printer
  • Test slicer settings with a dry-run before committing to a full slice operation
  • Inspect an imported mesh to confirm it is manifold and ready for slicing
  • Discover which slicer backends are installed and available on the development machine
Who it's for
  • 3D printing workflow developers
  • CAD-to-print automation pipelines
  • Users validating G-code before printer handoff
  • Developers integrating mesh slicing into agent workflows

gcode FAQ

What mesh formats are supported?

.stl, .obj, unsliced .3mf, .ply, .glb, and .gltf are supported. The .ply, .glb, and .gltf formats are converted to temporary STL at execution time if trimesh is available.

Can I use .step or .stp files directly?

No. .step and .stp are CAD boundary-representation files, not meshes. Export an STL sidecar from your CAD tool first, then slice the STL.

What is the printer profile JSON for?

The profile JSON wraps your native slicer configuration (OrcaSlicer, Prusa Slicer, or Cura) and supplies machine bounds, bed size, nozzle/bed temperatures, and filament type for validation and backend selection.

Does this skill upload or start print jobs?

No. This skill generates plain .gcode only and never contacts printers, uploads files, or starts jobs. For Bambu printer workflows, hand off validated G-code to the $bambu-labs skill.

What does the dry-run command do?

The dry-run simulates the slicer command without writing output, allowing you to verify settings and catch configuration errors before executing the actual slice.

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

  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:
python scripts/gcode_tool.py discover
  1. Inspect the input:
python scripts/gcode_tool.py inspect --input path/to/model.stl --json
  1. 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
  1. 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
  1. Validate the generated G-code:
python scripts/gcode_tool.py validate \
  --gcode /tmp/model.gcode \
  --profile path/to/profile.json \
  --json

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. 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.