gcode

GitHub

使用 OrcaSlicer 将 3D 模型切片生成 G-code,支持命令行无头模式或打开应用手动操作。涵盖安装、预设配置、切片命令及打印前检查,不直接连接打印机。

skills/gcode/SKILL.md earthtojake/text-to-cad

Trigger Scenarios

用户需要将 STL/3MF/OBJ 模型转换为 G-code 用户请求进行 3D 打印切片操作

Install

npx skills add earthtojake/text-to-cad --skill gcode -g -y
More Options

Use without installing

npx skills use earthtojake/text-to-cad@gcode

指定 Agent (Claude Code)

npx skills add earthtojake/text-to-cad --skill gcode -a claude-code -g -y

安装 repo 全部 skill

npx skills add earthtojake/text-to-cad --all -g -y

预览 repo 内 skill

npx skills add earthtojake/text-to-cad --list

SKILL.md

Frontmatter
{
    "name": "gcode",
    "license": "MIT",
    "metadata": {
        "repository": "earthtojake\/text-to-cad"
    },
    "description": "Slice 3D models into printer-ready G-code with OrcaSlicer, the open-source slicer with built-in profiles for most FDM printers (Prusa, Bambu Lab, Creality, Voron and more). Use when the user wants an `.stl`, `.3mf` or `.obj` model sliced for their printer, as a sliced `.gcode.3mf` or plain `.gcode`, headless with OrcaSlicer's command line or by opening the model in OrcaSlicer. Never contacts a printer."
}

G-code

Slice with OrcaSlicer, headless (below) or by opening the model in the OrcaSlicer app for the user. The agent never contacts a printer: for a Bambu Lab printer, the result is sent through Bambu Connect; for any other printer, give the user the .gcode.

Install OrcaSlicer

  • macOS: brew install --cask orcaslicer. The command line is /Applications/OrcaSlicer.app/Contents/MacOS/OrcaSlicer.
  • Windows and Linux: install a release from https://github.com/OrcaSlicer/OrcaSlicer/releases. The command is orca-slicer; on Linux, run it from the AppImage or Flatpak.

Below, <orca> is that command.

Slice headless

OrcaSlicer's command line (https://www.orcaslicer.com/wiki/cli/cli_mode) needs complete presets: it doesn't fill in a preset's parent settings, and it slices only with a process whose compatible printers name the printer. scripts/orca_presets.py (Python 3, no dependencies) writes them from OrcaSlicer's presets, searching the user's own first, then OrcaSlicer's built-in profiles.

  1. Find the user's printer, process and filament presets. Prefer the presets the user prints with; never invent one, since a wrong bed size or temperature can damage the printer.

    python scripts/orca_presets.py --list machine --match "MK4S"
    python scripts/orca_presets.py --list process --match "@MK4S 0.4"
    python scripts/orca_presets.py --list filament --match "PLA @MK4S"
    
  2. Write the complete presets:

    python scripts/orca_presets.py --printer "Prusa MK4S 0.4 nozzle" \
      --process "0.20mm SPEED @MK4S 0.4" --filament "Prusa Generic PLA @MK4S" \
      --out presets
    
  3. Slice. Give --outputdir an absolute path:

    <orca> model.stl \
      --load-settings "presets/process.json;presets/printer.json" \
      --load-filaments presets/filament-1.json \
      --arrange 1 --slice 0 \
      --outputdir /absolute/path/to/out --export-3mf model.gcode.3mf
    

    This writes plate_1.gcode, the plain G-code, and model.gcode.3mf, the sliced 3MF, into that folder. The command line reads .stl, .3mf, .obj and .amf; export STEP to STL or 3MF first (for a text-to-cad model, cad export <id> part.3mf, or cad export part.step part.3mf). Override one setting with --<setting>=<value>, using the setting's key with hyphens for underscores, such as --layer-height=0.16.

Open in OrcaSlicer

When the user would rather pick presets and slice themselves, or no preset can be found, open the model in the app: open -a OrcaSlicer model.stl on macOS, Start-Process model.stl on Windows when OrcaSlicer opens that file type, or orca-slicer model.stl on Linux. The app also reads STEP.

Check before printing

  • <orca> model.stl --info prints the model's size; it has to fit the bed.

  • Check the slice's settings, which OrcaSlicer writes at the end of the G-code:

    grep -E '^; (printer_model|nozzle_diameter|filament_type|nozzle_temperature|hot_plate_temp|bed_temperature) =|printing time' out/plate_1.gcode
    

    Confirm they match the user's printer and material before anyone prints it.

Hand off

  • A Bambu Lab printer: Bambu Connect, with the .gcode.3mf.
  • Any other printer: the user prints the .gcode from their printer's app, its web interface (PrusaLink, OctoPrint, Mainsail, Fluidd) or an SD card.

Version History

  • 5efa85a Current 2026-11-02 19:24
  • 284827c 2026-10-19 02:43

    重构了工作流,从通用的 gcode_tool.py 迁移至基于 OrcaSlicer CLI 的具体实现,增加了预设管理和安全检查步骤。

  • d0e4cb6 2026-09-09 02:39
  • 0.4.28 2026-08-27 16:55

    修复了gcode技能中指向错误cad导出命令的问题,更正为正确的export CLI路径,并更新了相关文档和依赖。

  • 0.4.12 2026-08-16 02:06
  • 0.3.13 2026-08-02 21:21

    修复了拒绝非网格输入时的错误处理:使用结构化修复映射替代扁平扩展名集合,明确命名转换技能并提供具体的下一步建议,优化了inspect和slice入口点的错误反馈。

  • 0.3.9 2026-07-24 11:54

Same Skill Collection

plugins/cad/skills/bambu-labs/SKILL.md
plugins/cad/skills/cad-viewer/SKILL.md
plugins/cad/skills/cad/SKILL.md
plugins/cad/skills/dxf/SKILL.md
plugins/cad/skills/gcode/SKILL.md
plugins/cad/skills/implicit-cad/SKILL.md
plugins/cad/skills/sdf/SKILL.md
plugins/cad/skills/sendcutsend/SKILL.md
skills/bambu-labs/SKILL.md
skills/cad-viewer/SKILL.md
skills/dfam-check/SKILL.md
skills/dfm/SKILL.md
skills/dxf/SKILL.md
skills/engineering-drawing/SKILL.md
skills/implicit-cad/SKILL.md
skills/sdf/SKILL.md
skills/sendcutsend/SKILL.md
skills/srdf/SKILL.md
skills/urdf/SKILL.md
plugins/cad/skills/srdf/SKILL.md
plugins/cad/skills/step-parts/SKILL.md
plugins/cad/skills/urdf/SKILL.md
skills/cad/SKILL.md
skills/step-parts/SKILL.md

Metadata

Files
0
Version
5efa85a
Hash
f5c231d3
Indexed
2026-07-24 11:54

Главная - Вики-сайт
Copyright © 2011-2026 iteam. Current version is 2.155.2. UTC+08:00, 2026-11-03 08:25
浙ICP备14020137号-1