gcode
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseG-code
G-code
Use this skill for plain generation from mesh files. It is printer-agnostic and never uploads, starts, or packages print jobs.
.gcode本技能用于从网格文件生成纯 文件。它与打印机无关,绝不会上传、启动或打包打印任务。
.gcodeWorkflow
工作流程
- Confirm the input is a supported mesh: ,
.stl, unsliced.obj,.3mf,.ply, or.glb..gltf - Require an explicit printer/profile wrapper JSON. Do not invent real-printer profiles.
- Discover slicer backends when the backend is unknown:
bash
python scripts/gcode_tool.py discover- Inspect the input:
bash
python scripts/gcode_tool.py inspect --input path/to/model.stl --json- Dry-run the slicer command before executing:
bash
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:
bash
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:
bash
python scripts/gcode_tool.py validate \
--gcode /tmp/model.gcode \
--profile path/to/profile.json \
--json- 确认输入为支持的网格格式:、
.stl、未切片的.obj、.3mf、.ply或.glb。.gltf - 需要明确的打印机/配置包装器JSON文件。请勿虚构真实打印机配置。
- 当后端未知时,发现切片器后端:
bash
python scripts/gcode_tool.py discover- 检查输入:
bash
python scripts/gcode_tool.py inspect --input path/to/model.stl --json- 在执行前试运行切片器命令:
bash
python scripts/gcode_tool.py slice \
--input path/to/model.stl \
--output /tmp/model.gcode \
--profile path/to/profile.json \
--backend auto \
--dry-run- 仅在试运行命令和配置合适后执行:
bash
python scripts/gcode_tool.py slice \
--input path/to/model.stl \
--output /tmp/model.gcode \
--profile path/to/profile.json \
--backend auto \
--execute- 验证生成的G-code:
bash
python scripts/gcode_tool.py validate \
--gcode /tmp/model.gcode \
--profile path/to/profile.json \
--jsonCAD Viewer Handoff
CAD Viewer 交付
After completing G-code work that creates or modifies a plain , you must ALWAYS hand the explicit file path to when that skill is installed. 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 is unavailable or startup fails, report that instead of silently omitting the handoff.
.gcode$cad-viewer$cad-viewer$cad-viewer在完成创建或修改纯 的G-code相关工作后,当 技能已安装时,必须始终将明确的文件路径传递给它。如果CAD Viewer尚未运行, 必须启动它,并返回相关已创建或更新文件的链接;预览仅用于诊断,不能替代本技能的静态验证。如果 不可用或启动失败,请报告该情况,不要静默跳过交付步骤。
.gcode$cad-viewer$cad-viewer$cad-viewerProfile Contract
配置契约
Every slice requires a wrapper profile JSON with an absolute native slicer profile path:
json
{
"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. is optional; omit it for the default and 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.
machine.motion_bounds_mm0..bed_size0..z_heightFor OrcaSlicer, use and when the real profile is split across machine, process, and filament JSON files. Keep as an absolute path to the primary native profile for compatibility:
native_settingsnative_filamentsnative_configjson
{
"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
}
}每次切片都需要一个包含绝对原生切片器配置路径的包装器配置JSON文件:
json
{
"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
}
}这个包装器提供验证边界和后端选择。 是可选的;如果默认边界为 和 ,则可省略该字段;或者当起始/结束G-code有意使用可打印区域外的安全擦拭/吹扫位置时,从原生打印机配置中设置该字段。原生切片器配置仍是详细工艺、打印机和耗材行为的来源。
machine.motion_bounds_mm0..bed_size0..z_height对于OrcaSlicer,当真实配置分散在机器、工艺和耗材JSON文件中时,请使用 和 。为了兼容性,将 保留为指向主原生配置的绝对路径:
native_settingsnative_filamentsnative_configjson
{
"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 , , then . Prefer installing OrcaSlicer when no preferred backend is available; on macOS use and then rerun . The helper checks both and the usual cask location. Bambu Studio may be reported by discovery as available but is not preferred because its CLI export path has shown macOS instability.
orcaslicerprusa-slicercuraenginebrew install --cask orcaslicerdiscoverPATH/Applications/OrcaSlicer.appPass , , and unsliced directly to the slicer. Convert , , and to temporary STL at execution time with optional ; if is unavailable, ask the user to install it or provide , , or unsliced .
.stl.obj.3mf.ply.glb.gltftrimeshtrimesh.stl.obj.3mfReject , , , , , and in v1. Use the existing CAD/render workflows to convert those to a supported mesh format before using this skill.
.step.stp.dxf.svg.urdf.sdfRead when backend behavior, profile expectations, or source links matter.
references/slicer-backends.md首选切片器后端顺序为 、,其次是 。当没有首选后端可用时,优先安装OrcaSlicer;在macOS上使用 命令安装,然后重新运行 。该工具会检查 和常用的 安装位置。Bambu Studio可能会被发现为可用后端,但并非首选,因为其CLI导出路径在macOS上存在稳定性问题。
orcaslicerprusa-slicercuraenginebrew install --cask orcaslicerdiscoverPATH/Applications/OrcaSlicer.app将 、 和未切片的 直接传递给切片器。执行时可通过可选的 将 、 和 转换为临时STL文件;如果 不可用,请要求用户安装它或提供 、 或未切片的 文件。
.stl.obj.3mftrimesh.ply.glb.gltftrimesh.stl.obj.3mf在v1版本中,拒绝 、、、、 和 格式。在使用本技能之前,请使用现有的CAD/渲染工作流将这些格式转换为支持的网格格式。
.step.stp.dxf.svg.urdf.sdf当后端行为、配置要求或源链接很重要时,请阅读 。
references/slicer-backends.mdValidation
验证
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 when interpreting validation output or deciding whether a warning is acceptable.
references/gcode-validation.md在将生成的G-code交付给特定打印机的工作流之前,始终要对其进行验证。验证器会检查内容是否非空、温度命令、移动命令、挤出移动、XYZ边界以及未知命令警告。
当解释验证输出或判断警告是否可接受时,请阅读 。
references/gcode-validation.mdBambu Boundary
Bambu 边界
This skill generates plain only. It does not create Bambu archives and does not contact printers. For Bambu upload/start workflows, hand off the validated plain to . Let choose the printer-specific LAN handoff, such as an A1 Mini template project or an explicitly enabled bambox project package.
.gcode.gcode.3mf.gcode$bambu-labs$bambu-labs本技能仅生成纯 文件。它不会创建Bambu 存档,也不会与打印机通信。对于Bambu上传/启动工作流,请将经过验证的纯 文件交付给 。让 选择特定打印机的LAN交付方式,例如A1 Mini模板项目或明确启用的bambox项目包。
.gcode.gcode.3mf.gcode$bambu-labs$bambu-labs