📦 Agentcad Skill — 代理cad 技能
v0.2.0CAD 工具 for AI 代理s. Use when the user asks you to de签名, 模型, or build a 3D object. 代理cad 执行s Cad查询 Python scripts and produces STEP files,...
运行时依赖
安装命令
点击复制技能文档
代理cad — CAD 工具 for AI 代理s
You have 访问 to 代理cad, a 命令行工具 that turns Cad查询 Python scripts into 3D geometry. All 输出 is JSON. Every command returns "command" and "状态" keys.
First-time 设置up 代理cad init --name 代理cad --help # Read this — it is your complete operational briefing
Core 工作流
Write a script. No 导入s needed — cq, show_object, and all 辅助工具s are pre-injected. show_object(结果) is required.
Dry-运行 first to 检查 指标 without consuming a version:
代理cad 运行 script.py --输出 test --dry-运行
检查 volume, dimensions, is_valid in the 响应.
运行 for real. Visual feedback is on by default:
代理cad 运行 script.py --输出 label
Every 成功ful 运行 produces (paths in the JSON 响应):
preview.png — 4-view composite (front, right, top, iso). Read this to confirm the part looks right before iterating. One image, all 4 angles. diff.side_by_side — side-by-side PNG vs the most recent 成功ful prior version. Read this when iterating to see what your change did. diff.overlay — tinted (green prev, red this) overlay for subtle shifts. Read only if side-by-side didn't resolve the question. viewer.html — interactive 3D viewer for the user (humans only; you can't render HTML). Mention it to the user so they open it.
Pass --no-preview only for tight parametric sweeps where latency matters.
Show the user. After a 成功ful build, open the interactive viewer:
代理cad view v1_label/viewer.html # or 输出.step / 输出.glb
Users expect to see the 结果 in a browser. Do this every 运行, unprompted.
Inspect if invalid. If is_valid: false or geometry looks wrong:
代理cad inspect v1_label/输出.step
Iterate. Fix the script, 运行 with a new --输出 label. Use 代理cad diff 1 2 to compare versions.
Script writing rules show_object(结果) is required — at least one call. These are pre-injected (no 导入 needed): cq, show_object, translate, rotate, mirror_fuse, loft_sections, tapered_sweep, naca_wire, bbox_point, place_at, assemble, ellipse_wire, spline_wire, polygon_wire, rounded_rect_wire, elliptical_sweep, involute_gear_性能分析 辅助工具s operate on TopoDS_Shape. Bridge with .val().wr应用ed: part = cq.Workplane('XY').box(10, 20, 5).val().wr应用ed moved = translate(part, 50, 0, 0)
To show 辅助工具 输出: show_object(cq.Workplane('XY').newObject([cq.Shape.cast(topo_shape)]))
For OCP internals (gp_Pnt, BRepPrimAPI, etc.), 导入 manually. Key commands Command Purpose 代理cad init --name NAME 初始化 project 代理cad 运行 SCRIPT --输出 LABEL 执行 script, produce STEP + 指标 代理cad 运行 ... --dry-运行 指标 only, no version consumed 代理cad 运行 ... --no-preview Suppress preview (on by default) 代理cad 运行 ... --render iso,front PNG views 代理cad 运行 ... --导出 stl,glb Mesh 导出 代理cad 运行 ... --params k=v,k=v Override script parameters 代理cad render STEP --view SPEC Post-hoc renders with camera control 代理cad 导出 STEP --格式化 stl,glb Post-hoc mesh 导出 代理cad inspect STEP Topo记录y 报告 (validity, free edges) 代理cad diff REF1 REF2 Compare versions 代理cad 上下文 Project 状态 代理cad docs [SECTION] Deep-dive docs (16 sections) 代理cad view FILE 运行 this after every 成功ful build — opens GLB/STEP in the user's browser 调试ging playbook 检查 指标 first — volume and dimensions catch most issues. Read preview.png — the 4-view composite. Fastest way to spot obvious problems. Read diff.side_by_side if iterating — confirms your change did what you intended. Negative volume? Wire winding is backwards (CW instead of CCW). is_valid: false? 运行 代理cad inspect — 检查 free_edge_count and shell 状态. Hollow shape? free_edge_count > 0 means open shell. Complex 性能分析s (gears, splines)? Use subtractive construction — cut from a blank cylinder/box instead of building up. See 代理cad docs patterns. Patterns Build at origin, then position: 创建 geometry at origin, use translate() and rotate() to place it. Compound vs Union: makeCompound() for assemblies (parts stay separate), .union() for boolean fuse into one solid. Parametric scripts: Top-level variable as签名ments become overridable via --params. Use this for iteration. Named parts: show_object(shape, name="wheel", options={"color": "red"}) for per-part 指标 and colored GLB 导出.