Files
3DPrintMeetup/Articles/ai-cad-skill-pack/.agents/skills/svg-blueprint-drafter/SKILL.md

151 lines
18 KiB
Markdown
Raw Normal View History

---
name: svg-blueprint-drafter
description: Orthographic 1:1 millimeter (1 px = 1 mm) 2D engineering blueprint creation and editing skill using FigCraft (figcraft-cli), CadCraft (cadcraft-cli), and SVG for any CAD project (<ProjectName>_Blueprints.figcraft, <ProjectName>_Side_View.svg, <ProjectName>_Front_View.svg, <ProjectName>_Top_View.svg, CAD/DXF/*.dxf).
---
# Orthographic 1:1 mm FigCraft, CadCraft DXF & SVG Engineering Blueprint Skill (`svg-blueprint-drafter`)
Use this skill as the **mandatory first design stage** when creating or modifying 1:1 millimeter (`1 px = 1 mm`) third-angle orthographic 2D engineering drawings and blueprint boards (`<ProjectName>_Blueprints.figcraft`, `<ProjectName>_Side_View.svg`, `<ProjectName>_Front_View.svg`, `<ProjectName>_Top_View.svg`, and `CAD/DXF/<ProjectName>_*_View.dxf`) for **any CAD project**.
> **CRITICAL RULE: Blueprint-First Iteration Gate**: Always draft ONLY the 2D orthographic blueprints first and **stop for user review and iteration** before creating any 3D CAD files (`.solidcraft`, `.FCStd`, `.step`, `.stl`, `.3mf`).
---
## 0. Step 0: CAD Toolchain & Target Use-Case Intake (Check `.cad-tools.json` or Ask User)
Before starting a new blueprint or running external CAD tools, check if `.cad-tools.json` exists in the project or workspace root. If it does not exist (and the user has not already specified their tools/target in the prompt), **ask the user** (via `ask_question` or direct prompt):
1. **Which 2D/3D CAD tools are available on your system, and what are their paths/commands?**
- **SolidCraft CLI (`solidcraft-cli`)**: Path to executable (configured in `.cad-tools.json`)?
- **CadCraft 2D CLI (`cadcraft-cli`)**: Path to executable (for `.dxf`, `.svg`, `.png` CAD drafting)?
- **FigCraft CLI (`figcraft-cli`)**: Path to executable (for `.figcraft` boards, `.svg`/`.pdf`/`.png` blueprint sheets & conversions)?
- **FreeCAD Headless (`FreeCADCmd`)**: Flatpak (`flatpak run --command=FreeCADCmd org.freecad.FreeCAD`), native `freecadcmd`, AppImage path, or `null`?
2. **Will this model be 3D printed, or is it for another target (e.g., Game Design / 3D Asset, Mixed-Media Relief Sculpture, CNC / Sheet Metal, or Unconstrained CAD)?**
- **If 3D Printed (`"is_3d_printed": true`)**: Ask for the target 3D printer's maximum build volume $(X \text{ x } Y \text{ x } Z\text{ mm})$ and design modular part splits and coplanar build-plate datum faces to fit the bed.
- **If NOT 3D Printed (`"is_3d_printed": false`)**: Do **not** impose 3D printer bed size limits or split parts for bed fit (`"printer_max_bed_mm": null`, `"safe_part_limit_mm": null`).
3. Save the answers to `.cad-tools.json` in the project root so all skills and subagents use the configured paths and target rules without searching the filesystem.
---
## 1. Translating User Descriptions into Standard Mechanical Engineering & CAD Terminology
Users often describe mechanical solutions in intuitive, everyday language. As a CAD & Mechanical Engineering specialist, you must immediately recognize these informal descriptions, map them to formal **ASME Y14.5 / ISO GD&T and DFM (Design for Manufacturability)** concepts, and implement them with engineering precision:
| User's Everyday Description | Formal Mechanical Engineering & CAD Terminology | How to Engineer It in 2D Blueprints & 3D CAD |
| :--- | :--- | :--- |
| *"Reverse L shape / notch at the top back to clear a cover that overhangs the front by 5 mm"* | **Stepped Edge Relief (`Rabbet` / `Rebate Cut`) above an Undercut Datum Contact Toe** | Step the upper-rear profile forward by $\text{Overhang} + 1.0\text{ mm}$ clearance (e.g., $6.0\text{ mm}$) down to $\text{Depth} + 1.0\text{ mm}$ (e.g., $5.0\text{ mm}$ below top datum), while extending the lower vertical leg back to $Y = 0.2\text{ mm}$ so it bears against the primary machine datum wall below the cover lip. |
| *"Make the round hole part flush with the arm so it's flat on the bed to print"* | **Coplanar Build-Plate Datum Face / Zero-Stickout Flush Boss ($Z_{\text{print}} = 0$)** | Set the axial width of cylindrical bosses/rings equal to the structural web thickness and align their outer faces on a single coplanar datum plane ($\Delta X = 0\text{ mm}$). Eliminates out-of-plane boss stickout and print supports. |
| *"Wrap the part around the front corner so it can't rotate on the round peg"* | **Orthogonal Anti-Rotation Return Flange & Moment-Resisting Reaction Pad** | A single cylindrical bore on a round boss is a 1-DOF revolute joint. Extending a $90^\circ$ return flange around the chassis corner onto an orthogonal datum face constrains rotation ($\theta = 0$) and resolves cantilevered bending moment ($M = F \cdot d$) into a tension-at-pin / compression-at-pad force couple. |
| *"Have the top bracket hook straight down over the front leg to hold the shelf"* | **Interlocking Cleat & Clevis Gravity Joint (Upward Hook Tang + Shrouded Captive End-Cheeks + Lower Bearing Shoulder)** | The lower column terminates in an upward **Male Cleat Tang** with a rear **Receiver Channel** and a lower **Horizontal Bearing Shoulder (Step Ledge)**. The upper cantilever rail drops straight down via a mating **Female Clevis Saddle** flanked by **Axial Retention End-Cheeks** that lock the lower brace against sliding off its mounting boss. |
| *"Add a bridge piece to raise the platform while reusing the already-printed lower sides"* | **Intermediate Vertical Front-Pillar Riser Bridge (Bottom Female Clevis Saddle to Upper Male Cleat Tang)** | A vertical column that hooks onto the existing lower part's top J-Hook cleat via an identical bottom **Female Clevis Saddle** + **Outer Lateral Capture Cheek**, rises along the structural pillar outside keep-out zones, and replicates the **Male J-Hook Cleat** at the elevated datum height. |
| *"Have a lip that the middle piece rests on with dovetails on top instead of separate bowties"* | **Shouldered Half-Lap Dovetail Ledger Joint (Integral Drop-In Dovetail Tenons in Blind/Stopped Mortises)** | The mating edge is stepped horizontally into a **Lower Half-Lap Bearing Ledger** (supporting vertical shear in direct compression) and an upper wall housing **Blind (Stopped) Female Dovetail Mortises**. The spanning truss features **Integral Male Dovetail Tenons** that drop vertically into the blind mortises, locking tension and racking with zero loose butterfly/dutchman keys. |
| *"Hold the power supply or board in place with overhangs or clips"* | **Cantilever Snap-Fit Retention Clips & Overhang Ledges with Lead-In Chamfers** | Vertical cradle walls with inward-projecting cantilever hook ledges ($1.5\text{ to }2.5\text{ mm}$ catch overhang) and $30^\circ\text{--}45^\circ$ top lead-in insertion chamfers that deflect elastically during insertion and snap over the top face of the PSU/PCB. |
| *"Funnel air from a 120mm fan into a narrower heatsink and across the back"* | **Converging Static-Pressure Plenum Shroud & Split-Bypass Backplate Cooling Channel** | A sealed converging transition duct channeling axial fan discharge into longitudinal heatsink fin tunnels without bypass leakage, paired with a rear plenum channel sweeping boundary-layer air across the backplate. |
| *"Open up the hole by 0.5 mm radius because it's too tight"* | **FDM Bore Shrinkage Allowance & Free-Running Slip-Fit Clearance ($\Delta R = +0.50\text{ to }+0.80\text{ mm}$) with Counterbore Relief** | Increase the nominal bore radius by $+0.50\text{ to }+0.80\text{ mm}$ ($+1.0\text{ to }+1.6\text{ mm}$ diametral clearance) to compensate for FDM inner-perimeter chordal error and seam bulge, paired with a coaxial **Counterbore** clearing the mounting base flange. |
| *"Triangle side arm with cutouts and an X-frame in the middle"* | **Triangulated Cantilever Gusset with Truss Lightening Pockets & X-Braced Space-Frame Spreader Beam** | Use triangulated diagonal compression struts with internal **Web Lightening Pockets** (triangular truss windows with generous corner radii) and an open **X-Braced Diagonal Cross-Member** with **Counterbored Elastomeric Foot Spotfaces**. |
---
## 2. Two-Folder Blueprint Organization (`Drafts/` vs. `Working Drafts/`), `History/Steps.md`, & Orthographic Naming
To keep blueprint review and project traceability clean inside `<ProjectDir>/`:
1. **Multi-Option Exploration (`<ProjectDir>/Drafts/`)**:
- Whenever there is more than one design option under consideration, generate all candidate option blueprints inside `<ProjectDir>/Drafts/` (e.g., `<ProjectDir>/Drafts/<ProjectName>_Option1_<Tag>_Side_View.svg`, `<ProjectName>_Option2_<Tag>_Side_View.svg`, etc.).
2. **Active Selected & Iterated Design (`<ProjectDir>/Working Drafts/` & `<ProjectDir>/`)**:
- Once the user selects an option (or when iterating on a single chosen design), place the active orthographic blueprints inside `<ProjectDir>/Working Drafts/` and `<ProjectDir>/` (`<ProjectName>_Side_View.svg`, `<ProjectName>_Front_View.svg`, `<ProjectName>_Top_View.svg`) and iterate on them there until approved for 3D CAD.
3. **Project Step & Iteration History (`<ProjectDir>/History/Steps.md` & `<ProjectDir>/Steps.md`)**:
- On every user ask and design step, append a new entry to `<ProjectDir>/History/Steps.md` (and `<ProjectDir>/Steps.md`) summarizing **only** the project-specific ask and design/file updates (omitting meta-updates to workspace agent/skill files) in the exact format:
```markdown
Step X
User Ask:
<Summary of user request>
Updates:
<Summary of design, dimension, direction, and file updates>
```
| Orthographic View | Active Working Blueprint (`Working Drafts/` & Root) | Multi-Option Exploration (`Drafts/`) | DXF Filename (`cadcraft_cli`) | Projected World Axes |
| :--- | :--- | :--- | :--- | :--- |
| **Side View (Right/Left Profile)** | `<ProjectName>_Side_View.svg` | `Drafts/<ProjectName>_Option<N>_<Tag>_Side_View.svg` | `CAD/DXF/<ProjectName>_Side_View.dxf` | **World $(X, Z)$ or $(Y, Z)$** |
| **Front View (Front/Section Elevation)** | `<ProjectName>_Front_View.svg` | `Drafts/<ProjectName>_Option<N>_<Tag>_Front_View.svg` | `CAD/DXF/<ProjectName>_Front_View.dxf` | **World $(Y, Z)$ or $(X, Z)$** |
| **Top View (Plan View)** | `<ProjectName>_Top_View.svg` | `Drafts/<ProjectName>_Option<N>_<Tag>_Top_View.svg` | `CAD/DXF/<ProjectName>_Top_View.dxf` | **World $(X, Y)$** |
---
## 3. Core Orthographic Blueprint Rules (`1 px = 1 mm`)
1. **Strict 1:1 Millimeter Scale**:
- Every coordinate, width, height, radius, and path segment in the SVG must be drawn at **`1 SVG user unit (px) = 1.0 mm`**.
- Include a background millimeter grid (`<pattern id="mmGrid" width="50" height="50">` with $10\text{ mm}$ minor lines and $50\text{ mm}$ major lines) so any measurement can be visually verified against the grid.
2. **Unified 3D World Coordinate Datums $(X, Y, Z)$ Across All 3 Views**:
- Define a clear, physical 3D origin $(X=0, Y=0, Z=0)$ anchored to the primary mating hardware features (e.g., machine centerline $X = 0$, front or mounting datum face $Y = 0$, top crown or reference deck $Z = 0$).
- Every feature coordinate must satisfy exact projection identity across views:
- $X_{\text{Front}} \equiv X_{\text{Top}}$
- $Y_{\text{Side}} \equiv Y_{\text{Top}}$
- $Z_{\text{Side}} \equiv Z_{\text{Front}}$
3. **Design for Manufacturability (DFM) & Assembly Constraints**:
- **When `"is_3d_printed": true` (Additive Manufacturing Mode)**:
- **Single-Piece Print Bed Envelope**: Every modular component's 3D bounding box $(W, D, H)$ must fit within the user's configured `safe_part_limit_mm` in `.cad-tools.json`.
- **Coplanar Build-Plate Datum Face**: Design each printed part with at least one completely flat, unencumbered outer face (`0.0 mm` boss stickout) so it lies directly on the print bed without supports.
- **When `"is_3d_printed": false` (Game Design / Sculpture / CNC / General CAD Mode)**:
- **No Print-Bed Splitting Required**: Do not split components to fit a 3D printer build volume unless modular assembly is explicitly requested by the user.
- **Clearance & Keep-Out Envelopes (All Modes)**: Explicitly draw dashed outlines for moving lids, doors, screens, cables, or mating hardware and verify positive clearance in all views.
---
## 4. Standard SVG Layer & Visual Styling Architecture
Structure every `<ProjectName>_*_View.svg` into clean, semantic `<g>` groups from back to front:
1. `<defs>`: CSS stylesheet, arrow markers (`#arrow-start`, `#arrow-end`, `#arrow-force`), and `#mmGrid` pattern.
2. **Background & Header Block**: Dark engineering slate canvas (`#0f172a`), millimeter grid rect, title, scale (`1 px = 1 mm`), and datum summary.
3. **Host Machine / Reference Environment Group (`id="host-reference-*"`)**: Reference hardware body, doors, screens, mounting bosses, and overhanging covers/bezels.
4. **Payload / Supported Equipment Group (`id="payload-*"`)**: Supported device envelope, mounting feet/fasteners, and gravity/load vectors (`class="force-line"`).
5. **Designed CAD Assembly Group (`id="<project>-parts-*"`)**: Distinct color-coded classes for each structural part (`Part A`, `Part B`, `Part C`, `Part D`, etc.), plus dashed joint interface lines (`class="joint-line"`).
6. **Engineering Dimensions & Callouts (`id="dimensions-*"`)**: Extension lines (`class="dim-ext"`), double-arrow dimension lines (`class="dim-line"`), and bold monospace millimeter labels (`class="dim-text"`).
7. **Footer Legend & Part Summary**: Color swatches and exact bounding-box dimensions ($W \text{ x } D \text{ x } H\text{ mm}$) for every part.
---
## 5. Automated Blueprint & Vector Authoring with `figcraft-cli` and `cadcraft-cli`
When **FigCraft (`figcraft_cli`)** or **CadCraft (`cadcraft_cli`)** is configured in `.cad-tools.json`, you can construct editable, parametric 2D vector blueprints, multi-view presentation boards, and CAD `.dxf` drawings programmatically:
### A. FigCraft (`figcraft-cli`) Vector Blueprints, 2D Booleans & Multi-View Blueprint Boards
Use `figcraft_cli` to build an interactive `<ProjectName>_Blueprints.figcraft` master board containing all three orthographic views (`Side_View`, `Front_View`, `Top_View`), dimension callouts, BOM/parameter tables, and embedded 3D renders:
1. **CLI Commands**:
```bash
# Execute a JSON command script and save native .figcraft file
<figcraft_cli_path> run <blueprint_script.json> --out <ProjectName>_Blueprints.figcraft
# Export individual top-level frames (Side_View, Front_View, Top_View) to SVG, PNG, or multi-page PDF
<figcraft_cli_path> export <ProjectName>_Blueprints.figcraft -o . --format svg
<figcraft_cli_path> export <ProjectName>_Blueprints.figcraft -o . --format png --scale 2
<figcraft_cli_path> render <ProjectName>_Blueprints.figcraft -o <ProjectName>_Blueprint_Sheet.png --scale 2
```
2. **Core `figcraft-cli run` Commands for Blueprint Drafting**:
- **Orthographic View Frames & Grids (`frame.create`, `grid.add`, `node.set`)**:
- Create top-level frames named `<ProjectName>_Side_View`, `<ProjectName>_Front_View`, and `<ProjectName>_Top_View` at `1 px = 1 mm` scale with dark blueprint fill (`#0f172a`).
- Attach $10\text{ mm}$ minor and $50\text{ mm}$ major grids via `grid.add` (`{"kind": "grid", "size": 10, "color": "#1e293b"}`).
- **Vector Primitives & Point Polygons (`shape.*`, `vector.create`, `vector.offset`)**:
- `shape.rectangle`: `{x, y, width, height, parent, props: {name, fill, stroke, strokeWeight, cornerRadius}}` (Supports per-corner radii `[tl, tr, br, bl]` for fillets and rabbets!).
- `shape.ellipse`: `{x, y, width, height, parent, props: {name, fill, stroke, strokeWeight, dashes}}` (For bores, counterbores, and spotfaces).
- `vector.create`: `{points: [[x1, y1], [x2, y2], ...], closed: true, parent, props: {name, fill, stroke, strokeWeight}}` (Pass exact 2D millimeter coordinates `[[u, v], ...]` directly).
- `vector.offset`: `{ids, offset}` (Generate uniform wall thicknesses, perimeter shells, or clearance envelopes).
- **Native 2D Boolean Operations (`bool.union`, `bool.subtract`, `bool.intersect`, `bool.exclude`, `bool.flatten`)**:
- Construct complex 2D part silhouettes by combining outer profiles with cut shapes (bores, counterbores, rabbet reliefs, blind dovetail mortises, truss lightening pockets) using `bool.subtract` or `bool.union`.
- **Dimensions, Callout Arrows & Engineering Tables (`shape.line`, `shape.arrow`, `board.connector`, `text.create`, `board.table`)**:
- Use `shape.arrow` or `board.connector` (`style: "straight" | "elbow"`, `startCap: "triangleArrow"`, `endCap: "triangleArrow"`, `label: "245.0 mm"`) for dimension lines and leader callouts.
- Use `board.table` (`{rows, columns, cells: [["Part", "Dimensions (mm)", "Qty", "Notes"], ...], x, y}`) to auto-build clean Title Blocks, Revision Schedules, and Bill of Materials (BOM) tables.
- Use `image.place` (`{path: "CAD/SolidCraft/<ProjectName>_Studio_Render.png", x, y, width, height, mode: "fit"}`) to embed reference ruler photos or SolidCraft Vulkan GPU renders directly onto the blueprint sheet.
- **Batching & Exporting Inside a Script (`file.save`, `file.export`, `file.exportFramesPdf`)**:
- Save the native editable document with `{"command": "file.save", "params": {"path": "<ProjectName>_Blueprints.figcraft", "overwrite": true}}`.
- Export each view frame to `<ProjectName>_Side_View.svg`, `<ProjectName>_Front_View.svg`, `<ProjectName>_Top_View.svg` via `file.export` (`{"ids": [frame_id], "format": "svg", "path": "<ProjectName>_Side_View.svg"}`) and export a print-ready multi-page engineering PDF via `file.exportFramesPdf` (`{"path": "<ProjectName>_Blueprints.pdf"}`).
### B. CadCraft 2D (`cadcraft-cli`) Precision 1:1 mm DXF/DWG CAD Drafting
When `cadcraft_cli` is configured in `.cad-tools.json`, generate native 1:1 mm CAD `.dxf`, `.dwg`, `.svg`, `.png`, and `.pdf` sheets in `CAD/DXF/`:
```bash
<cadcraft_cli_path> run --metric <dxf_script.json>
<cadcraft_cli_path> convert CAD/DXF/<ProjectName>_Full_Assembly.dxf CAD/DXF/<ProjectName>_Full_Assembly.pdf
```
Using `layer.new`, `line`, `polyline`, `circle`, `arc`, `dim.linear`, `dim.radius`, `dim.diameter`, `text`, and `file.export`.