[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M7F8ZSS7KZMT4D916G9BSEZ4":3,"skill-same:01M7F8ZSS7KZMT4D916G9BSEZ4":60},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":19,"linkOnly":20,"markdownContent":21,"markdownBody":22,"frontMatter":23,"refName":24,"commitSha":25,"skillDirectory":26,"forksCount":27,"repositoryHtmlUrl":28,"repositoryHomepageUrl":6,"ownerHtmlUrl":29,"ownerBlogUrl":6,"ownerDescription":30,"updatedAt":31,"install":32,"resources":45},"01M7F8ZSS7KZMT4D916G9BSEZ4","dxf",null,"Generate, regenerate, and validate 2D DXF drawings from Python build123d sources. Use for DXF files, `.py` drawing scripts, @dxf models, 2D profiles, outlines, templates, gaskets, panels, flat patterns, laser\u002Fplasma\u002Fwaterjet cut layouts, and 2D drawing exports of CAD geometry.","lza6\u002FArmor-piercing-system-prompts","lza6","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F128880206?v=4","01M7EB3K7WPX5T28EJ2NVHE6EG","Chinese-tingfeng","01M7EB3K97E1KQ16QWKJMFNGX8",11,"MIT","https:\u002F\u002Fgithub.com\u002Flza6\u002FArmor-piercing-system-prompts\u002Fblob\u002Fmain\u002F06-前端与设计\u002Fdxf\u002FSKILL.md",[],[],"2026-11-16 10:05:34",false,"---\nname: dxf\ndescription: Generate, regenerate, and validate 2D DXF drawings from Python build123d sources. Use for DXF files, `.py` drawing scripts, @dxf models, 2D profiles, outlines, templates, gaskets, panels, flat patterns, laser\u002Fplasma\u002Fwaterjet cut layouts, and 2D drawing exports of CAD geometry.\n---\n\n# DXF generation and validation\n\nProvenance: maintained in [earthtojake\u002Ftext-to-cad](https:\u002F\u002Fgithub.com\u002Fearthtojake\u002Ftext-to-cad).\nUse the installed local skill files as the runtime source of truth; the\nrepository link is only for provenance and release review.\n\n## Setup\n\nThis skill's commands are thin entrypoints over the `cadgen` distribution, which\ncarries the Python build runtime and the JavaScript it executes. Install it once:\n\n```bash\npython -m pip install -r requirements.txt\n```\n\nDrawings are build123d geometry, so a drawing build loads the CAD kernel like a\nSTEP build does (~2.5s cold; the warm daemon absorbs it on re-runs). Only\n`cadgen dxf snapshot` additionally needs **Node 20 or newer on `PATH`** — it\nmeshes the flat pattern on demand through a bundled Node one-shot; a missing\n`node` is reported at render time.\n\n## Purpose\n\nCreate or modify 2D DXF drawings from natural-language requirements or from CAD\ngeometry, generate validated drawing artifacts, and return checked outputs. A\nDXF drawing's source of truth is a Python file named `\u003Cname>.py` defining one\nparameterless `@dxf` model function.\n\n**A drawing is a model.** It has the same wrapper, record, freshness gate and\nbuild job a `@step` part has; its one output is the `.dxf` file; it has no\ngeometry tree (nothing links to a drawing). Every run writes the sibling\n`\u003Cname>.dxf` (or the `out=` the decorator names); an unchanged source is a\nno-op; a drawing that calls a part model — `bracket()` inside its body — is\nstale whenever that part's GEOMETRY changes and current when it does not;\n`cadgen store why \u003Cdrawing>.py` explains the verdict; `--force` rebuilds it\nanyway. The CAD Viewer and `dxf snapshot` read the `.dxf` file itself, so the\nfile you hand a cutting service and the file the viewer renders are one and\nthe same.\n\n## The contract\n\n**A `@dxf` function takes no parameters and returns build123d 2D geometry. The\nengine writes the DXF.** You never construct a document, name a file, or place\nan entity — the same division of labor `@step` has.\n\n```python\nfrom cadgen import build123d as bd\nfrom cadgen import dxf\n\n\nHOLE_D = 4.5\n\n\n@dxf\ndef gasket():\n    with bd.BuildSketch() as cut:\n        bd.Rectangle(60, 40)\n        bd.Circle(HOLE_D \u002F 2, mode=bd.Mode.SUBTRACT)\n    return cut.sketch          # bare shape -> the CUT layer\n\n\nif __name__ == \"__main__\":\n    gasket()\n```\n\n- **Bare shape** → one `CUT` layer. That is the whole contract for most drawings.\n- **`{layer: shape}`** → named layers, when the drawing genuinely has more than\n  one CAM operation (`CUT` \u002F `ENGRAVE` \u002F `SCORE`). A `Compound` whose children\n  are all labelled means the same thing.\n- **No parameters.** Dimensions are module constants (`HOLE_D = 4.5`) or\n  constants imported from the part the drawing derives from; a different\n  drawing is a different file.\n- **Text** is `bd.Text(...)` engraved OUTLINES on a marking layer, never a DXF\n  `TEXT` entity: cut and marking toolchains consume geometry, and font rendering\n  inside CAM is unreliable.\n- **Geometry must lie in the XY plane.** A face taken from a solid sits at that\n  solid's height; relocate it (`flatten.flatten_face(face)`, or\n  `bd.Location((0, 0, -z)) * face`). The engine REFUSES off-plane geometry rather\n  than silently writing its XY shadow.\n- **Output bytes are a function of the geometry.** Layers are sorted by name and\n  entities by geometric content, so an unchanged drawing rebuilds to an identical\n  file, cold or warm, on any machine.\n\n## The three DXF workflows\n\nCopy the full template for the applicable workflow from\n`references\u002Fgenerator-templates.md` when creating a new drawing.\n\n1. **Drafted from scratch** (gaskets, panels, templates, cut layouts with no 3D\n   model behind them): a `\u003Cname>.py` that builds sketches and returns them.\n\n2. **Flat pattern of a generated STEP part**: a drawing script beside the model\n   it derives from, with its OWN stem (one model per file — `bracket_drawing.py`\n   beside `bracket.py`). Import the model and call it, exactly as an assembly\n   composes a child: importing never builds, and inside the drawing's build the\n   call returns the part's geometry (building the part first if it is stale).\n\n   ```python\n   from cadgen import dxf, flatten\n   from bracket import bracket        # a child: tracked by its RESULT\n\n   KERF = 0.15\n\n\n   @dxf\n   def bracket_drawing():\n       return flatten.flat_pattern(bracket(), coordinate=3.0, kerf=KERF)\n\n\n   if __name__ == \"__main__\":\n       bracket_drawing()\n   ```\n\n   The drawing's record pins the part's tree, so a part edit that changes its\n   geometry makes the drawing stale, and one that does not (a comment, a\n   refactor, a colour) leaves it current. Constants imported from the part\n   (`from bracket import THICKNESS`) are tracked by value the same way.\n\n3. **Flat pattern of an imported STEP** (a `.step`\u002F`.stp` with no Python source):\n   read it with `cadgen.read_step`, not `build123d.import_step`. It records the\n   file's content hash as a build INPUT, so replacing the vendor STEP makes the\n   drawing stale on its own, with no `--force`; read it through build123d and the\n   drawing stays \"current\" against a file that changed underneath it.\n\n   ```python\n   from pathlib import Path\n\n   from cadgen import dxf, flatten, read_step\n\n   _HERE = Path(__file__).resolve().parent\n\n   KERF = 0.15\n\n\n   @dxf\n   def panel_flat():\n       panel = read_step(_HERE \u002F \"imported\" \u002F \"vendor_panel.step\")   # recorded input\n       return flatten.flat_pattern(panel, coordinate=3.0, kerf=KERF)\n\n\n   if __name__ == \"__main__\":\n       panel_flat()\n   ```\n\n   **Never read a STEP this project generates.** Reading the `.step` a `@step`\n   model writes is not a loop, it is a drawing whose input changes on every run of\n   the model: the freshness gate can never say \"current\", every build is a full\n   rebuild, and the flat pattern depends on what the last run left on disk. Keep\n   source STEPs in an `imported\u002F` directory beside the drawing, committed like any\n   other input — input path and output path being different files is the whole\n   rule. For a STEP this project DOES generate, use workflow 2 instead: import the\n   model script and call it, which is tracked by result and never touches an\n   artifact.\n\nOne model per file: a source declaring both a `@step` and a `@dxf` model is\nrejected — a drawing gets its own script. A drawing composes models, never the\nreverse: calling a `@dxf` function from a `@step` body is just its 2D geometry\nand links nothing. The viewer catalog is artifacts-only: scripts never list;\nthe `.dxf` the run writes is the entry the viewer renders.\n\n## Use this skill when\n\nUse this skill when the user asks for DXF files, 2D drawings, profiles, outlines,\ntemplates, gaskets, panels, flat patterns, or cut layouts for laser, plasma,\nwaterjet, or CNC routing.\n\nUse `$cad` for the 3D part or assembly a DXF derives from. Use `$sendcutsend` for\nSendCutSend-specific upload preflight.\n\n## Defaults\n\nUse these defaults unless the user specifies otherwise:\n\n- Units: millimeters. The engine sets them; a drawing never declares units.\n- Geometry lives at 1:1 scale in the XY plane.\n- Cut profiles close. Open contours belong on bend\u002Fengrave\u002Freference layers —\n  generation validation enforces this (see Validation).\n- For CAD-backed parts, derive contours from the real topology with\n  `cadgen.flatten` rather than redrawing them: `planar_faces` selects,\n  `flatten_face` lays a face into XY exactly, `union_faces` fuses, and\n  `flat_pattern` does all of it in one call. Hand-drawn parametric outlines only\n  when there is no reliable 3D topology.\n- Kerf \u002F tool-radius compensation is `flatten.offset_profile(shape, amount)` or\n  `flat_pattern(..., kerf=...)`; never hand-offset coordinates.\n- **Curves stay curves.** The union and the offset are exact OCC operations, so a\n  filleted corner exports as an `ARC` and a hole as a `CIRCLE`, kerf included. A\n  profile that comes out as hundreds of short `LINE`s means something fell back\n  to the sampled path — investigate rather than accept it.\n- Layers carry intent: keep cut geometry and bend\u002Ffold lines on separate layers,\n  and include \"bend\" in bend-layer names so downstream tools classify them as\n  bends rather than cuts.\n- DXF layers are drawing structure, not STEP part\u002Fassembly structure.\n\n## Tool\n\n```bash\npython \u003Cdrawing>.py [flags]                    # its __main__ calls the @dxf model, which writes the .dxf\ncadgen dxf snapshot \u003Cdrawing.dxf> \u003Cfile.png>   # render it\ncadgen store why \u003Cdrawing>.py                  # why the drawing is stale or current\n```\n\n**Running the script (its `__main__` call) is the only door.** There is no\n`cadgen dxf build`: a `.dxf` has no derived state a command must materialize —\nthe file IS the product, the CAD Viewer parses it directly, and `dxf snapshot`\nmeshes it on demand. The drawing's gate makes a rebuild cheap: an unchanged\nsource whose `.dxf` still verifies and whose part children are unchanged is a\nno-op, and `--force` rebuilds anyway. The bytes are a function of the\ndrawing's GEOMETRY, so a cold run and a warm daemon worker write the same\nfile. Builds never wait on or cancel one another; a drawing that calls parts\nbuilds them in parallel like any parent.\n\nAn imported `.dxf` needs nothing at all — hand it straight to snapshot or the\nViewer.\n\nUse the active project Python interpreter; treat `python` as an interpreter\nplaceholder, and use `--help` for the full interface. Target paths resolve from\nthe command's current working directory; run from the workspace that owns the\nartifacts with cwd-relative target paths. Keep a drawing script in the same\ndirectory as the geometry it derives from, named `\u003Cname>.py`.\n\nFlags (a model script runs itself; there is no generation CLI):\n\n- `--force` — regenerate even when the recorded output is current.\n- `--verbose`, `--json`.\n\nA run answers on stdout exactly as a STEP model's does — `built DXF\u002Fplate_drawing.dxf`\nor `current DXF\u002Fplate_drawing.dxf` — with progress on stderr; `--json` makes the\nresult one JSON line (`outcome`, `document`, and `tree`, which is null for a\ndrawing) and the progress one JSON line per transition.\n\nOne script, one drawing: run each script you want built. Do not put output paths\nin the `@dxf` function's return value; `out=` on the decorator is the only\nplace a drawing names its destination (relative to the script).\n\n`cadgen dxf snapshot` renders a drawing's 3D flat pattern to a PNG still:\n\n```bash\ncadgen dxf snapshot path\u002Fto\u002Fimported.dxf review.png\ncadgen dxf snapshot path\u002Fto\u002Fdrawing.dxf review.png --camera top\n```\n\nIt takes the `.dxf` document only — a model script is refused by name (run\n`python \u003Cdrawing>.py`, then snapshot the drawing it wrote). The command meshes\nthe flat pattern on demand through the bundled Node one-shot and\nrenders it through the shared snapshot CLI (`cadgen.snapshot_cli`) and the same\nheadless browser runtime every rendering skill uses — so geometry and materials\nrender identically to the CAD Viewer; the default `snapshot` theme differs from the\nviewport only by dropping the grid, origin axis and shadows.\n\nOUT — the second positional — is written exactly as given, with a relative path resolved against the\ncurrent working directory. The target is deleted before the render starts and the\nfinished image is written atomically, so: reuse one name while iterating (every read\nis provably the render you just ran), name the iterations when you genuinely need to\ncompare two, and treat a missing file as the failure signal — there is never an older\nimage at the path to mistake for output. A directory (`tmp\u002F` as OUT) is the\ndon't-care case and gets a generated timestamped name inside it, printed on the\n`saved snapshot:` line.\n\nGrammar: `cadgen dxf snapshot TARGET [OUT] [flags]`. Flags: `--mode view|list`,\n`--camera`, `--theme`, `--size-profile`, `--width`\u002F`--height`, `--job`,\n`--view-labels`, `--debug`, `--json`. Theme settings live under one `--theme`,\nmirroring the viewer's Theme tab; the default theme is `snapshot`, Workbench Light\nwithout the ground grid, origin axis or shadows. The command has no `--display`,\nand no selector, kinematics, section or exploded options at all — they are absent\nfrom `--help` rather than refused at runtime, because a drawing carries no CAD\ntopology and display settings are CAD topology settings.\n\nNo CLI inspects an existing `.dxf`. For entity\u002Flayer checks read it with `ezdxf`\ndirectly (it arrives with build123d), and `validate_dxf_file` for the drawing checks;\nreview geometry visually with `$cad-viewer`.\n\n## Workflow\n\n1. Convert the request into a short brief: outline dimensions, holes and slots, layers, units, output path, and validation targets.\n2. Pick the workflow: drafted from scratch, flat pattern of a generated model (create and validate the 3D geometry with `$cad` first), or flat pattern of an imported STEP.\n3. Write or edit the `\u003Cname>.py` source with meaningful dimensions as named constants, reusing the model's geometry helpers instead of duplicating formulas.\n4. Run each drawing script directly (`python \u003Cdrawing>.py`); do not sweep directories.\n\n```bash\npython path\u002Fto\u002Fsource.py\npython path\u002Fto\u002Fsource.py --force\n```\n\n5. Validate the generated DXF deterministically, then hand off and report.\n\n## Viewer integration\n\nThe CAD Viewer catalogs `.dxf` files only (artifacts, never scripts) and is a static\nvisualization tool: it renders the `.dxf` that exists on disk (parsing and meshing it\nitself — 2D line work for dimensioned drawings, a fold-able 3D flat pattern for cut\nlayouts) and never runs a script. A drawing with no `.dxf` yet simply does not appear\nuntil its script has been run; regenerating after edits is likewise the script's job.\nThere is no in-viewer export. An imported `.dxf` renders directly with no artifact\nmanagement.\n\n## Validation\n\nValidation happens IN generation, not after: every `@dxf` build runs the drawing\nchecks on the document the engine just serialized, before anything is written, and\na build with error findings fails. The checks: cut-layer profiles must close\n(polylines, circles, or chained line\u002Farc loops), zero-length\u002Fdegenerate entities are\nrejected, exact duplicate geometry (double-cut risk) is rejected, explicitly unitless\ndocuments are rejected, and an empty modelspace is rejected. Open geometry is allowed\nonly on bend\u002Fengrave\u002Freference-intent layers (matched by name).\n\nThe same checks run post-hoc on any existing `.dxf` file — including one that\nnever came from a generator — through `cadgen.drawing_checks`:\n\n```python\nfrom cadgen.drawing_checks import validate_dxf_file\n\nfor finding in validate_dxf_file(\"path\u002Fto\u002Ffile.dxf\"):\n    print(finding.render())\n```\n\nBeyond the built-in checks, verify requested dimensions with targeted `ezdxf` reads\n(entity counts by layer, drawing extents, every dimension the user specified) against\nthe generated sibling `.dxf` (or the `out=` path when one is declared), and\nreview geometry visually in the CAD Viewer:\n\n```python\nimport ezdxf\n\ndoc = ezdxf.readfile(\"path\u002Fto\u002Fsource.dxf\")\nmsp = doc.modelspace()\ncut = msp.query('*[layer==\"CUT\"]')\nholes = msp.query('CIRCLE[layer==\"CUT\"]')\n```\n\nReport only checks that actually ran.\n\n## Handoff\n\nAfter creating or modifying DXF drawings, you must ALWAYS hand the explicit `.dxf`\nfile path(s) to `$cad-viewer` when that skill is installed and include its live\nviewer link(s) in the final response. If `$cad-viewer` is unavailable or startup fails, report\nthat and rely on `ezdxf` checks instead of silently omitting the handoff.\n\nFinal responses should include generated files, returned viewer links, validation\nactually run, and assumptions.\n","# DXF generation and validation\n\nProvenance: maintained in [earthtojake\u002Ftext-to-cad](https:\u002F\u002Fgithub.com\u002Fearthtojake\u002Ftext-to-cad).\nUse the installed local skill files as the runtime source of truth; the\nrepository link is only for provenance and release review.\n\n## Setup\n\nThis skill's commands are thin entrypoints over the `cadgen` distribution, which\ncarries the Python build runtime and the JavaScript it executes. Install it once:\n\n```bash\npython -m pip install -r requirements.txt\n```\n\nDrawings are build123d geometry, so a drawing build loads the CAD kernel like a\nSTEP build does (~2.5s cold; the warm daemon absorbs it on re-runs). Only\n`cadgen dxf snapshot` additionally needs **Node 20 or newer on `PATH`** — it\nmeshes the flat pattern on demand through a bundled Node one-shot; a missing\n`node` is reported at render time.\n\n## Purpose\n\nCreate or modify 2D DXF drawings from natural-language requirements or from CAD\ngeometry, generate validated drawing artifacts, and return checked outputs. A\nDXF drawing's source of truth is a Python file named `\u003Cname>.py` defining one\nparameterless `@dxf` model function.\n\n**A drawing is a model.** It has the same wrapper, record, freshness gate and\nbuild job a `@step` part has; its one output is the `.dxf` file; it has no\ngeometry tree (nothing links to a drawing). Every run writes the sibling\n`\u003Cname>.dxf` (or the `out=` the decorator names); an unchanged source is a\nno-op; a drawing that calls a part model — `bracket()` inside its body — is\nstale whenever that part's GEOMETRY changes and current when it does not;\n`cadgen store why \u003Cdrawing>.py` explains the verdict; `--force` rebuilds it\nanyway. The CAD Viewer and `dxf snapshot` read the `.dxf` file itself, so the\nfile you hand a cutting service and the file the viewer renders are one and\nthe same.\n\n## The contract\n\n**A `@dxf` function takes no parameters and returns build123d 2D geometry. The\nengine writes the DXF.** You never construct a document, name a file, or place\nan entity — the same division of labor `@step` has.\n\n```python\nfrom cadgen import build123d as bd\nfrom cadgen import dxf\n\n\nHOLE_D = 4.5\n\n\n@dxf\ndef gasket():\n    with bd.BuildSketch() as cut:\n        bd.Rectangle(60, 40)\n        bd.Circle(HOLE_D \u002F 2, mode=bd.Mode.SUBTRACT)\n    return cut.sketch          # bare shape -> the CUT layer\n\n\nif __name__ == \"__main__\":\n    gasket()\n```\n\n- **Bare shape** → one `CUT` layer. That is the whole contract for most drawings.\n- **`{layer: shape}`** → named layers, when the drawing genuinely has more than\n  one CAM operation (`CUT` \u002F `ENGRAVE` \u002F `SCORE`). A `Compound` whose children\n  are all labelled means the same thing.\n- **No parameters.** Dimensions are module constants (`HOLE_D = 4.5`) or\n  constants imported from the part the drawing derives from; a different\n  drawing is a different file.\n- **Text** is `bd.Text(...)` engraved OUTLINES on a marking layer, never a DXF\n  `TEXT` entity: cut and marking toolchains consume geometry, and font rendering\n  inside CAM is unreliable.\n- **Geometry must lie in the XY plane.** A face taken from a solid sits at that\n  solid's height; relocate it (`flatten.flatten_face(face)`, or\n  `bd.Location((0, 0, -z)) * face`). The engine REFUSES off-plane geometry rather\n  than silently writing its XY shadow.\n- **Output bytes are a function of the geometry.** Layers are sorted by name and\n  entities by geometric content, so an unchanged drawing rebuilds to an identical\n  file, cold or warm, on any machine.\n\n## The three DXF workflows\n\nCopy the full template for the applicable workflow from\n`references\u002Fgenerator-templates.md` when creating a new drawing.\n\n1. **Drafted from scratch** (gaskets, panels, templates, cut layouts with no 3D\n   model behind them): a `\u003Cname>.py` that builds sketches and returns them.\n\n2. **Flat pattern of a generated STEP part**: a drawing script beside the model\n   it derives from, with its OWN stem (one model per file — `bracket_drawing.py`\n   beside `bracket.py`). Import the model and call it, exactly as an assembly\n   composes a child: importing never builds, and inside the drawing's build the\n   call returns the part's geometry (building the part first if it is stale).\n\n   ```python\n   from cadgen import dxf, flatten\n   from bracket import bracket        # a child: tracked by its RESULT\n\n   KERF = 0.15\n\n\n   @dxf\n   def bracket_drawing():\n       return flatten.flat_pattern(bracket(), coordinate=3.0, kerf=KERF)\n\n\n   if __name__ == \"__main__\":\n       bracket_drawing()\n   ```\n\n   The drawing's record pins the part's tree, so a part edit that changes its\n   geometry makes the drawing stale, and one that does not (a comment, a\n   refactor, a colour) leaves it current. Constants imported from the part\n   (`from bracket import THICKNESS`) are tracked by value the same way.\n\n3. **Flat pattern of an imported STEP** (a `.step`\u002F`.stp` with no Python source):\n   read it with `cadgen.read_step`, not `build123d.import_step`. It records the\n   file's content hash as a build INPUT, so replacing the vendor STEP makes the\n   drawing stale on its own, with no `--force`; read it through build123d and the\n   drawing stays \"current\" against a file that changed underneath it.\n\n   ```python\n   from pathlib import Path\n\n   from cadgen import dxf, flatten, read_step\n\n   _HERE = Path(__file__).resolve().parent\n\n   KERF = 0.15\n\n\n   @dxf\n   def panel_flat():\n       panel = read_step(_HERE \u002F \"imported\" \u002F \"vendor_panel.step\")   # recorded input\n       return flatten.flat_pattern(panel, coordinate=3.0, kerf=KERF)\n\n\n   if __name__ == \"__main__\":\n       panel_flat()\n   ```\n\n   **Never read a STEP this project generates.** Reading the `.step` a `@step`\n   model writes is not a loop, it is a drawing whose input changes on every run of\n   the model: the freshness gate can never say \"current\", every build is a full\n   rebuild, and the flat pattern depends on what the last run left on disk. Keep\n   source STEPs in an `imported\u002F` directory beside the drawing, committed like any\n   other input — input path and output path being different files is the whole\n   rule. For a STEP this project DOES generate, use workflow 2 instead: import the\n   model script and call it, which is tracked by result and never touches an\n   artifact.\n\nOne model per file: a source declaring both a `@step` and a `@dxf` model is\nrejected — a drawing gets its own script. A drawing composes models, never the\nreverse: calling a `@dxf` function from a `@step` body is just its 2D geometry\nand links nothing. The viewer catalog is artifacts-only: scripts never list;\nthe `.dxf` the run writes is the entry the viewer renders.\n\n## Use this skill when\n\nUse this skill when the user asks for DXF files, 2D drawings, profiles, outlines,\ntemplates, gaskets, panels, flat patterns, or cut layouts for laser, plasma,\nwaterjet, or CNC routing.\n\nUse `$cad` for the 3D part or assembly a DXF derives from. Use `$sendcutsend` for\nSendCutSend-specific upload preflight.\n\n## Defaults\n\nUse these defaults unless the user specifies otherwise:\n\n- Units: millimeters. The engine sets them; a drawing never declares units.\n- Geometry lives at 1:1 scale in the XY plane.\n- Cut profiles close. Open contours belong on bend\u002Fengrave\u002Freference layers —\n  generation validation enforces this (see Validation).\n- For CAD-backed parts, derive contours from the real topology with\n  `cadgen.flatten` rather than redrawing them: `planar_faces` selects,\n  `flatten_face` lays a face into XY exactly, `union_faces` fuses, and\n  `flat_pattern` does all of it in one call. Hand-drawn parametric outlines only\n  when there is no reliable 3D topology.\n- Kerf \u002F tool-radius compensation is `flatten.offset_profile(shape, amount)` or\n  `flat_pattern(..., kerf=...)`; never hand-offset coordinates.\n- **Curves stay curves.** The union and the offset are exact OCC operations, so a\n  filleted corner exports as an `ARC` and a hole as a `CIRCLE`, kerf included. A\n  profile that comes out as hundreds of short `LINE`s means something fell back\n  to the sampled path — investigate rather than accept it.\n- Layers carry intent: keep cut geometry and bend\u002Ffold lines on separate layers,\n  and include \"bend\" in bend-layer names so downstream tools classify them as\n  bends rather than cuts.\n- DXF layers are drawing structure, not STEP part\u002Fassembly structure.\n\n## Tool\n\n```bash\npython \u003Cdrawing>.py [flags]                    # its __main__ calls the @dxf model, which writes the .dxf\ncadgen dxf snapshot \u003Cdrawing.dxf> \u003Cfile.png>   # render it\ncadgen store why \u003Cdrawing>.py                  # why the drawing is stale or current\n```\n\n**Running the script (its `__main__` call) is the only door.** There is no\n`cadgen dxf build`: a `.dxf` has no derived state a command must materialize —\nthe file IS the product, the CAD Viewer parses it directly, and `dxf snapshot`\nmeshes it on demand. The drawing's gate makes a rebuild cheap: an unchanged\nsource whose `.dxf` still verifies and whose part children are unchanged is a\nno-op, and `--force` rebuilds anyway. The bytes are a function of the\ndrawing's GEOMETRY, so a cold run and a warm daemon worker write the same\nfile. Builds never wait on or cancel one another; a drawing that calls parts\nbuilds them in parallel like any parent.\n\nAn imported `.dxf` needs nothing at all — hand it straight to snapshot or the\nViewer.\n\nUse the active project Python interpreter; treat `python` as an interpreter\nplaceholder, and use `--help` for the full interface. Target paths resolve from\nthe command's current working directory; run from the workspace that owns the\nartifacts with cwd-relative target paths. Keep a drawing script in the same\ndirectory as the geometry it derives from, named `\u003Cname>.py`.\n\nFlags (a model script runs itself; there is no generation CLI):\n\n- `--force` — regenerate even when the recorded output is current.\n- `--verbose`, `--json`.\n\nA run answers on stdout exactly as a STEP model's does — `built DXF\u002Fplate_drawing.dxf`\nor `current DXF\u002Fplate_drawing.dxf` — with progress on stderr; `--json` makes the\nresult one JSON line (`outcome`, `document`, and `tree`, which is null for a\ndrawing) and the progress one JSON line per transition.\n\nOne script, one drawing: run each script you want built. Do not put output paths\nin the `@dxf` function's return value; `out=` on the decorator is the only\nplace a drawing names its destination (relative to the script).\n\n`cadgen dxf snapshot` renders a drawing's 3D flat pattern to a PNG still:\n\n```bash\ncadgen dxf snapshot path\u002Fto\u002Fimported.dxf review.png\ncadgen dxf snapshot path\u002Fto\u002Fdrawing.dxf review.png --camera top\n```\n\nIt takes the `.dxf` document only — a model script is refused by name (run\n`python \u003Cdrawing>.py`, then snapshot the drawing it wrote). The command meshes\nthe flat pattern on demand through the bundled Node one-shot and\nrenders it through the shared snapshot CLI (`cadgen.snapshot_cli`) and the same\nheadless browser runtime every rendering skill uses — so geometry and materials\nrender identically to the CAD Viewer; the default `snapshot` theme differs from the\nviewport only by dropping the grid, origin axis and shadows.\n\nOUT — the second positional — is written exactly as given, with a relative path resolved against the\ncurrent working directory. The target is deleted before the render starts and the\nfinished image is written atomically, so: reuse one name while iterating (every read\nis provably the render you just ran), name the iterations when you genuinely need to\ncompare two, and treat a missing file as the failure signal — there is never an older\nimage at the path to mistake for output. A directory (`tmp\u002F` as OUT) is the\ndon't-care case and gets a generated timestamped name inside it, printed on the\n`saved snapshot:` line.\n\nGrammar: `cadgen dxf snapshot TARGET [OUT] [flags]`. Flags: `--mode view|list`,\n`--camera`, `--theme`, `--size-profile`, `--width`\u002F`--height`, `--job`,\n`--view-labels`, `--debug`, `--json`. Theme settings live under one `--theme`,\nmirroring the viewer's Theme tab; the default theme is `snapshot`, Workbench Light\nwithout the ground grid, origin axis or shadows. The command has no `--display`,\nand no selector, kinematics, section or exploded options at all — they are absent\nfrom `--help` rather than refused at runtime, because a drawing carries no CAD\ntopology and display settings are CAD topology settings.\n\nNo CLI inspects an existing `.dxf`. For entity\u002Flayer checks read it with `ezdxf`\ndirectly (it arrives with build123d), and `validate_dxf_file` for the drawing checks;\nreview geometry visually with `$cad-viewer`.\n\n## Workflow\n\n1. Convert the request into a short brief: outline dimensions, holes and slots, layers, units, output path, and validation targets.\n2. Pick the workflow: drafted from scratch, flat pattern of a generated model (create and validate the 3D geometry with `$cad` first), or flat pattern of an imported STEP.\n3. Write or edit the `\u003Cname>.py` source with meaningful dimensions as named constants, reusing the model's geometry helpers instead of duplicating formulas.\n4. Run each drawing script directly (`python \u003Cdrawing>.py`); do not sweep directories.\n\n```bash\npython path\u002Fto\u002Fsource.py\npython path\u002Fto\u002Fsource.py --force\n```\n\n5. Validate the generated DXF deterministically, then hand off and report.\n\n## Viewer integration\n\nThe CAD Viewer catalogs `.dxf` files only (artifacts, never scripts) and is a static\nvisualization tool: it renders the `.dxf` that exists on disk (parsing and meshing it\nitself — 2D line work for dimensioned drawings, a fold-able 3D flat pattern for cut\nlayouts) and never runs a script. A drawing with no `.dxf` yet simply does not appear\nuntil its script has been run; regenerating after edits is likewise the script's job.\nThere is no in-viewer export. An imported `.dxf` renders directly with no artifact\nmanagement.\n\n## Validation\n\nValidation happens IN generation, not after: every `@dxf` build runs the drawing\nchecks on the document the engine just serialized, before anything is written, and\na build with error findings fails. The checks: cut-layer profiles must close\n(polylines, circles, or chained line\u002Farc loops), zero-length\u002Fdegenerate entities are\nrejected, exact duplicate geometry (double-cut risk) is rejected, explicitly unitless\ndocuments are rejected, and an empty modelspace is rejected. Open geometry is allowed\nonly on bend\u002Fengrave\u002Freference-intent layers (matched by name).\n\nThe same checks run post-hoc on any existing `.dxf` file — including one that\nnever came from a generator — through `cadgen.drawing_checks`:\n\n```python\nfrom cadgen.drawing_checks import validate_dxf_file\n\nfor finding in validate_dxf_file(\"path\u002Fto\u002Ffile.dxf\"):\n    print(finding.render())\n```\n\nBeyond the built-in checks, verify requested dimensions with targeted `ezdxf` reads\n(entity counts by layer, drawing extents, every dimension the user specified) against\nthe generated sibling `.dxf` (or the `out=` path when one is declared), and\nreview geometry visually in the CAD Viewer:\n\n```python\nimport ezdxf\n\ndoc = ezdxf.readfile(\"path\u002Fto\u002Fsource.dxf\")\nmsp = doc.modelspace()\ncut = msp.query('*[layer==\"CUT\"]')\nholes = msp.query('CIRCLE[layer==\"CUT\"]')\n```\n\nReport only checks that actually ran.\n\n## Handoff\n\nAfter creating or modifying DXF drawings, you must ALWAYS hand the explicit `.dxf`\nfile path(s) to `$cad-viewer` when that skill is installed and include its live\nviewer link(s) in the final response. If `$cad-viewer` is unavailable or startup fails, report\nthat and rely on `ezdxf` checks instead of silently omitting the handoff.\n\nFinal responses should include generated files, returned viewer links, validation\nactually run, and assumptions.\n",{"name":5,"description":7},"main","d69096e239f2a89aabc2cd078c47664a9d3b1e11","06-前端与设计\u002Fdxf",3,"https:\u002F\u002Fgithub.com\u002Flza6\u002FArmor-piercing-system-prompts","https:\u002F\u002Fgithub.com\u002Flza6","个人vx：Tf00798\r\n个人✈：@TFGY999","2026-10-08 14:29:22",{"source":8,"skillName":5,"commands":33,"prompt":43,"zipAvailable":44},[34,37,40],{"tool":35,"command":36},"npx","npx skills add lza6\u002FArmor-piercing-system-prompts --skill dxf",{"tool":38,"command":39},"bunx","bunx skills add lza6\u002FArmor-piercing-system-prompts --skill dxf",{"tool":41,"command":42},"pnpm","pnpm dlx skills add lza6\u002FArmor-piercing-system-prompts --skill dxf","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Flza6\u002FArmor-piercing-system-prompts\u002Fblob\u002Fmain\u002F06-前端与设计\u002Fdxf\u002FSKILL.md",true,[46,52,56],{"path":47,"resourceType":48,"resourceTypeDesc":49,"sizeBytes":50,"sourceHtmlUrl":51},"agents\u002Fopenai.yaml","REFERENCE","参考文档",265,"https:\u002F\u002Fgithub.com\u002Flza6\u002FArmor-piercing-system-prompts\u002Fblob\u002Fmain\u002F06-前端与设计\u002Fdxf\u002Fagents\u002Fopenai.yaml",{"path":53,"resourceType":48,"resourceTypeDesc":49,"sizeBytes":54,"sourceHtmlUrl":55},"references\u002Fgenerator-templates.md",6219,"https:\u002F\u002Fgithub.com\u002Flza6\u002FArmor-piercing-system-prompts\u002Fblob\u002Fmain\u002F06-前端与设计\u002Fdxf\u002Freferences\u002Fgenerator-templates.md",{"path":57,"resourceType":48,"resourceTypeDesc":49,"sizeBytes":58,"sourceHtmlUrl":59},"requirements.txt",24,"https:\u002F\u002Fgithub.com\u002Flza6\u002FArmor-piercing-system-prompts\u002Fblob\u002Fmain\u002F06-前端与设计\u002Fdxf\u002Frequirements.txt",[61,68,73,80,87,94],{"skillNo":62,"name":63,"nameZh":6,"description":64,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":65,"categories":66,"keywords":67,"publishedAt":19},"01M7FFG485KY83TD6HSC4YPCMC","obsidian-clipper-template-creator","Guide for creating templates for the Obsidian Web Clipper. Use when you want to create a new clipping template, understand available variables, or format clipped content.","https:\u002F\u002Fgithub.com\u002Flza6\u002FArmor-piercing-system-prompts\u002Fblob\u002Fmain\u002F07-后端与架构\u002Fobsidian-clipper-template-creator\u002FSKILL.md",[],[],{"skillNo":69,"name":63,"nameZh":6,"description":64,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":70,"categories":71,"keywords":72,"publishedAt":19},"01M7FFG0T6AZ0STEJPSB3CX84K","https:\u002F\u002Fgithub.com\u002Flza6\u002FArmor-piercing-system-prompts\u002Fblob\u002Fmain\u002F07-后端与架构\u002Fobsidian-clipper-template-creator-antigravity-awesome-skills-main\u002FSKILL.md",[],[],{"skillNo":74,"name":75,"nameZh":6,"description":76,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":77,"categories":78,"keywords":79,"publishedAt":19},"01M7FFFY0QEM14SKWPDYGMXM2P","python-api","Programmatic Object-Detection-Metrics API guidance for BoundingBox, BoundingBoxes, Evaluator, enums, coordinate conversion, AP\u002FmAP semantics, and source-style import diagnostics.","https:\u002F\u002Fgithub.com\u002Flza6\u002FArmor-piercing-system-prompts\u002Fblob\u002Fmain\u002F07-后端与架构\u002Fobject-detection-metrics\u002Fsub-skills\u002Fpython-api\u002FSKILL.md",[],[],{"skillNo":81,"name":82,"nameZh":6,"description":83,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":84,"categories":85,"keywords":86,"publishedAt":19},"01M7FFFVZQZ2GJ0C0TGP7JHD20","file-evaluation","Folder-based PASCAL VOC AP\u002FmAP evaluation from ground-truth and detection text files.","https:\u002F\u002Fgithub.com\u002Flza6\u002FArmor-piercing-system-prompts\u002Fblob\u002Fmain\u002F07-后端与架构\u002Fobject-detection-metrics\u002Fsub-skills\u002Ffile-evaluation\u002FSKILL.md",[],[],{"skillNo":88,"name":89,"nameZh":6,"description":90,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":91,"categories":92,"keywords":93,"publishedAt":19},"01M7FFFSFNYSE77SJ6PE1CK2DA","object-detection-metrics","Guides legacy Object-Detection-Metrics PASCAL VOC AP\u002FmAP evaluation from detection text folders and direct Python API classes.","https:\u002F\u002Fgithub.com\u002Flza6\u002FArmor-piercing-system-prompts\u002Fblob\u002Fmain\u002F07-后端与架构\u002Fobject-detection-metrics\u002FSKILL.md",[],[],{"skillNo":95,"name":96,"nameZh":6,"description":97,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":98,"categories":99,"keywords":100,"publishedAt":19},"01M7FFFP0GCK1RVXBCPQ8APBMT","nx-workspace-patterns","Configure and optimize Nx monorepo workspaces. Use when setting up Nx, configuring project boundaries, optimizing build caching, or implementing affected commands.","https:\u002F\u002Fgithub.com\u002Flza6\u002FArmor-piercing-system-prompts\u002Fblob\u002Fmain\u002F07-后端与架构\u002Fnx-workspace-patterns\u002FSKILL.md",[],[]]