forgecad 0.6.3 → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -11
- package/dist/assets/{AdminPage-CeqCUUgu.js → AdminPage-DAu1C1ST.js} +250 -151
- package/dist/assets/{BlogPage-P_AJP0v9.js → BlogPage-CJEXL_zJ.js} +94 -70
- package/dist/assets/{DocsPage-CKRV2iq2.js → DocsPage-Gc_BCdqC.js} +269 -143
- package/dist/assets/EditorApp-D9bJvtf7.js +11338 -0
- package/dist/assets/{EditorApp-CnC2k4cW.css → EditorApp-DG1-oUSV.css} +459 -87
- package/dist/assets/{EmbedViewer-DBlzmQ5i.js → EmbedViewer-CEO8XbV8.js} +2 -4
- package/dist/assets/LandingPage-CdCuEOdC.js +451 -0
- package/dist/assets/PricingPage-BSrxu6d7.js +232 -0
- package/dist/assets/{SettingsPage-BqCh9JcC.js → SettingsPage-FUCSIRq6.js} +129 -5
- package/dist/assets/{evalWorker-Ql-aKwLA.js → evalWorker-KoR0SNKq.js} +6770 -2914
- package/dist/assets/{index-2hfs_ub0.css → index-CyVd1D4D.css} +227 -53
- package/dist/assets/{Viewport-CoB46f5R.js → index-wTEK39at.js} +31385 -6439
- package/dist/assets/{javascript-DCxGoE5Y.js → javascript-DAl8Gmyo.js} +1 -1
- package/dist/assets/{manifold-CqNMHHKO.js → manifold-B1sGWdYk.js} +4 -3
- package/dist/assets/{manifold-Cce9wRFz.js → manifold-D7o0N50J.js} +1 -1
- package/dist/assets/{manifold-D6BeHIOo.js → manifold-G5sBaXzi.js} +1 -1
- package/dist/assets/{reportWorker-sFEFonXf.js → reportWorker-DYcRHhv9.js} +6798 -3341
- package/dist/assets/{vendor-react-Dt7-aaJH.js → vendor-react-CG3i_wp0.js} +65 -8
- package/dist/docs-raw/generated/assembly.md +691 -112
- package/dist/docs-raw/generated/concepts.md +1225 -1400
- package/dist/docs-raw/generated/core.md +464 -1412
- package/dist/docs-raw/generated/curves.md +593 -117
- package/dist/docs-raw/generated/lib.md +38 -748
- package/dist/docs-raw/generated/output.md +139 -245
- package/dist/docs-raw/generated/sheet-metal.md +473 -21
- package/dist/docs-raw/generated/sketch.md +553 -349
- package/dist/docs-raw/generated/viewport.md +345 -303
- package/dist/docs-raw/generated/wood.md +104 -0
- package/dist/index.html +2 -2
- package/dist/sitemap.xml +6 -6
- package/dist-cli/chunk-PZ5AY32C.js +10 -0
- package/dist-cli/chunk-PZ5AY32C.js.map +1 -0
- package/dist-cli/forgecad.js +9435 -5407
- package/dist-cli/forgecad.js.map +1 -0
- package/dist-cli/solver-FV7TJZGI.js +365 -0
- package/dist-cli/solver-FV7TJZGI.js.map +1 -0
- package/dist-skill/CONTEXT.md +3186 -7145
- package/dist-skill/SKILL-dev.md +21 -63
- package/dist-skill/SKILL.md +12 -56
- package/dist-skill/docs/API/core/concepts.md +16 -98
- package/dist-skill/docs/CLI/export.md +91 -0
- package/dist-skill/docs/CLI/projects.md +107 -0
- package/dist-skill/docs/CLI/studio_publishing.md +52 -0
- package/dist-skill/docs/CLI/validation.md +66 -0
- package/dist-skill/docs/generated/assembly.md +691 -112
- package/dist-skill/docs/generated/core.md +464 -1412
- package/dist-skill/docs/generated/curves.md +593 -117
- package/dist-skill/docs/generated/lib.md +38 -748
- package/dist-skill/docs/generated/output.md +139 -245
- package/dist-skill/docs/generated/sheet-metal.md +473 -21
- package/dist-skill/docs/generated/sketch.md +553 -349
- package/dist-skill/docs/generated/viewport.md +345 -303
- package/dist-skill/docs/generated/wood.md +104 -0
- package/dist-skill/docs/guides/coordinate-system.md +11 -17
- package/dist-skill/docs/guides/geometry-conventions.md +13 -70
- package/dist-skill/docs/guides/modeling-recipes.md +22 -195
- package/dist-skill/docs/guides/positioning.md +88 -147
- package/dist-skill/docs-dev/API/core/concepts.md +51 -0
- package/dist-skill/docs-dev/API/core/sdf-advanced.md +92 -0
- package/dist-skill/docs-dev/API/core/sdf-primitives.md +58 -0
- package/dist-skill/docs-dev/API/core/sdf-workflow.md +42 -0
- package/dist-skill/docs-dev/CLI/export.md +91 -0
- package/dist-skill/docs-dev/CLI/projects.md +107 -0
- package/dist-skill/docs-dev/CLI/studio_publishing.md +52 -0
- package/dist-skill/docs-dev/CLI/validation.md +66 -0
- package/dist-skill/{docs → docs-dev}/blueprint-first.md +5 -0
- package/dist-skill/{docs → docs-dev}/coding-best-practices.md +6 -8
- package/dist-skill/{docs → docs-dev}/coding.md +1 -3
- package/dist-skill/docs-dev/generated/assembly.md +771 -0
- package/dist-skill/docs-dev/generated/core.md +775 -0
- package/dist-skill/docs-dev/generated/curves.md +688 -0
- package/dist-skill/docs-dev/generated/lib.md +50 -0
- package/dist-skill/docs-dev/generated/output.md +234 -0
- package/dist-skill/docs-dev/generated/sheet-metal.md +506 -0
- package/dist-skill/docs-dev/generated/sketch.md +801 -0
- package/dist-skill/docs-dev/generated/viewport.md +486 -0
- package/dist-skill/docs-dev/generated/wood.md +104 -0
- package/dist-skill/docs-dev/guides/coordinate-system.md +46 -0
- package/dist-skill/docs-dev/guides/geometry-conventions.md +52 -0
- package/dist-skill/docs-dev/guides/modeling-recipes.md +77 -0
- package/dist-skill/docs-dev/guides/positioning.md +151 -0
- package/dist-skill/{docs → docs-dev}/guides/skill-maintenance.md +21 -10
- package/dist-skill/{docs → docs-dev}/internals/compiler.md +5 -6
- package/dist-skill/{docs → docs-dev}/internals/constraint-solver-quality.md +0 -1
- package/dist-skill/{docs → docs-dev}/internals/constraint-solver.md +0 -1
- package/dist-skill/{docs → docs-dev}/internals/sketch-2d-pipeline.md +2 -3
- package/examples/api/attachTo-basics.forge.js +5 -5
- package/examples/api/boolean-operations.forge.js +3 -3
- package/examples/api/bounding-box-visualizer.forge.js +2 -2
- package/examples/api/clone-duplicate.forge.js +1 -1
- package/examples/api/colors-union-vs-array.forge.js +6 -6
- package/examples/api/connector-assembly.forge.js +4 -4
- package/examples/api/connector-basics.forge.js +2 -2
- package/examples/api/extrude-options.forge.js +4 -10
- package/examples/api/feature-created-faces.forge.js +6 -10
- package/examples/api/fillet-showcase.forge.js +1 -1
- package/examples/api/folded-service-panel-cover.forge.js +2 -2
- package/examples/api/group-test.forge.js +1 -1
- package/examples/api/group-vs-union.forge.js +1 -1
- package/examples/api/highlight-debug.forge.js +4 -0
- package/examples/api/js-module-pillars.js +1 -1
- package/examples/api/js-module-scene.js +2 -2
- package/examples/api/mesh-import-slats.forge.js +1 -1
- package/examples/api/pointAlong-orientation.forge.js +1 -1
- package/examples/api/profile-2020-b-slot6.forge.js +0 -1
- package/examples/api/route-perimeter-flange.forge.js +1 -1
- package/examples/api/sdf-rover-demo.forge.js +10 -10
- package/examples/api/sketch-on-face-demo.forge.js +2 -2
- package/examples/api/sketch-regions.forge.js +4 -4
- package/examples/api/transition-curves.forge.js +1 -1
- package/examples/api/variable-sweep-pure-sdf-test.forge.js +162 -0
- package/examples/api/variable-sweep-test.forge.js +2 -2
- package/examples/api/wood-joinery.forge.js +60 -0
- package/examples/compiler-corpus/enclosure-shell-cuts.forge.js +3 -3
- package/examples/compiler-corpus/fastener-plate-variants.forge.js +2 -2
- package/examples/experiments/drone-arm.forge.js +53 -0
- package/examples/furniture/adjustable-table.forge.js +2 -2
- package/examples/furniture/bathroom.forge.js +11 -11
- package/examples/furniture/chair.forge.js +1 -1
- package/examples/generative/crystal-growth.forge.js +2 -2
- package/examples/generative/frost-spires.forge.js +3 -3
- package/examples/generative/golden-spiral-tower.forge.js +3 -3
- package/examples/mechanical/3d-printer.forge.js +28 -28
- package/examples/mechanical/5-finger-robot-hand.forge.js +15 -15
- package/examples/mechanical/airplane-propeller.forge.js +2 -2
- package/examples/mechanical/fillet-enclosure.forge.js +1 -1
- package/examples/mechanical/headphone-hanger-v2.forge.js +2 -2
- package/examples/mechanical/robot_hand.forge.js +15 -15
- package/examples/mechanical/robot_hand_2.forge.js +9 -9
- package/examples/products/bottle.forge.js +1 -1
- package/examples/products/chess-set.forge.js +19 -19
- package/examples/products/classical-piano.forge.js +11 -11
- package/examples/products/clock.forge.js +12 -12
- package/examples/products/iphone.forge.js +8 -8
- package/examples/products/laptop.forge.js +15 -15
- package/examples/products/liquid-soap-dispenser.forge.js +18 -18
- package/examples/products/origami-fish.forge.js +8 -6
- package/examples/products/spiderman-cake.forge.js +4 -4
- package/examples/toolbox/bolted-joint.forge.js +2 -2
- package/package.json +7 -4
- package/dist/assets/EditorApp-B-vQvgam.js +0 -9888
- package/dist/assets/LandingPage-C5n9hDXI.js +0 -322
- package/dist/assets/PublishedModelPage-Dt7PCVBj.js +0 -146
- package/dist/assets/__vite-browser-external-CURh0WXD.js +0 -8
- package/dist/assets/deserializeRunResult-BLAFoiE0.js +0 -19365
- package/dist/assets/index-1CYp3zUp.js +0 -1455
- package/dist/docs-raw/CLI.md +0 -865
- package/dist-skill/docs/API/API.md +0 -1666
- package/dist-skill/docs/API/README.md +0 -37
- package/dist-skill/docs/API/assembly/assembly.md +0 -617
- package/dist-skill/docs/API/core/edge-queries.md +0 -130
- package/dist-skill/docs/API/core/parameters.md +0 -122
- package/dist-skill/docs/API/core/reserved-terms.md +0 -137
- package/dist-skill/docs/API/core/sdf.md +0 -326
- package/dist-skill/docs/API/core/skill-cli.md +0 -194
- package/dist-skill/docs/API/core/skill-guide.md +0 -205
- package/dist-skill/docs/API/core/specs.md +0 -186
- package/dist-skill/docs/API/core/topology.md +0 -372
- package/dist-skill/docs/API/entities.md +0 -268
- package/dist-skill/docs/API/output/bom.md +0 -58
- package/dist-skill/docs/API/output/brep-export.md +0 -87
- package/dist-skill/docs/API/output/dimensions.md +0 -67
- package/dist-skill/docs/API/output/export.md +0 -110
- package/dist-skill/docs/API/output/gcode.md +0 -195
- package/dist-skill/docs/API/runtime/viewport.md +0 -420
- package/dist-skill/docs/API/sheet-metal/sheet-metal.md +0 -185
- package/dist-skill/docs/API/sketch/anchor.md +0 -37
- package/dist-skill/docs/API/sketch/booleans.md +0 -91
- package/dist-skill/docs/API/sketch/core.md +0 -73
- package/dist-skill/docs/API/sketch/extrude.md +0 -62
- package/dist-skill/docs/API/sketch/on-face.md +0 -104
- package/dist-skill/docs/API/sketch/operations.md +0 -78
- package/dist-skill/docs/API/sketch/path.md +0 -75
- package/dist-skill/docs/API/sketch/primitives.md +0 -146
- package/dist-skill/docs/API/sketch/regions.md +0 -80
- package/dist-skill/docs/API/sketch/text.md +0 -108
- package/dist-skill/docs/API/sketch/transforms.md +0 -65
- package/dist-skill/docs/API/toolbox/fasteners.md +0 -129
- package/dist-skill/docs/CLI.md +0 -865
- package/dist-skill/docs/INDEX.md +0 -94
- package/dist-skill/docs/RELEASING.md +0 -55
- package/dist-skill/docs/cli-monetization.md +0 -111
- package/dist-skill/docs/deployment.md +0 -281
- package/dist-skill/docs/generated/concepts.md +0 -2112
- package/dist-skill/docs/internals/shape-from-slices.md +0 -152
- package/dist-skill/docs/platform/admin.md +0 -45
- package/dist-skill/docs/platform/architecture.md +0 -79
- package/dist-skill/docs/platform/auth.md +0 -110
- package/dist-skill/docs/platform/email.md +0 -67
- package/dist-skill/docs/platform/projects.md +0 -111
- package/dist-skill/docs/platform/sharing.md +0 -90
- package/dist-skill/docs/runbook.md +0 -345
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
skill-group: sketch
|
|
3
|
-
skill-order: 11
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
# Sketch Regions
|
|
7
|
-
|
|
8
|
-
Decompose complex sketches into their individual filled areas. This is essential when a sketch operation produces multiple disconnected regions and you need to work with them independently.
|
|
9
|
-
|
|
10
|
-
## `sketch.regions()`
|
|
11
|
-
|
|
12
|
-
Decompose a sketch into its distinct filled regions, returned largest-first by area.
|
|
13
|
-
|
|
14
|
-
A single sketch can contain several disconnected filled areas (e.g., two separate rectangles, a ring shape, or the result of a boolean that leaves islands). This method enumerates all top-level connected regions as independent `Sketch` objects.
|
|
15
|
-
|
|
16
|
-
**Returns:** `Sketch[]` — Array of region sketches, sorted by area (largest first)
|
|
17
|
-
|
|
18
|
-
```javascript
|
|
19
|
-
// Two disconnected rectangles — get each one separately
|
|
20
|
-
const pair = union2d(rect(40, 40), rect(40, 40).translate(60, 0));
|
|
21
|
-
const [larger, smaller] = pair.regions();
|
|
22
|
-
larger.extrude(10);
|
|
23
|
-
smaller.extrude(5);
|
|
24
|
-
|
|
25
|
-
// Ring shape — one region containing the ring
|
|
26
|
-
const ring = circle2d(50).subtract(circle2d(30));
|
|
27
|
-
const [ringRegion] = ring.regions();
|
|
28
|
-
ringRegion.extrude(8);
|
|
29
|
-
```
|
|
30
|
-
|
|
31
|
-
## `sketch.region(seed)`
|
|
32
|
-
|
|
33
|
-
Select the single filled region that contains a given 2D point. This lets you pick any enclosed area by pointing at it instead of sorting through all regions.
|
|
34
|
-
|
|
35
|
-
**Parameters:**
|
|
36
|
-
- `seed` (`[number, number]`) — A 2D point `[x, y]` strictly inside the desired region
|
|
37
|
-
|
|
38
|
-
**Returns:** `Sketch` — The region containing the seed point
|
|
39
|
-
|
|
40
|
-
**Throws:** If the seed is outside all regions, on a boundary edge, or inside a hole.
|
|
41
|
-
|
|
42
|
-
```javascript
|
|
43
|
-
// Donut — select the ring area at radius 40
|
|
44
|
-
const donut = circle2d(50).subtract(circle2d(30));
|
|
45
|
-
const ring = donut.region([40, 0]);
|
|
46
|
-
ring.extrude(10);
|
|
47
|
-
|
|
48
|
-
// Complex boolean result — pick a specific island
|
|
49
|
-
const complex = union2d(rect(40, 40), rect(40, 40).translate(60, 0));
|
|
50
|
-
const rightBox = complex.region([80, 20]); // seed inside right box
|
|
51
|
-
```
|
|
52
|
-
|
|
53
|
-
> **Callout:** The seed point must be strictly inside the filled area — not on the boundary. If you're unsure where the regions are, use `.regions()` first to enumerate them. Each returned region has a `.bounds()` you can inspect.
|
|
54
|
-
|
|
55
|
-
## Constrained Sketch Regions
|
|
56
|
-
|
|
57
|
-
`ConstraintSketch` (from `constrainedSketch().solve()`) provides two additional methods for working with the line arrangement formed by its edges:
|
|
58
|
-
|
|
59
|
-
### `cs.detectArrangement()`
|
|
60
|
-
|
|
61
|
-
Enumerate all bounded regions formed by the non-construction line arrangement. Returns `Sketch[]` sorted largest-first.
|
|
62
|
-
|
|
63
|
-
```javascript
|
|
64
|
-
const sk = constrainedSketch();
|
|
65
|
-
// ... add geometry and constraints ...
|
|
66
|
-
const cs = sk.solve();
|
|
67
|
-
const regions = cs.detectArrangement();
|
|
68
|
-
regions[0].extrude(5); // extrude the largest region
|
|
69
|
-
```
|
|
70
|
-
|
|
71
|
-
### `cs.detectArrangementRegion(seed)`
|
|
72
|
-
|
|
73
|
-
Select a single arrangement region by seed point. Same semantics as `sketch.region(seed)` but operates on the constraint sketch's line arrangement (DCEL face detection).
|
|
74
|
-
|
|
75
|
-
```javascript
|
|
76
|
-
const region = cs.detectArrangementRegion([10, 10]);
|
|
77
|
-
region.extrude(3);
|
|
78
|
-
```
|
|
79
|
-
|
|
80
|
-
> **Callout:** `detectArrangement()` and `detectArrangementRegion()` use the raw line/arc geometry from the constraint solver, not the boolean profile. This means construction lines are excluded and the regions are formed by the geometric arrangement of edges — useful when you need to select specific enclosed areas from a complex constrained sketch.
|
|
@@ -1,108 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
skill-group: sketch
|
|
3
|
-
skill-order: 10
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
# 2D Text
|
|
7
|
-
|
|
8
|
-
Create filled text geometry from strings. Supports both the built-in **Forge Mono** geometric font and any **TTF/OTF font file** for professional typography. Text sketches can be extruded, engraved, or used anywhere a normal `Sketch` is accepted.
|
|
9
|
-
|
|
10
|
-
## `text2d(content, options?)`
|
|
11
|
-
|
|
12
|
-
Build a filled 2D `Sketch` from a text string.
|
|
13
|
-
|
|
14
|
-
**Parameters:**
|
|
15
|
-
- `content` (string) — The text to render
|
|
16
|
-
- `options` (TextOptions, optional):
|
|
17
|
-
- `size` (number) — Cap height in model units. Default: `10`. All proportions scale with this.
|
|
18
|
-
- `letterSpacing` (number) — Extra space between characters in model units. Negative tightens. Default: `0`
|
|
19
|
-
- `align` (`'left' | 'center' | 'right'`) — Horizontal alignment relative to x = 0. Default: `'left'`
|
|
20
|
-
- `baseline` (`'baseline' | 'center' | 'top'`) — Vertical alignment relative to y = 0. Default: `'baseline'`
|
|
21
|
-
- `font` (string | Font) — Path to a TTF/OTF font file, or a pre-loaded Font object from `loadFont()`. When omitted, uses the built-in Forge Mono font.
|
|
22
|
-
- `flattenTolerance` (number) — Bezier curve flattening tolerance in model units (font mode only). Smaller = smoother curves. Default: 0.5% of size.
|
|
23
|
-
|
|
24
|
-
**Returns:** `Sketch` — Filled 2D text geometry
|
|
25
|
-
|
|
26
|
-
```javascript
|
|
27
|
-
// Built-in geometric font (default)
|
|
28
|
-
text2d('FORGE CAD', { size: 8 }).extrude(1.2);
|
|
29
|
-
|
|
30
|
-
// Using a real font — professional typography with proper curves
|
|
31
|
-
text2d('Hello World', { size: 10, font: '/path/to/Arial.ttf' }).extrude(1);
|
|
32
|
-
|
|
33
|
-
// Pre-load font for reuse across multiple text calls
|
|
34
|
-
const font = loadFont('/path/to/Arial Bold.ttf');
|
|
35
|
-
text2d('Title', { size: 12, font }).extrude(1.5);
|
|
36
|
-
text2d('Subtitle', { size: 8, font, align: 'center' }).extrude(0.8);
|
|
37
|
-
|
|
38
|
-
// Centered label
|
|
39
|
-
text2d('V 2.0', { size: 6, align: 'center', baseline: 'center' });
|
|
40
|
-
|
|
41
|
-
// Engraved text on top face of a box
|
|
42
|
-
const label = text2d('REV A', { size: 5, align: 'center', baseline: 'center' });
|
|
43
|
-
const plate = box(60, 20, 5);
|
|
44
|
-
return plate.subtract(label.onFace(plate, 'top', { protrude: -0.5 }).extrude(1));
|
|
45
|
-
```
|
|
46
|
-
|
|
47
|
-
### Font Options
|
|
48
|
-
|
|
49
|
-
**Real fonts (TTF/OTF)** — Pass a file path or pre-loaded Font to the `font` option:
|
|
50
|
-
- Professional typography with proper bezier curves
|
|
51
|
-
- Full character set: uppercase, lowercase, accented characters, symbols
|
|
52
|
-
- Automatic kerning between character pairs
|
|
53
|
-
- Any TTF or OTF font file works
|
|
54
|
-
|
|
55
|
-
**Built-in: Forge Mono** (default when no `font` option) —
|
|
56
|
-
- **Style:** Geometric monoline sans-serif, squared-off and futuristic
|
|
57
|
-
- **Inspired by:** Eurostile, Chakra Petch
|
|
58
|
-
- **Characteristics:** Uniform stroke weight, flat open ends, no serifs
|
|
59
|
-
- **Character set:** Uppercase A–Z, digits 0–9, punctuation. Lowercase maps to uppercase
|
|
60
|
-
- No external font files needed — every character is constructed from geometric primitives
|
|
61
|
-
|
|
62
|
-
## `loadFont(source, cacheKey?)`
|
|
63
|
-
|
|
64
|
-
Pre-load and cache a font for reuse across multiple `text2d()` calls.
|
|
65
|
-
|
|
66
|
-
**Parameters:**
|
|
67
|
-
- `source` (string | ArrayBuffer) — File path to a TTF/OTF font, or raw font data as ArrayBuffer
|
|
68
|
-
- `cacheKey` (string, optional) — Cache key when passing ArrayBuffer
|
|
69
|
-
|
|
70
|
-
**Returns:** Font object (pass to `text2d`'s `font` option)
|
|
71
|
-
|
|
72
|
-
```javascript
|
|
73
|
-
const font = loadFont('/System/Library/Fonts/Supplemental/Arial.ttf');
|
|
74
|
-
text2d('Line 1', { size: 8, font }).extrude(1);
|
|
75
|
-
text2d('Line 2', { size: 8, font }).extrude(1);
|
|
76
|
-
```
|
|
77
|
-
|
|
78
|
-
## `textWidth(content, options?)`
|
|
79
|
-
|
|
80
|
-
Measure the rendered width of a string without creating geometry. Useful for layout calculations.
|
|
81
|
-
|
|
82
|
-
**Parameters:**
|
|
83
|
-
- `content` (string) — The text to measure
|
|
84
|
-
- `options` (object, optional):
|
|
85
|
-
- `size` (number) — Cap height in model units. Default: `10`
|
|
86
|
-
- `letterSpacing` (number) — Extra spacing. Default: `0`
|
|
87
|
-
|
|
88
|
-
**Returns:** `number` — Width of the rendered text in model units
|
|
89
|
-
|
|
90
|
-
```javascript
|
|
91
|
-
const label = 'SERIAL: 001';
|
|
92
|
-
const w = textWidth(label, { size: 6 });
|
|
93
|
-
|
|
94
|
-
// Create a plate that fits the text with padding
|
|
95
|
-
const plate = box(w + 10, 12, 2);
|
|
96
|
-
const text = text2d(label, { size: 6, align: 'center', baseline: 'center' })
|
|
97
|
-
.translate(w / 2 + 5, 6, 0);
|
|
98
|
-
```
|
|
99
|
-
|
|
100
|
-
## Alignment Quick Reference
|
|
101
|
-
|
|
102
|
-
| `align` | `baseline` | Origin position |
|
|
103
|
-
|---------|-----------|----------------|
|
|
104
|
-
| `'left'` | `'baseline'` | Bottom-left of first character (default) |
|
|
105
|
-
| `'center'` | `'center'` | Dead center of text block |
|
|
106
|
-
| `'right'` | `'top'` | Top-right corner |
|
|
107
|
-
|
|
108
|
-
The origin is at `(0, 0)` — alignment controls where the text sits relative to that point.
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
skill-group: sketch
|
|
3
|
-
skill-order: 4
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
# Sketch Transforms
|
|
7
|
-
|
|
8
|
-
2D transformations for sketches. All transforms are **chainable** and **immutable** (return new sketches). Colors are preserved through all transforms.
|
|
9
|
-
|
|
10
|
-
## Methods
|
|
11
|
-
|
|
12
|
-
### `.clone()` / `.duplicate()`
|
|
13
|
-
Create an explicit copy handle of a sketch (same profile/color) so variants are easy to branch.
|
|
14
|
-
|
|
15
|
-
```javascript
|
|
16
|
-
const profile = rect(40, 20);
|
|
17
|
-
const left = profile.clone().translate(-30, 0);
|
|
18
|
-
const right = profile.duplicate().translate(30, 0);
|
|
19
|
-
```
|
|
20
|
-
|
|
21
|
-
### `.translate(x, y?)`
|
|
22
|
-
Moves the sketch.
|
|
23
|
-
|
|
24
|
-
```javascript
|
|
25
|
-
const moved = rect(50, 30).translate(100, 50);
|
|
26
|
-
```
|
|
27
|
-
|
|
28
|
-
### `.rotate(degrees)`
|
|
29
|
-
Rotates around the sketch's bounding-box center.
|
|
30
|
-
|
|
31
|
-
```javascript
|
|
32
|
-
const rotated = rect(50, 30).rotate(45);
|
|
33
|
-
```
|
|
34
|
-
|
|
35
|
-
### `.rotateAround(degrees, pivot)`
|
|
36
|
-
Rotates around a specific point instead of the default center pivot.
|
|
37
|
-
|
|
38
|
-
**Parameters:**
|
|
39
|
-
- `degrees` (number) — Rotation angle
|
|
40
|
-
- `pivot` ([number, number]) — Point to rotate around
|
|
41
|
-
|
|
42
|
-
```javascript
|
|
43
|
-
const hook = rect(4, 20).rotateAround(-35, [2, 0]);
|
|
44
|
-
```
|
|
45
|
-
|
|
46
|
-
### `.scale(v)`
|
|
47
|
-
Scales the sketch from its bounding-box center.
|
|
48
|
-
|
|
49
|
-
**Parameters:**
|
|
50
|
-
- `v` (number | [number, number]) — Uniform scale or per-axis scale
|
|
51
|
-
|
|
52
|
-
```javascript
|
|
53
|
-
const bigger = circle2d(10).scale(2);
|
|
54
|
-
const stretched = rect(10, 10).scale([2, 0.5]);
|
|
55
|
-
```
|
|
56
|
-
|
|
57
|
-
### `.mirror(normal)`
|
|
58
|
-
Mirrors across a line defined by its normal vector, passing through the sketch's bounding-box center.
|
|
59
|
-
|
|
60
|
-
**Parameters:**
|
|
61
|
-
- `normal` ([number, number]) — Line normal (doesn't need to be unit length)
|
|
62
|
-
|
|
63
|
-
```javascript
|
|
64
|
-
const mirrored = sketch.mirror([1, 0]); // Mirror across Y axis
|
|
65
|
-
```
|
|
@@ -1,129 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
skill-group: toolbox
|
|
3
|
-
skill-order: 1
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
# Toolbox — Fastener Library
|
|
7
|
-
|
|
8
|
-
Pre-built ISO metric fastener geometry available via `lib.*` in any ForgeCAD script.
|
|
9
|
-
|
|
10
|
-
## Supported catalog
|
|
11
|
-
|
|
12
|
-
This is the initial, intentionally small catalog. Coverage outside these items is not guaranteed.
|
|
13
|
-
|
|
14
|
-
| Family | Sizes | Standard |
|
|
15
|
-
|--------|-------|----------|
|
|
16
|
-
| Hex bolt (`lib.bolt`) | M4 – M10 (parametric) | ISO 4762 lookalike |
|
|
17
|
-
| Hex nut (`lib.nut`) | M4 – M10 (parametric) | ISO 4032 lookalike |
|
|
18
|
-
| Flat washer (`lib.washer`) | M2, M2.5, M3, M4, M5, M6, M8, M10 | DIN 125-A |
|
|
19
|
-
| Fastener hole (`lib.fastenerHole`) | M2, M2.5, M3, M4, M5, M6, M8, M10 | ISO metric fits |
|
|
20
|
-
| Fastener set (`lib.fastenerSet`) | M2 – M10 | Combines all of the above |
|
|
21
|
-
|
|
22
|
-
Sizes outside the table will throw. Extend `METRIC_HOLE_TABLE` / `WASHER_TABLE` in `library.ts` when adding new sizes.
|
|
23
|
-
|
|
24
|
-
## `lib.washer(size, options?)`
|
|
25
|
-
|
|
26
|
-
Returns a flat ring washer (DIN 125-A by default) centered at the origin, thickness along Z.
|
|
27
|
-
|
|
28
|
-
```javascript
|
|
29
|
-
const w = lib.washer("M5");
|
|
30
|
-
// outer dia 10 mm, inner dia 5.3 mm, thickness 1 mm
|
|
31
|
-
```
|
|
32
|
-
|
|
33
|
-
**Parameters**
|
|
34
|
-
|
|
35
|
-
| Name | Type | Default | Description |
|
|
36
|
-
|------|------|---------|-------------|
|
|
37
|
-
| `size` | `MetricSize` | required | ISO metric thread size string, e.g. `"M6"` |
|
|
38
|
-
| `options.standard` | `'din-125-a'` | `'din-125-a'` | Washer standard (only DIN 125-A for now) |
|
|
39
|
-
| `options.segments` | `number` | `48` | Circle segment count |
|
|
40
|
-
|
|
41
|
-
**DIN 125-A dimensions**
|
|
42
|
-
|
|
43
|
-
| Size | Inner dia (mm) | Outer dia (mm) | Thickness (mm) |
|
|
44
|
-
|------|---------------|----------------|----------------|
|
|
45
|
-
| M2 | 2.2 | 5.0 | 0.3 |
|
|
46
|
-
| M2.5 | 2.7 | 6.0 | 0.5 |
|
|
47
|
-
| M3 | 3.2 | 7.0 | 0.5 |
|
|
48
|
-
| M4 | 4.3 | 9.0 | 0.8 |
|
|
49
|
-
| M5 | 5.3 | 10.0 | 1.0 |
|
|
50
|
-
| M6 | 6.4 | 12.0 | 1.6 |
|
|
51
|
-
| M8 | 8.4 | 17.0 | 1.6 |
|
|
52
|
-
| M10 | 10.5 | 21.0 | 2.0 |
|
|
53
|
-
|
|
54
|
-
## `lib.fastenerSet(size, boltLength, options?)`
|
|
55
|
-
|
|
56
|
-
Returns all geometry needed for one complete bolted joint: bolt, nut, washers, and hole cutters — un-positioned so you can place them freely.
|
|
57
|
-
|
|
58
|
-
```javascript
|
|
59
|
-
const hw = lib.fastenerSet("M5", 20);
|
|
60
|
-
|
|
61
|
-
// Cut holes in two plates
|
|
62
|
-
const topPlate = box(60, 40, 8, true)
|
|
63
|
-
.subtract(hw.clearanceHole.translate(15, 10, 0));
|
|
64
|
-
const botPlate = box(60, 40, 8, true).translate(0, 0, -16)
|
|
65
|
-
.subtract(hw.tappedHole.translate(15, 10, -8));
|
|
66
|
-
|
|
67
|
-
// Place hardware
|
|
68
|
-
return [
|
|
69
|
-
{ name: "Top Plate", shape: topPlate, color: "#9ab4cc" },
|
|
70
|
-
{ name: "Bot Plate", shape: botPlate, color: "#b0b8c8" },
|
|
71
|
-
{ name: "Bolt", shape: hw.bolt.translate(15, 10, 4), color: "#aaaaaa" },
|
|
72
|
-
{ name: "Nut", shape: hw.nut.translate(15, 10, -19), color: "#888888" },
|
|
73
|
-
];
|
|
74
|
-
```
|
|
75
|
-
|
|
76
|
-
**Parameters**
|
|
77
|
-
|
|
78
|
-
| Name | Type | Default | Description |
|
|
79
|
-
|------|------|---------|-------------|
|
|
80
|
-
| `size` | `MetricSize` | required | ISO metric thread size |
|
|
81
|
-
| `boltLength` | `number` | required | Shaft length in mm (head excluded) |
|
|
82
|
-
| `options.washerUnderHead` | `boolean` | `true` | Include a washer shape for under the head |
|
|
83
|
-
| `options.washerUnderNut` | `boolean` | `true` | Include a washer shape for under the nut |
|
|
84
|
-
| `options.fit` | `FastenerFit` | `'normal'` | Clearance hole fit: `close`, `normal`, `loose`, or `tap` |
|
|
85
|
-
| `options.segments` | `number` | `36` | Thread/circle segment count |
|
|
86
|
-
|
|
87
|
-
**Result fields**
|
|
88
|
-
|
|
89
|
-
| Field | Type | Description |
|
|
90
|
-
|-------|------|-------------|
|
|
91
|
-
| `bolt` | `Shape` | Head top at z=0, shaft along −Z by `boltLength` |
|
|
92
|
-
| `nut` | `Shape` | Hex nut centered at z=0 |
|
|
93
|
-
| `washerUnderHead` | `Shape \| null` | Flat washer centered at z=0 |
|
|
94
|
-
| `washerUnderNut` | `Shape \| null` | Flat washer centered at z=0 |
|
|
95
|
-
| `clearanceHole` | `Shape` | Cutter cylinder for through-plate clearance, centered at z=0 |
|
|
96
|
-
| `tappedHole` | `Shape` | Cutter cylinder for tap-drill hole, centered at z=0 |
|
|
97
|
-
| `dims` | `FastenerSetDimensions` | Reference dimensions for placement and BOM |
|
|
98
|
-
|
|
99
|
-
**`FastenerSetDimensions` fields**
|
|
100
|
-
|
|
101
|
-
| Field | Description |
|
|
102
|
-
|-------|-------------|
|
|
103
|
-
| `size` | Thread size string |
|
|
104
|
-
| `nominalDiameter` | Numeric thread diameter (mm) |
|
|
105
|
-
| `boltLength` | As specified |
|
|
106
|
-
| `clearanceDia` | Clearance hole diameter for chosen fit (mm) |
|
|
107
|
-
| `tapDia` | Tap-drill diameter (mm) |
|
|
108
|
-
| `nutAcrossFlats` | Hex nut width across flats (mm) |
|
|
109
|
-
| `nutHeight` | Nut height (mm) |
|
|
110
|
-
| `washerOuterDia` / `washerInnerDia` / `washerThickness` | DIN 125-A washer dimensions (mm) |
|
|
111
|
-
|
|
112
|
-
## `lib.fastenerHole(opts)`
|
|
113
|
-
|
|
114
|
-
Lower-level helper that returns only a hole cutter (cylinder ± counterbore/countersink). Supports M2–M10 with four fit classes and optional counterbore/countersink geometry. See the full API reference for details.
|
|
115
|
-
|
|
116
|
-
## Pairing table
|
|
117
|
-
|
|
118
|
-
Use this to pick the right cutter fit for your workflow:
|
|
119
|
-
|
|
120
|
-
| Fit | Hole diameter | Use when |
|
|
121
|
-
|-----|--------------|----------|
|
|
122
|
-
| `close` | ≈ nominal + 0.2 mm | Press-location or close-tolerance slotting |
|
|
123
|
-
| `normal` | ≈ nominal + 0.5 mm | Standard through-bolt clearance (default) |
|
|
124
|
-
| `loose` | ≈ nominal + 1–2 mm | Adjustment slots or misaligned patterns |
|
|
125
|
-
| `tap` | ISO tap drill | Tapped hole in the mating part |
|
|
126
|
-
|
|
127
|
-
## Example
|
|
128
|
-
|
|
129
|
-
See [`examples/toolbox/bolted-joint.forge.js`](../../../../examples/toolbox/bolted-joint.forge.js) for a complete two-plate bolted assembly with BOM and exploded view.
|