{"id":26869,"plugin_id":"plugins_6ac09476ef008191a35887b22b0d048a","kind":"skill","collection_source":"plugin_package","comparison_source":null,"observed_at":"2026-10-06T00:02:41.503Z","digest":"4d4305082490c24baaa283ba026cf525b47340511d89df068cab4a22b32ebbc9","against":null,"payload":{"description":"Create/edit parametric CAD models, organize CAD projects, export STEP/STL/3MF/GLB files, resolve prompt references, and measure geometry with cadgen. Open and visually review existing STEP/STP, STL, 3MF and GLB files in CAD Viewer.","included_files":[{"relative_path":"LICENSE","size_in_bytes":1074},{"relative_path":"agents/openai.yaml","size_in_bytes":287},{"relative_path":"references/animation-deformation.md","size_in_bytes":3622},{"relative_path":"references/build123d-modeling.md","size_in_bytes":11128},{"relative_path":"references/cad-brief.md","size_in_bytes":2085},{"relative_path":"references/inspection-and-validation.md","size_in_bytes":11794},{"relative_path":"references/kinematics.md","size_in_bytes":19492},{"relative_path":"references/migrations.md","size_in_bytes":4463},{"relative_path":"references/positioning.md","size_in_bytes":5812},{"relative_path":"references/project-layout.md","size_in_bytes":8964},{"relative_path":"references/project-template.md","size_in_bytes":4636},{"relative_path":"references/repair-loop.md","size_in_bytes":3849},{"relative_path":"references/snapshot-review.md","size_in_bytes":14434},{"relative_path":"references/step-generation.md","size_in_bytes":26555},{"relative_path":"references/supported-exports.md","size_in_bytes":10070},{"relative_path":"requirements.txt","size_in_bytes":25}],"name":"cad","skill_md_contents":"---\nname: cad\ndescription: Create/edit parametric CAD models, organize CAD projects, export STEP/STL/3MF/GLB files, resolve prompt references, and measure geometry with cadgen. Open and visually review existing STEP/STP, STL, 3MF and GLB files in CAD Viewer.\nlicense: MIT\n---\n\n# CAD modeling and inspection\n\nProvenance: maintained in [earthtojake/text-to-cad](https://github.com/earthtojake/text-to-cad).\nUse the installed local skill files for the current interface.\n\n## Start with the task\n\nRead only the references needed for the request.\n\n| Task | First action | Reference |\n| --- | --- | --- |\n| **Create or edit a part or assembly** | Find the existing Python model, or create a decorated model below; edit source and run `python <model>.py`. | [Model contract](references/step-generation.md), [shape construction](references/build123d-modeling.md); [positioning](references/positioning.md) for assemblies |\n| **Organize a CAD project** | Follow its existing layout; for a new multi-model project use `src/`, format output folders, and a model catalog. | [Project layout](references/project-layout.md), [minimal starters](references/project-template.md) |\n| **Export STL, 3MF or GLB** | Add a mesh decorator for a maintained output, or run the format's `build INPUT.step OUT` command for a one-off export. | [Mesh exports](references/supported-exports.md) |\n| **Resolve a reference from a prompt** | Identify its saved STEP/STP document, open it with `read_scene`, and call `scene.resolve(ref)` as shown below. | [Reference syntax and inspection](references/inspection-and-validation.md#reference-syntax) |\n| **Measure or check geometry** | Write a Python check using native build123d geometry and, where useful, `cadgen.geometry`. | [Inspection and validation](references/inspection-and-validation.md) |\n| **Model from an image or drawing** | Extract the specified dimensions and record meaningful assumptions. | [Interpreting the request](references/cad-brief.md) |\n| **Open an existing STEP/STP, STL, 3MF or GLB** | Show it to the user. | [Show the model](#show-the-model) |\n| **Review appearance or motion** | Snapshot the saved document; use declared kinematics or animation for poses and clips. | [Snapshots](references/snapshot-review.md), [kinematics](references/kinematics.md) |\n| **Diagnose a failure** | Read the error and check the relevant model, geometry or command contract. | [Repair loop](references/repair-loop.md), [version migration](references/migrations.md) |\n| **A message says to migrate** | Do the migration now; an unmigrated model silently loses kinematics, materials and animation. | [Version migration](references/migrations.md) |\n\nFor 2D DXF drawings use `$dxf`; this skill owns any 3D part the drawing projects.\nUse the corresponding robot-description skill for URDF, SRDF or SDF.\n\n## Setup and paths\n\nInstall this skill's `requirements.txt` with the active project interpreter.\nSnapshots also need Chromium:\n\n```bash\npython -m pip install -r /path/to/installed/cad/requirements.txt\npython -m playwright install chromium\n```\n\nTreat `python` in examples as the active interpreter. `cadgen doctor <skill-dir>`\nchecks the skill's package pin and CAD kernel; use it for installation or OCP\nload errors. `python -m cadgen.cli` is the PATH-independent equivalent of\n`cadgen`. Use the relevant subcommand's `--help` for additional flags.\n\nRun project commands from the CAD project root. CLI input/output paths and\n`read_scene`/`read_step` paths are working-directory-relative; decorator `out=`\npaths are **relative to the model script**. Anchor file inputs on `__file__`\nwhen the model must run from any directory.\n\n## Create or edit a model\n\nA model is a plain Python script with a parameterless decorated function\nreturning a build123d shape. Use one model per entrypoint, with the script and\nits declared outputs sharing a filename stem. For example, `src/bracket.py`:\n\n```python\nfrom cadgen import build123d as bd\nfrom cadgen import step\n\nWIDTH = 40.0\n\n\n@step(out=\"../STEP/bracket.step\")\ndef bracket():\n    body = bd.Box(WIDTH, 20, 6)\n    body.label = \"bracket\"\n    return body\n\n\nif __name__ == \"__main__\":\n    bracket()\n```\n\n```bash\npython src/bracket.py\n```\n\n- Edit the model source when it exists, then run it to regenerate its outputs.\n  Document export and snapshot commands take saved files and never run source.\n- Keep meaningful dimensions explicit. Use millimeters and XY/+Z unless the\n  task or project specifies another convention; choose a useful functional datum.\n  Prefer closed, positive-volume solids for physical parts, while honoring\n  requests for surfaces or construction geometry.\n- Put parameterized geometry in ordinary factory functions; a decorated model\n  selects a configuration. Keep module bodies cheap: create geometry and read\n  CAD inputs inside the model or its helpers. Use the lazy `bd` import above;\n  use postponed annotations when annotations mention `bd` types.\n- Call child models inside the assembly model. Place their results with\n  `.moved()` or `Location * shape` to preserve shared geometry. Use meaningful\n  occurrence labels and source-defined placements. Rerun the parent assembly\n  to incorporate a changed child.\n- Read vendor STEP inputs with `cadgen.read_step`. Every file a build opens is\n  an input on its own, whatever reads it (`json.load`, `np.load`,\n  `bd.import_step`, a project font): nothing is declared. Never read a model's own\n  output as its input. Geometry must not depend on untracked\n  time, random values, environment variables or the working directory.\n- When named purchasable parts are needed, search `$step-parts` before making\n  placeholders. Record an unsuccessful search and any placeholder assumptions.\n\nFor unfamiliar dimensions or interfaces, record the assumptions needed to model\nand verify them. Ask for missing information when it materially affects the\nrequested result. Inspection and export requests do not need a modeling brief.\n\n## Mesh exports\n\nStack `@stl`, `@threemf` or `@glb` on the model for outputs that should be\nmaintained on every run. A model may declare only meshes; STEP is optional.\nFor a one-off export from an existing generated or imported STEP:\n\n```bash\ncadgen stl build STEP/bracket.step STL/bracket.stl\ncadgen 3mf build STEP/bracket.step 3MF/bracket.3mf\ncadgen glb build STEP/bracket.step GLB/bracket.glb\n```\n\nOmitting OUT writes one sibling file with the requested extension. It does\nnot discover declared model variants. See [mesh exports](references/supported-exports.md)\nfor decorator examples, mesh tolerances and animated GLB.\n\n## Prompt references and inspection\n\nA reference such as `STEP/assembly.step#o1.2.f7` identifies geometry in a\nparticular saved document. Its file part is the document as CAD Viewer copied it:\nthe path relative to the viewer's root (the folder it serves; for `cad_show`, the\nthread's project folder), or the full path when the model has no project around\nit, always with the file's real name and extension. A relative path resolves from\nthe working directory, so from the viewer's root pass it to `read_scene` as is:\n\n```python\nfrom cadgen import read_scene\n\nscene = read_scene(\"STEP/assembly.step\")\nselection = scene.resolve(\"STEP/assembly.step#o1.2.f7\")\nface = selection.shape()  # owned native geometry, in document world coordinates\nprint(selection.ref, face.area)\n```\n\nA note from the viewer's Quick Edit reads: what the person wants, then\n`File:` (the document it is about), `References:` (one per line, as above) and,\nwhen they sketched on the view, `Sketch: <path>`: a PNG of the view with their\nmarkup (or the image itself, attached). Look at the sketch before changing the model.\n\nFor a bare `#o1.2.f7`, use the identified target file. Do not guess between\nambiguous files or labels. Numeric refs belong to that saved revision;\nreopen and reselect after rebuilding. The [inspection reference](references/inspection-and-validation.md)\ncovers label aliases, enumeration, measurements and small reusable operations.\n\nThere is no inspect CLI. Put exploratory checks in the project's ignored\n`tmp/` (or system `/tmp/`); retain reusable checks in `checks/` or its existing\ntest directory. Keep them outside model-source and raw-output folders.\n\n## Verify and hand off\n\nChoose checks from the requested dimensions, clearances and topology. For STEP\noutputs, check the saved artifact with `read_scene` or `read_step`. For mesh-only\nmodels, check the model's returned native geometry and review the mesh output;\ndo not add a STEP solely to satisfy the workflow. Report units, thresholds,\nselected geometry and untested requirements. A failed computation is not a pass.\n\nAfter creating or visibly changing geometry, generate and review at least one\nsnapshot of the resulting STEP or mesh. Snapshots are your own review: always\nrender and read them yourself, never rely on the viewer for it. Choose additional\nviews to expose the features under review; see\n[snapshot policy and options](references/snapshot-review.md).\n\n```bash\ncadgen step snapshot STEP/bracket.step tmp/review.png\ncadgen stl snapshot STL/bracket.stl tmp/mesh.png\n```\n\nRepair failures in the source and rerun the affected checks. Use geometry and\nimages for CAD comparisons; path-targeted git status is bookkeeping, not\ngeometric evidence. `cadgen store why <model>.py` explains unexpected rebuilds;\n`python <model>.py --force` forces one model, and `cadgen daemon status` shows\nbuild progress. More diagnostics are in the [model contract](references/step-generation.md).\n\nInclude output files, checks actually run, and material assumptions or\nlimitations in the final response. The user sees the model in the viewer (Show\nthe model), so don't attach snapshots unless they ask for an image. Explain any\nsnapshot skip or failure using the cases in the snapshot reference.\n\n### Show the model\n\nShow the user each file you create or change, and any they ask to see. Snapshots and\nvalidation don't replace this.\n\n- If your tools include `cad_show` (your host may prefix it), use it, and follow its\n  description for when to call it again. `cad_view` reads what the user selected;\n  `cad_screenshot` shows you what they see. Neither is a review of your own work.\n- Otherwise run the CAD Viewer from the models directory (usually `models/`, not an\n  artifact's output folder):\n\n  ```bash\n  cd /absolute/path/to/model-workspace && cadgen viewer --host 127.0.0.1 --json --detach\n  ```\n\n  `--detach` returns once the viewer answers requests and leaves it running in the\n  background: always pass it, since a foreground viewer never exits (and piping its\n  output through `tail` can hide the URL for good). It starts or reuses the viewer.\n  Read `url` from its one JSON line (never guess the port); for each file under that\n  directory return `url?file=<URL-encoded relative path>`, or `url` alone to review the\n  directory. If it fails to launch, say so.\n\nGenerate changed artifacts first: the viewer never runs model scripts. Existing\nSTEP files compile on open when needed. Topology selection and measurement\nrequire STEP; meshes support visual review.\n"},"changes":[],"summary":"First saved snapshot. No earlier version is available for comparison.","summary_kind":"deterministic","summary_metadata":{}}