cad
创建、修改、检查和验证 STEP-first 参数化 CAD 零件和装配体。用于自然语言 CAD 规格、参考图像、2D 技术图纸、STEP/STP 生成或直接检查、Python CAD 源、源级接头、选择器参考、几何事实、测量、配合增量、快照以及 CAD 几何的辅助 STL/3MF/本机 GLB 输出。
- License 许可
- MIT
- 最近更新
- 2026-09-29
- Stars
- ★ 0
- Forks
- 0
01 前言 Front Matter
- name
- cad
- description
- 创建、修改、检查和验证 STEP-first 参数化 CAD 零件和装配体。用于自然语言 CAD 规格、参考图像、2D 技术图纸、STEP/STP 生成或直接检查、Python CAD 源、源级接头、选择器参考、几何事实、测量、配合增量、快照以及 CAD 几何的辅助 STL/3MF/本机 GLB 输出。
02 资源文件 116
- 参考文档agents/openai.yaml262 B
- 许可证LICENSE1.0 KB
- 参考文档references/build123d-modeling.md23.7 KB
- 参考文档references/cad-brief.md6.4 KB
- 参考文档references/inspection-and-validation.md11.0 KB
- 参考文档references/parameters.md11.9 KB
- 参考文档references/positioning.md13.7 KB
- 参考文档references/repair-loop.md7.0 KB
- 参考文档references/snapshot-review.md6.5 KB
- 参考文档references/step-generation.md9.5 KB
- 参考文档references/supported-exports.md3.5 KB
- 参考文档requirements.txt26 B
- 脚本scripts/artifact/__init__.py81 B
- 脚本scripts/artifact/__main__.py1.7 KB
- 脚本scripts/artifact/cli.py4.1 KB
- 脚本scripts/cadgen_daemon/__init__.py57 B
- 脚本scripts/cadgen_daemon/__main__.py351 B
- 脚本scripts/cadgen_daemon/client.py8.3 KB
- 脚本scripts/cadgen_daemon/server.py14.0 KB
- 脚本scripts/export/__init__.py61 B
- 脚本scripts/export/__main__.py1.7 KB
- 脚本scripts/export/cli.py4.7 KB
- 脚本scripts/gen/__init__.py67 B
- 脚本scripts/gen/__main__.py1.7 KB
- 脚本scripts/gen/cli.py6.5 KB
- 脚本scripts/inspect/__main__.py1.6 KB
- 脚本scripts/inspect/cli.py323 B
- 脚本scripts/inspect/inspect_refs/__init__.py45 B
- 脚本scripts/inspect/inspect_refs/cli.py31.2 KB
- 脚本scripts/inspect/inspect_refs/inspect.py38.8 KB
- 许可证scripts/packages/cadgen/LICENSE1.0 KB
- 脚本scripts/packages/cadgen/pyproject.toml1.5 KB
- 脚本scripts/packages/cadgen/src/cadgen/__init__.py2.8 KB
- 脚本scripts/packages/cadgen/src/cadgen/_internal/__init__.py235 B
- 脚本scripts/packages/cadgen/src/cadgen/_internal/assembly_spec.py1.8 KB
- 脚本scripts/packages/cadgen/src/cadgen/_internal/atomic_replace.py7.0 KB
- 脚本scripts/packages/cadgen/src/cadgen/_internal/cli_errors.py4.1 KB
- 脚本scripts/packages/cadgen/src/cadgen/_internal/cli_locking.py3.8 KB
- 脚本scripts/packages/cadgen/src/cadgen/_internal/component_package.py37.8 KB
- 脚本scripts/packages/cadgen/src/cadgen/_internal/drawing_package.py27.4 KB
- 脚本scripts/packages/cadgen/src/cadgen/_internal/file_metadata.py1.9 KB
- 脚本scripts/packages/cadgen/src/cadgen/_internal/font_scan.py9.6 KB
- 脚本scripts/packages/cadgen/src/cadgen/_internal/generation_runner.py25.5 KB
- 脚本scripts/packages/cadgen/src/cadgen/_internal/generation_spec.py20.7 KB
- 脚本scripts/packages/cadgen/src/cadgen/_internal/generation.py59.3 KB
- 脚本scripts/packages/cadgen/src/cadgen/_internal/glb_mesh_payload.py25.9 KB
- 脚本scripts/packages/cadgen/src/cadgen/_internal/glb_topology.py21.9 KB
- 脚本scripts/packages/cadgen/src/cadgen/_internal/glb.py45.2 KB
- 脚本scripts/packages/cadgen/src/cadgen/_internal/implicit_package.py15.3 KB
- 脚本scripts/packages/cadgen/src/cadgen/_internal/legacy_artifacts.py6.4 KB
- 脚本scripts/packages/cadgen/src/cadgen/_internal/node_resolve_hooks.mjs2.4 KB
- 脚本scripts/packages/cadgen/src/cadgen/_internal/node_resolve_register.mjs367 B
- 脚本scripts/packages/cadgen/src/cadgen/_internal/node_runtime.py19.3 KB
- 脚本scripts/packages/cadgen/src/cadgen/_internal/package_freshness.py4.8 KB
- 脚本scripts/packages/cadgen/src/cadgen/_internal/source_hash.py22.8 KB
- 脚本scripts/packages/cadgen/src/cadgen/_internal/step_hash.py345 B
- 脚本scripts/packages/cadgen/src/cadgen/_internal/step_metadata.py12.8 KB
- 脚本scripts/packages/cadgen/src/cadgen/_internal/step_scene_cache.py14.4 KB
- 脚本scripts/packages/cadgen/src/cadgen/_internal/step_scene_geometry.py24.1 KB
- 脚本scripts/packages/cadgen/src/cadgen/_internal/step_scene_loader.py18.0 KB
- 脚本scripts/packages/cadgen/src/cadgen/_internal/step_scene_mesh.py17.0 KB
- 脚本scripts/packages/cadgen/src/cadgen/_internal/step_scene_selectors.py44.7 KB
- 脚本scripts/packages/cadgen/src/cadgen/_internal/step_scene_types.py4.5 KB
- 脚本scripts/packages/cadgen/src/cadgen/_internal/step_scene.py5.3 KB
- 脚本scripts/packages/cadgen/src/cadgen/_internal/stl.py926 B
- 脚本scripts/packages/cadgen/src/cadgen/_internal/threemf.py19.6 KB
- 脚本scripts/packages/cadgen/src/cadgen/_internal/validators.py3.9 KB
- 脚本scripts/packages/cadgen/src/cadgen/analysis.py24.4 KB
- 脚本scripts/packages/cadgen/src/cadgen/api.py292 B
- 脚本scripts/packages/cadgen/src/cadgen/assembly_lookup.py25.2 KB
- 脚本scripts/packages/cadgen/src/cadgen/assembly.py14.6 KB
- 脚本scripts/packages/cadgen/src/cadgen/cad_ref_syntax.py11.7 KB
- 脚本scripts/packages/cadgen/src/cadgen/catalog.py19.6 KB
- 脚本scripts/packages/cadgen/src/cadgen/check_fonts.py3.7 KB
- 脚本scripts/packages/cadgen/src/cadgen/cli_logging.py1.6 KB
- 脚本scripts/packages/cadgen/src/cadgen/cli_progress.py6.3 KB
- 脚本scripts/packages/cadgen/src/cadgen/color.py2.2 KB
- 脚本scripts/packages/cadgen/src/cadgen/coordination/__init__.py20.7 KB
- 脚本scripts/packages/cadgen/src/cadgen/coordination/kinds.py4.5 KB
- 脚本scripts/packages/cadgen/src/cadgen/coordination/lock.py20.2 KB
- 脚本scripts/packages/cadgen/src/cadgen/coordination/paths.py5.0 KB
- 脚本scripts/packages/cadgen/src/cadgen/coordination/phases.py11.3 KB
- 脚本scripts/packages/cadgen/src/cadgen/coordination/record.py6.9 KB
- 脚本scripts/packages/cadgen/src/cadgen/drawing_checks.py16.3 KB
- 脚本scripts/packages/cadgen/src/cadgen/drawing_render.py16.3 KB
- 脚本scripts/packages/cadgen/src/cadgen/dxf_artifact.py8.4 KB
- 脚本scripts/packages/cadgen/src/cadgen/flatten.py11.0 KB
- 脚本scripts/packages/cadgen/src/cadgen/generation.py496 B
- 脚本scripts/packages/cadgen/src/cadgen/implicit_artifact.py8.6 KB
- 脚本scripts/packages/cadgen/src/cadgen/implicit_export.py9.5 KB
- 脚本scripts/packages/cadgen/src/cadgen/instances.py3.6 KB
- 脚本scripts/packages/cadgen/src/cadgen/interference.py11.1 KB
- 脚本scripts/packages/cadgen/src/cadgen/label_refs.py8.5 KB
- 脚本scripts/packages/cadgen/src/cadgen/lookup.py10.9 KB
- 脚本scripts/packages/cadgen/src/cadgen/metadata.py13.2 KB
- 脚本scripts/packages/cadgen/src/cadgen/progress.py3.3 KB
- 脚本scripts/packages/cadgen/src/cadgen/py.typed1 B
- 脚本scripts/packages/cadgen/src/cadgen/render.py1.9 KB
- 脚本scripts/packages/cadgen/src/cadgen/reporting.py4.0 KB
- 脚本scripts/packages/cadgen/src/cadgen/selector_types.py374 B
- 脚本scripts/packages/cadgen/src/cadgen/snapshot_cli.py63.0 KB
- 脚本scripts/packages/cadgen/src/cadgen/snapshot_core.py46.1 KB
- 脚本scripts/packages/cadgen/src/cadgen/sources.py1.2 KB
- 脚本scripts/packages/cadgen/src/cadgen/step_artifact_cli.py21.3 KB
- 脚本scripts/packages/cadgen/src/cadgen/step_artifacts.py21.7 KB
- 脚本scripts/packages/cadgen/src/cadgen/step_export_target.py17.8 KB
- 脚本scripts/packages/cadgen/src/cadgen/step_export.py14.9 KB
- 脚本scripts/packages/cadgen/src/cadgen/step_scene.py629 B
- 脚本scripts/packages/cadgen/src/cadgen/step_targets.py19.8 KB
- 脚本scripts/packages/cadgen/src/cadgen/validity.py7.7 KB
- 脚本scripts/packages/cadjs/bin/dxf-artifact.mjs646.0 KB
- 脚本scripts/packages/cadjs/bin/package.json21 B
- 脚本scripts/snapshot/__init__.py58 B
- 脚本scripts/snapshot/__main__.py2.1 KB
- 脚本scripts/snapshot/runtime/render.html386 B
- 脚本scripts/snapshot/runtime/snapshot-render.js1.2 MB
03 SKILL.md 正文
CAD generation, inspection, and validation
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.
Purpose
Create or modify parametric CAD models from natural-language requirements, generate validated STEP/STP artifacts, inspect geometry references, and return checked outputs. Treat STEP as the primary CAD artifact. Treat STL, 3MF, and native GLB as secondary export workflows that branch from a STEP-first process. For assemblies, prefer cadgen.assembly.AssemblyHelper with source-level build123d joints, named mating datums, and native labels when the parts have functional assembly relationships.
There are two ways into the STEP workflow: generate from build123d Python source (the default when designing from scratch or modifying a generated model), or import an existing STEP/STP file directly (when no generator exists or the user explicitly targets the STEP file). Both produce the same inspectable artifacts.
Use this skill when
Use this skill when the user asks for CAD files, STEP/STP files, build123d source, selector refs such as #o1.2.f1, mechanical parts, assemblies, enclosures, brackets, fixtures, holes, counterbores, countersinks, slots, pockets, bosses, standoffs, ribs, fillets, chamfers, shells, source-level joints, mating, or measurements. Also use it when the user supplies reference images or 2D technical drawings of a part to reproduce or take design intent from.
Also use it when the user asks for STL, 3MF, or native GLB output from CAD geometry. Keep those workflows secondary and load supported-exports.md for details. For 2D DXF drawings, use the $dxf skill; when a DXF projects from a 3D part, this skill owns the STEP geometry and $dxf owns the drawing.
Do not use this skill for render-only concept art, CAM toolpaths, engineering certification, FEA conclusions, architectural BIM, or freehand illustration unless the user also needs CAD geometry.
Default assumptions
Use these defaults unless the user specifies otherwise. These are first-pass modeling defaults, not manufacturability, tolerance, or certification claims:
- Units: millimeters.
- Origin: per the part-type defaults in
references/positioning.md; center of the main part or assembly when nothing better applies. - Base plane: XY.
- Up/extrusion axis: positive Z.
- Output geometry: closed, positive-volume solids unless the user requests surfaces or construction geometry.
- STEP structure: one valid solid, a compound of solids, or a labeled assembly compound.
- Assembly structure: fixed root part, part-local frames, named mating datums,
AssemblyHelperrelationships backed by build123d joints where applicable, explicit generated placements, and verbose native labels. - Small plastic enclosure wall: 2.0-3.0 mm when unspecified.
- Cosmetic fillet: 1.0-3.0 mm when safe for local geometry.
- M3/M4/M5 normal clearance holes: 3.4/4.5/5.5 mm unless another standard is requested.
Ask one focused clarification question only when missing information makes the model impossible, fit-critical, safety-critical, or compliance-bound. Otherwise proceed with explicit assumptions.
Tools and paths
From the CAD skill directory, the launcher shape is:
python scripts/gen ... # render GLB/topology packages from gen_step() Python sources
python scripts/export ... # STL/3MF/GLB mesh files from Python sources or imported STEP
python scripts/inspect ... # refs, measure, align, frame, diff
python scripts/snapshot ... # PNG/GIF visual review packets
python scripts/artifact ... # debug one on-demand render-package build (imported STEP)
Use the active project Python interpreter; treat python in examples as an interpreter placeholder. Use python scripts/<tool> --help for the complete current command interface; reference docs show recommended workflows, not every flag.
Snapshot inputs. This skill's snapshot renders .step/.step.py, .stp, .3mf, .glb and .stl. Implicit models and robot descriptions are rendered by the implicit-cad and urdf/srdf/sdf skills; the CLI refuses them rather than rendering something it should not.
Theme and display. Theme settings live under one --theme, display settings under one --display — the viewer's two tabs, one option each. The default theme is snapshot: Workbench Light with the ground grid and origin axis removed, because in a still image those read as geometry rather than as orientation. Pass --theme workbench-light for the viewer's own look. Projection is a theme trait honoured by every format, so a snapshot frames the same way the viewport does.
Streams. stdout carries the result; stderr carries progress, timing, and failures. Every tool answers on stdout — gen prints <outcome> <package path> per target — so 2>/dev/null leaves something parseable and >/dev/null leaves a readable log. JSON on stdout is always compact; pipe through jq . to read it. The two never interleave, so 2>/dev/null leaves a clean parseable result and >/dev/null leaves a readable log. For machine-readable output: gen, export, and snapshot take --json; inspect already emits JSON and takes --format text for prose. --verbose adds stage timing (and full tracebacks) on stderr. Output volume does not grow with model size — a 600-occurrence assembly logs the same dozen lines a single part does.
Failures print the exception and the frames in your own generator, not the runtime's:
[scripts/gen] FAILED: ValueError: bad radius
[scripts/gen] models/step/parts/widget.step.py:9 in gen_step
[scripts/gen] return _profile(radius)
[scripts/gen] re-run with --verbose for the full traceback
A build waits for a concurrent build of the same model rather than racing it, and says so on stderr (waiting for another run to finish building ...), repeating while it waits. Pass --lock-timeout SECONDS to give up instead and report {"ok":true,"contended":true}. With --json, each target's outcome is built, current, skipped-peer (the peer finished and its package is current), or contended (the peer is still building and this run declined to wait).
Target paths resolve from the command's current working directory, not from the skill directory. Run commands from the workspace that owns the artifacts and pass cwd-relative target paths so project CAD files never resolve accidentally under the skill directory. Keep a STEP output and its Python generator in the same directory with the same basename unless the user explicitly requests otherwise.
CAD references are #... selector tokens local to a target, for example #o1.2 or #o1.2.f1. Pass the STEP/CAD file as a separate target argument when using CAD CLIs.
Required workflow
Scale depth to the task: a simple part needs a short brief and few spec-driven checks; assemblies and fit-critical work need full positioning and alignment validation.
- Classify the task. New part, new assembly, source modification, direct STEP/STP inspection, reference selection, measurement/alignment check, snapshot review, or secondary output request.
- Load only the needed references. Use the triggers below instead of reading the whole reference set.
- Write a natural-language CAD brief. Extract dimensions, units, coordinate convention, feature intent, output paths, assumptions, and validation targets from all provided inputs — prose, reference images, technical drawings. Use
references/cad-brief.md. - Check named purchasable components. When an assembly includes named off-the-shelf actuators, servos, motors, electronics boards, connectors, or other purchasable components, search
$step-partsbefore creating simplified placeholder geometry. If no exact match is found, record the miss and then use a documented envelope. - Plan before coding. Define parameters, intent labels, source paths, expected bounding boxes, and any mating/positioning datums before editing.
- Edit source, not generated artifacts. Author build123d Python with
gen_step(), naming a buildable entry generator<name>.step.py(helper/library modules stay<name>.py; seereferences/step-generation.md). When a Python generator exists, runscripts/genon the generator, never on its exported STEP. Imported STEP/STP files (no generator) need no build step: inspect, snapshot, and the CAD Viewer generate their render artifacts on demand, andscripts/exportaccepts them directly. - Generate explicit targets. Run
scripts/genon explicit generator targets only; do not run directory-wide generation. Add--writewhen the user needs the.stepfile itself, and usescripts/exportwhen they need STL/3MF/GLB mesh files. - Validate geometrically. Run
scripts/inspect refs <step-or-cad-target> --facts --planes --positioningas the baseline, then verify the dimensions and relationships the user's spec calls out with targetedmeasure,align,frame, ordiffchecks. Runscripts/inspect validate <step-or-cad-target>for geometry soundness:refs --factsreports counts and bounds, and itsokfield covers ref resolution only — an open shell and an inverted solid both pass it. - Snapshot the primary STEP — snapshot validation is mandatory. After creating or visibly updating a primary STEP/STP part or assembly, ALWAYS run CAD
scripts/snapshotagainst it and review the output; deterministic checks passing is not a reason to skip. The only skip cases are documented inreferences/snapshot-review.md(no visible geometry changed, or no valid artifact exists); report the reason when skipping. - Repair and rerun. If a check fails, change the smallest responsible source section, regenerate, and rerun the failed validation.
Handoff
After completing CAD work that creates or modifies .step, .stp, .stl, .3mf, or native .glb artifacts, you must ALWAYS hand the explicit file path(s) to $cad-viewer when that skill is installed. $cad-viewer must start CAD Viewer if it is not already running and return link(s) to the relevant created or updated file(s); include those live viewer link(s) in the final response. If $cad-viewer is unavailable or startup fails, report that and rely on CLI inspection plus snapshots instead of silently omitting the handoff. This rule applies to every workflow in this skill, including secondary STL/3MF/GLB outputs.
When verification snapshots are generated, include the saved PNG/GIF snapshot(s) in the final response. If no snapshot applies, or if snapshot generation fails, say why and report the deterministic validation that still ran.
Non-negotiables
- Keep STEP as the primary validated CAD artifact. Generated STEP/STP, STL, 3MF, GLB/topology outputs, and render sidecars are derived artifacts; STL/3MF are secondary unless the user explicitly says otherwise.
- Use named parameters, closed solids, verbose native build123d labels, and source-controlled geometry intent.
- Author assembly positioning in source.
references/positioning.mdis authoritative forAssemblyHelper, build123d joints, explicitLocationtransforms, and alignment validation. - Do not use
git status,git diff, or file-size churn as CAD comparison for large exported STEP/STP, GLB/topology, STL, or 3MF artifacts. Compare source changes,scripts/inspectsummaries, snapshots, or generated topology output instead; use path-limited git status only for bookkeeping. - Report only checks that actually ran or are directly supported by tool output.
Progressive references
Load these files only when their trigger applies:
references/cad-brief.md— converting prose, reference images, and technical drawings into a CAD brief.references/build123d-modeling.md— build123d modeling patterns, topology, selectors, features, labels.references/step-generation.md— STEP generation from Python source, direct STEP/STP imports, and post-generation steps.references/inspection-and-validation.md— validation sequence, selector refs, facts, planes, measurements, alignment, diff, frame, and validation reporting.references/snapshot-review.md— mandatory snapshot policy, packet sizing, targeted views, and converting visual findings into geometry checks.references/positioning.md— part-local datums and origins, assembly transforms, build123d joints, CLI alignment validation, and positioning reports.references/parameters.md— parameterizing or animating a STEP model: source parameters, JS parameter/animation sidecars declared via gen_step params, viewer controls, and animation design.references/supported-exports.md— STL/3MF/native GLB mesh export workflows viascripts/export.references/repair-loop.md— diagnosis and repair procedures.
Final responses should include generated files, returned $cad-viewer viewer links, verification snapshots, validation actually run, assumptions, and caveats. Use references/inspection-and-validation.md for report structure.
04 同仓库更多 Skills
vercel-react-view-transitions
使用 React 的视图转换 API(`<ViewTransition>` 组件、`addTransitionType` 和 CSS 视图转换伪元素)实现流畅、原生感觉的动画的指南。每当用户想要添加页面转换、为路线更改设置动画、创建共享元素动画、为组件的进入/退出设置动画、为列表重新排序设置动画、实现定向(向前/向后)导航动画或在 Next.js 中集成视图转换时,请使用此技能。当用户提及视图转换、startViewTransition、ViewTransition、转换类型或询问有关在 React 中的 UI 状态之间设置动画而无需第三方动画库时也可使用。
vercel-react-native-skills
React Native和Expo构建高性能移动应用程序的最佳实践。在构建React Native组件、优化列表性能、实现动画或使用本机模块时使用。涉及React Native、Expo、移动性能或本机平台API的任务的触发器。
vercel-react-best-practices
Vercel Engineering的React和Next.js性能优化指南。在编写、审查或重构React/Next.js代码时,应使用此技能,以确保最佳性能模式。涉及React组件、Next.js页面、数据获取、捆绑优化或性能改进的任务的触发器。
vercel-composition-patterns
可扩展的React组合模式。在重构具有布尔属性增殖的组件、构建灵活的组件库或设计可重用的API时使用。涉及复合组件、渲染道具、上下文提供者或组件架构的任务的触发器。包括React 19 API变更。
ui-styling
使用 shadcn/ui 组件(基于 Radix UI + Tailwind 构建)、Tailwind CSS 实用优先样式和基于画布的视觉设计创建美观、可访问的用户界面。在构建用户界面、实现设计系统、创建响应式布局、添加可访问组件(对话框、下拉菜单、表单、表格)、自定义主题和颜色、实现深色模式、生成视觉设计和海报或跨应用程序建立一致的样式模式时使用。
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。”