AGENT SKILL

gcode

通过编排真正的切片器 CLI,从 3D 网格文件生成、检查、试运行和静态验证纯 FDM“.gcode”。当 Codex 需要将“.stl”、“.obj”、未切片的“.3mf”、“.ply”、“.glb”或“.gltf”切片为打印机配置文件的 G 代码、发现本地切片器后端、检查网格是否已准备好切片或在任何特定于打印机的切换之前验证生成的 G 代码时使用。

License 许可
MIT
最近更新
2026-09-29
Stars
★ 0
Forks
0

01 前言 Front Matter

name
gcode
description
通过编排真正的切片器 CLI,从 3D 网格文件生成、检查、试运行和静态验证纯 FDM“.gcode”。当 Codex 需要将“.stl”、“.obj”、未切片的“.3mf”、“.ply”、“.glb”或“.gltf”切片为打印机配置文件的 G 代码、发现本地切片器后端、检查网格是否已准备好切片或在任何特定于打印机的切换之前验证生成的 G 代码时使用。

02 资源文件 5

03 SKILL.md 正文

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 (python scripts/export <input> --stl <output>.stl, or target the generator with python scripts/export <model>.step.py --stl <output>.stl), 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 with gen_step() 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.

04 同仓库更多 Skills

zzz2929
zzz2929/skills-zh-CN

vercel-react-view-transitions

使用 React 的视图转换 API(`<ViewTransition>` 组件、`addTransitionType` 和 CSS 视图转换伪元素)实现流畅、原生感觉的动画的指南。每当用户想要添加页面转换、为路线更改设置动画、创建共享元素动画、为组件的进入/退出设置动画、为列表重新排序设置动画、实现定向(向前/向后)导航动画或在 Next.js 中集成视图转换时,请使用此技能。当用户提及视图转换、startViewTransition、ViewTransition、转换类型或询问有关在 React 中的 UI 状态之间设置动画而无需第三方动画库时也可使用。

★ 0
zzz2929
zzz2929/skills-zh-CN

vercel-react-native-skills

React Native和Expo构建高性能移动应用程序的最佳实践。在构建React Native组件、优化列表性能、实现动画或使用本机模块时使用。涉及React Native、Expo、移动性能或本机平台API的任务的触发器。

★ 0
zzz2929
zzz2929/skills-zh-CN

vercel-react-best-practices

Vercel Engineering的React和Next.js性能优化指南。在编写、审查或重构React/Next.js代码时,应使用此技能,以确保最佳性能模式。涉及React组件、Next.js页面、数据获取、捆绑优化或性能改进的任务的触发器。

★ 0
zzz2929
zzz2929/skills-zh-CN

vercel-composition-patterns

可扩展的React组合模式。在重构具有布尔属性增殖的组件、构建灵活的组件库或设计可重用的API时使用。涉及复合组件、渲染道具、上下文提供者或组件架构的任务的触发器。包括React 19 API变更。

★ 0
zzz2929
zzz2929/skills-zh-CN

ui-styling

使用 shadcn/ui 组件(基于 Radix UI + Tailwind 构建)、Tailwind CSS 实用优先样式和基于画布的视觉设计创建美观、可访问的用户界面。在构建用户界面、实现设计系统、创建响应式布局、添加可访问组件(对话框、下拉菜单、表单、表格)、自定义主题和颜色、实现深色模式、生成视觉设计和海报或跨应用程序建立一致的样式模式时使用。

★ 0
zzz2929
zzz2929/skills-zh-CN

design

“综合设计技能:品牌标识、设计标记、UI 样式、徽标生成(55 种样式、Gemini 或 Atlas Cloud AI)、企业形象程序(50 个可交付成果、CIP 模型)、HTML 演示文稿(Chart.js)、横幅设计(22 种样式、社交/广告/网页/打印)、图标设计(15 种样式、SVG、Gemini 3.1 Pro)、社交照片(HTML→屏幕截图、多平台)。操作:设计徽标、创建 CIP、生成模型、构建幻灯片、设计横幅、生成图标、创建社交照片、社交媒体图像、品牌标识、设计系统:Facebook、Twitter、LinkedIn、YouTube、Instagram、Pinterest、TikTok、Threads、Google Ads。”

★ 0