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,91 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
skill-group: sketch
|
|
3
|
-
skill-order: 5
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
# Sketch Booleans
|
|
7
|
-
|
|
8
|
-
2D boolean operations for combining, subtracting, and intersecting sketches.
|
|
9
|
-
|
|
10
|
-
## Methods
|
|
11
|
-
|
|
12
|
-
### `.add(...others)`
|
|
13
|
-
Combines sketches (union). Accepts `sketch.add(a, b)` and `sketch.add([a, b])`.
|
|
14
|
-
|
|
15
|
-
```javascript
|
|
16
|
-
const combined = rect(50, 30).add(
|
|
17
|
-
circle2d(20).translate(25, 15),
|
|
18
|
-
ngon(6, 15).translate(40, 15)
|
|
19
|
-
);
|
|
20
|
-
```
|
|
21
|
-
|
|
22
|
-
### `.subtract(...others)`
|
|
23
|
-
Subtracts one or more sketches from this one. Accepts `sketch.subtract(a, b)` and `sketch.subtract([a, b])`.
|
|
24
|
-
|
|
25
|
-
```javascript
|
|
26
|
-
const plate = rect(100, 80);
|
|
27
|
-
const hole = circle2d(10);
|
|
28
|
-
const slotCut = rect(18, 8).translate(41, 36);
|
|
29
|
-
const result = plate.subtract(hole.translate(25, 40), slotCut);
|
|
30
|
-
```
|
|
31
|
-
|
|
32
|
-
### `.intersect(...others)`
|
|
33
|
-
Keeps only the area shared by every operand. Accepts `sketch.intersect(a, b)` and `sketch.intersect([a, b])`.
|
|
34
|
-
|
|
35
|
-
```javascript
|
|
36
|
-
const overlap = rect(50, 50).intersect(
|
|
37
|
-
circle2d(30).translate(25, 25),
|
|
38
|
-
rect(40, 20).translate(5, 15)
|
|
39
|
-
);
|
|
40
|
-
```
|
|
41
|
-
|
|
42
|
-
## Functions
|
|
43
|
-
|
|
44
|
-
### `union2d(...sketches)`
|
|
45
|
-
Combines multiple sketches into one.
|
|
46
|
-
|
|
47
|
-
```javascript
|
|
48
|
-
const combined = union2d(
|
|
49
|
-
rect(50, 30),
|
|
50
|
-
circle2d(20).translate(25, 15),
|
|
51
|
-
ngon(6, 15).translate(75, 15)
|
|
52
|
-
);
|
|
53
|
-
```
|
|
54
|
-
|
|
55
|
-
`union2d([a, b, c])` is also supported when your sketches are already in an array.
|
|
56
|
-
|
|
57
|
-
### `difference2d(...sketches)`
|
|
58
|
-
Subtracts sketches[1..n] from sketches[0].
|
|
59
|
-
|
|
60
|
-
```javascript
|
|
61
|
-
const plate = rect(100, 80);
|
|
62
|
-
const hole1 = circle2d(10).translate(25, 40);
|
|
63
|
-
const hole2 = circle2d(10).translate(75, 40);
|
|
64
|
-
const result = difference2d(plate, hole1, hole2);
|
|
65
|
-
```
|
|
66
|
-
|
|
67
|
-
`difference2d([base, cutter1, cutter2])` works too.
|
|
68
|
-
|
|
69
|
-
### `intersection2d(...sketches)`
|
|
70
|
-
Keeps only the area where all sketches overlap.
|
|
71
|
-
|
|
72
|
-
```javascript
|
|
73
|
-
const overlap = intersection2d(
|
|
74
|
-
rect(50, 50),
|
|
75
|
-
circle2d(30).translate(25, 25)
|
|
76
|
-
);
|
|
77
|
-
```
|
|
78
|
-
|
|
79
|
-
`intersection2d([a, b, c])` is also supported.
|
|
80
|
-
|
|
81
|
-
## Performance Note
|
|
82
|
-
|
|
83
|
-
The multi-argument functions (`union2d`, `difference2d`, `intersection2d`) use Manifold's batch operations internally, which are faster than chaining `.add()` / `.subtract()` calls one by one. Prefer them when combining many sketches.
|
|
84
|
-
|
|
85
|
-
```javascript
|
|
86
|
-
// Fast — single batch operation
|
|
87
|
-
const combined = union2d(s1, s2, s3, s4, s5);
|
|
88
|
-
|
|
89
|
-
// Slower — sequential pairwise operations
|
|
90
|
-
const combined = s1.add(s2).add(s3).add(s4).add(s5);
|
|
91
|
-
```
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
skill-group: sketch
|
|
3
|
-
skill-order: 1
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
# Sketch Core
|
|
7
|
-
|
|
8
|
-
The `Sketch` class is an immutable wrapper around Manifold's `CrossSection` that provides a chainable 2D API.
|
|
9
|
-
|
|
10
|
-
## Class: Sketch
|
|
11
|
-
|
|
12
|
-
Represents a 2D profile that can be transformed, combined with other sketches, or converted to 3D.
|
|
13
|
-
|
|
14
|
-
### Color
|
|
15
|
-
|
|
16
|
-
#### `.color(hex: string): Sketch`
|
|
17
|
-
Set the display color of this sketch. Returns a new Sketch.
|
|
18
|
-
|
|
19
|
-
```javascript
|
|
20
|
-
const red = rect(50, 30).color('#ff0000');
|
|
21
|
-
const blue = circle2d(25).color('#0066ff');
|
|
22
|
-
```
|
|
23
|
-
|
|
24
|
-
Colors are preserved through transforms and boolean operations.
|
|
25
|
-
|
|
26
|
-
#### `.clone()` / `.duplicate()`
|
|
27
|
-
Create an explicit duplicate of a sketch wrapper.
|
|
28
|
-
|
|
29
|
-
```javascript
|
|
30
|
-
const base = rect(50, 30);
|
|
31
|
-
const a = base.clone();
|
|
32
|
-
const b = base.duplicate().translate(60, 0);
|
|
33
|
-
```
|
|
34
|
-
|
|
35
|
-
### Query Methods
|
|
36
|
-
|
|
37
|
-
#### `.area(): number`
|
|
38
|
-
Returns the area of the sketch.
|
|
39
|
-
|
|
40
|
-
```javascript
|
|
41
|
-
const sq = rect(50, 50);
|
|
42
|
-
console.log(sq.area()); // 2500
|
|
43
|
-
```
|
|
44
|
-
|
|
45
|
-
#### `.bounds()`
|
|
46
|
-
Returns the bounding box: `{ min: [x, y], max: [x, y] }`.
|
|
47
|
-
|
|
48
|
-
```javascript
|
|
49
|
-
const c = circle2d(25);
|
|
50
|
-
const b = c.bounds();
|
|
51
|
-
// b.min ≈ [-25, -25], b.max ≈ [25, 25]
|
|
52
|
-
```
|
|
53
|
-
|
|
54
|
-
#### `.isEmpty(): boolean`
|
|
55
|
-
Returns true if the sketch has no area.
|
|
56
|
-
|
|
57
|
-
#### `.numVert(): number`
|
|
58
|
-
Returns the number of vertices in the contour.
|
|
59
|
-
|
|
60
|
-
#### `.toPolygons()`
|
|
61
|
-
Returns raw polygon contours for rendering (internal use).
|
|
62
|
-
|
|
63
|
-
## Type: Anchor
|
|
64
|
-
|
|
65
|
-
Anchor points for positioning sketches:
|
|
66
|
-
- `'center'` — geometric center
|
|
67
|
-
- `'top-left'`, `'top-right'`, `'bottom-left'`, `'bottom-right'` — corners
|
|
68
|
-
- `'top'`, `'bottom'`, `'left'`, `'right'` — edge midpoints
|
|
69
|
-
|
|
70
|
-
## Dimensions
|
|
71
|
-
|
|
72
|
-
Use `dim()` / `dimLine()` for visual measurement callouts and report annotations.
|
|
73
|
-
See [../output/dimensions.md](../output/dimensions.md) for options and ownership behavior.
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
skill-group: sketch
|
|
3
|
-
skill-order: 8
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
# Sketch Extrude & Revolve
|
|
7
|
-
|
|
8
|
-
Convert 2D sketches into 3D shapes through extrusion or revolution. The sketch's color (if set) is carried over to the resulting Shape.
|
|
9
|
-
|
|
10
|
-
If a sketch has been placed with [`onFace()`](sketch-on-face.md), extrusion follows that face normal instead of the global Z axis.
|
|
11
|
-
|
|
12
|
-
## Methods
|
|
13
|
-
|
|
14
|
-
### `.extrude(height, options?)`
|
|
15
|
-
Extrudes sketch along Z axis.
|
|
16
|
-
|
|
17
|
-
**Parameters:**
|
|
18
|
-
- `height` (number) - Extrusion height
|
|
19
|
-
- `options` (object, optional):
|
|
20
|
-
- `twist` (number) - Twist angle in degrees
|
|
21
|
-
- `divisions` (number) - Number of twist steps (needed for twist)
|
|
22
|
-
- `scaleTop` (number | [number, number]) - Scale factor at top
|
|
23
|
-
- `center` (boolean) - Center along Z axis
|
|
24
|
-
|
|
25
|
-
**Returns:** `TrackedShape` (with faces: top, bottom, side)
|
|
26
|
-
|
|
27
|
-
```javascript
|
|
28
|
-
const simple = rect(50, 30).extrude(10);
|
|
29
|
-
|
|
30
|
-
const twisted = ngon(6, 20).extrude(60, {
|
|
31
|
-
twist: 90,
|
|
32
|
-
divisions: 32
|
|
33
|
-
});
|
|
34
|
-
|
|
35
|
-
const tapered = circle2d(20).extrude(50, {
|
|
36
|
-
scaleTop: 0.5
|
|
37
|
-
});
|
|
38
|
-
|
|
39
|
-
const badge = roundedRect(28, 10, 2, true)
|
|
40
|
-
.onFace(box(120, 60, 40, true), 'front', { v: 8 })
|
|
41
|
-
.extrude(2);
|
|
42
|
-
```
|
|
43
|
-
|
|
44
|
-
### `.revolve(degrees?, segments?)`
|
|
45
|
-
Revolves sketch around Y axis (becomes Z in result).
|
|
46
|
-
|
|
47
|
-
Performance tip: prefer `revolve()` over `loft()` whenever the part is rotationally symmetric. Loft is for profile interpolation and is substantially heavier.
|
|
48
|
-
|
|
49
|
-
**Parameters:**
|
|
50
|
-
- `degrees` (number, optional) - Rotation angle. Default: 360 (full revolution)
|
|
51
|
-
- `segments` (number, optional) - Number of segments. Default: auto
|
|
52
|
-
|
|
53
|
-
**Returns:** `Shape`
|
|
54
|
-
|
|
55
|
-
```javascript
|
|
56
|
-
// Vase profile
|
|
57
|
-
const profile = polygon([[20, 0], [25, 30], [20, 60]]);
|
|
58
|
-
const vase = profile.revolve();
|
|
59
|
-
|
|
60
|
-
// Partial revolution (C-shape)
|
|
61
|
-
const partial = rect(5, 40).translate(20, 0).revolve(270);
|
|
62
|
-
```
|
|
@@ -1,104 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
skill-group: sketch
|
|
3
|
-
skill-order: 7
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
# Sketch On Face
|
|
7
|
-
|
|
8
|
-
Attach a 2D sketch to a 3D face so it renders in-place and extrudes along that face normal.
|
|
9
|
-
|
|
10
|
-
This supports:
|
|
11
|
-
- canonical body faces: `front`, `back`, `left`, `right`, `top`, `bottom`
|
|
12
|
-
- tracked planar faces on `TrackedShape`, like `side-left`
|
|
13
|
-
- direct `FaceRef` targets from `tracked.face('top')`
|
|
14
|
-
- supported compiler-owned created faces on `shell()` / `hole()` / `cutout()` results, such as `inner-side-right`, `floor`, `counterbore-floor`, and `wall-right`
|
|
15
|
-
- supported compiler-owned created faces on `shell()` / `hole()` / `cutout()` results, such as `inner-side-right`, `floor`, `counterbore-floor`, and `wall-right`
|
|
16
|
-
- defended preserved faces on compile-covered boolean results when one propagated descendant keeps a unique name
|
|
17
|
-
- direct `FaceRef` targets from preserved/repeated descendants that still validate against a later compile-covered boolean target
|
|
18
|
-
|
|
19
|
-
## `.onFace(parent, face, opts?)`
|
|
20
|
-
|
|
21
|
-
Places a sketch onto a parent face using face-local coordinates.
|
|
22
|
-
|
|
23
|
-
**Parameters:**
|
|
24
|
-
- `parent` (`Shape | TrackedShape`) - target body
|
|
25
|
-
- `face` (`'front' | 'back' | 'left' | 'right' | 'top' | 'bottom' | string | FaceRef`)
|
|
26
|
-
- `opts` (object, optional):
|
|
27
|
-
- `u` (number) - face-local horizontal offset from the face center
|
|
28
|
-
- `v` (number) - face-local vertical offset from the face center
|
|
29
|
-
- `protrude` (number) - offset along the face normal. Positive = outward
|
|
30
|
-
- `selfAnchor` (`Anchor`) - which 2D sketch anchor aligns to the face center. Default: `'center'`
|
|
31
|
-
|
|
32
|
-
**Returns:** `Sketch`
|
|
33
|
-
|
|
34
|
-
## `.onFace(faceRef, opts?)`
|
|
35
|
-
|
|
36
|
-
Places a sketch directly from a tracked or compiler-owned planar `FaceRef`.
|
|
37
|
-
|
|
38
|
-
This is useful when the script has already selected a face semantically:
|
|
39
|
-
|
|
40
|
-
```javascript
|
|
41
|
-
const panel = Rectangle2D.from3Points(
|
|
42
|
-
point(-30, -18),
|
|
43
|
-
point(28, -6),
|
|
44
|
-
point(18, 24),
|
|
45
|
-
).extrude(16);
|
|
46
|
-
|
|
47
|
-
const cap = circle2d(5)
|
|
48
|
-
.onFace(panel.face('top'), { u: 12, protrude: 0.05 })
|
|
49
|
-
.extrude(1.2);
|
|
50
|
-
```
|
|
51
|
-
|
|
52
|
-
```javascript
|
|
53
|
-
const cup = roundedRect(70, 42, 5, true)
|
|
54
|
-
.extrude(22)
|
|
55
|
-
.shell(2, { openFaces: ['top'] });
|
|
56
|
-
|
|
57
|
-
const rib = rect(6, 4)
|
|
58
|
-
.onFace(cup, 'inner-side-right', { u: 0, v: 0, protrude: 0.05 })
|
|
59
|
-
.extrude(1.2);
|
|
60
|
-
```
|
|
61
|
-
|
|
62
|
-
```javascript
|
|
63
|
-
const body = box(120, 60, 40, true).color('#d8dce3');
|
|
64
|
-
|
|
65
|
-
const badge = roundedRect(28, 10, 2, true)
|
|
66
|
-
.onFace(body, 'front', { v: 8 })
|
|
67
|
-
.extrude(2)
|
|
68
|
-
.color('#1d2733');
|
|
69
|
-
|
|
70
|
-
return [
|
|
71
|
-
{ name: 'Body', shape: body },
|
|
72
|
-
{ name: 'Badge', shape: badge },
|
|
73
|
-
];
|
|
74
|
-
```
|
|
75
|
-
|
|
76
|
-
## Face-local coordinates
|
|
77
|
-
|
|
78
|
-
- Canonical faces:
|
|
79
|
-
- `front` / `back`: `u = X`, `v = Z`
|
|
80
|
-
- `left` / `right`: `u` runs across the face, `v = Z`
|
|
81
|
-
- `top` / `bottom`: `u = X`, `v` runs across the face
|
|
82
|
-
- Tracked planar faces use their own stored local frame:
|
|
83
|
-
- side faces of extruded rectangles: `u` follows the source edge, `v = Z`
|
|
84
|
-
- tracked `top` / `bottom` faces follow the source sketch axes
|
|
85
|
-
- direct `FaceRef` placement uses that face's `uAxis` / `vAxis`
|
|
86
|
-
- supported shell inner walls, blind-hole floors, counterbore shoulder floors, and defended cut walls reuse compiler-owned local frames for downstream workplanes
|
|
87
|
-
- supported shell inner walls, blind-hole floors, counterbore shoulder floors, and defended cut walls reuse compiler-owned local frames for downstream workplanes
|
|
88
|
-
- compile-covered `Shape` targets now resolve defended named faces through the shared face-query table before falling back to bare canonical body heuristics
|
|
89
|
-
|
|
90
|
-
The sketch's local `+Z` becomes the face normal, so `extrude(positive)` goes outward from that face.
|
|
91
|
-
|
|
92
|
-
## Notes
|
|
93
|
-
|
|
94
|
-
- This is a planar face-placement feature, not arbitrary curved-surface projection.
|
|
95
|
-
- Tracked curved faces like `cylinder(...).face('side')` are rejected because they do not have a planar sketch frame.
|
|
96
|
-
- Supported created-face names on compiler-owned feature results are intentionally narrow, but defended split descendants now stay visible as semantic regions where Forge can keep one stable source surface.
|
|
97
|
-
- Hole/cut host faces, supported `upToFace` termination faces, and defended boolean-difference / boolean-intersection descendants can now stay queryable as face regions instead of collapsing straight to "missing face".
|
|
98
|
-
- Coplanar boolean face sets now stay placeable through `onFace(shape, name, ...)` when Forge can defend one shared planar frame; non-coplanar sets stay explicit and reject planar placement honestly.
|
|
99
|
-
- The placed sketch still supports normal 2D operations like `translate`, `rotate`, `scale`, and sketch booleans before extrusion.
|
|
100
|
-
- If multiple sketches share the same face placement, their 2D booleans preserve that shared placement.
|
|
101
|
-
- If booleans mix sketches with different 3D placements, the result drops back to an unplaced sketch.
|
|
102
|
-
- Extruding a placed sketch keeps the tracked `top` / `bottom` / `side` metadata from that extrusion, transformed into world space.
|
|
103
|
-
- Projection-driven follow-on sketches now keep compiler-visible provenance when you `projectToPlane()` a compatible projected source back onto a matching parallel plane. The defended exact subset now covers straight extrusions plus compatible shell/hole/cut/union descendants that reduce to one planar projection basis, but arbitrary projection targets still stay runtime-only.
|
|
104
|
-
- `projectToPlane()` accepts a `FaceRef` as the target plane via `{ face: shape.face(name) }`. When the target is a defended descendant region (such as `inner-bottom` after a shell), the compiler stores a `targetFaceQuery` in the projection compile plan so later cuts, offsets, and stiffeners can explain which surface they originated from. The same parallel-plane replay constraints apply: the projected source basis must stay parallel to the target face normal.
|
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
skill-group: sketch
|
|
3
|
-
skill-order: 6
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
# Sketch Operations
|
|
7
|
-
|
|
8
|
-
2D operations for modifying sketch contours.
|
|
9
|
-
|
|
10
|
-
## Methods
|
|
11
|
-
|
|
12
|
-
All operations preserve the sketch's color.
|
|
13
|
-
|
|
14
|
-
### `.offset(delta, join?)`
|
|
15
|
-
Inflate (positive) or deflate (negative) the contour.
|
|
16
|
-
|
|
17
|
-
**Parameters:**
|
|
18
|
-
- `delta` (number) - Offset distance. Positive = outward, negative = inward
|
|
19
|
-
- `join` ('Square' | 'Round' | 'Miter', optional) - Corner style. Default: 'Round'
|
|
20
|
-
|
|
21
|
-
```javascript
|
|
22
|
-
const outer = rect(50, 30).offset(5); // Expand by 5mm
|
|
23
|
-
const inner = circle2d(20).offset(-2); // Shrink by 2mm
|
|
24
|
-
const sharp = ngon(6, 20).offset(3, 'Miter');
|
|
25
|
-
```
|
|
26
|
-
|
|
27
|
-
Use the common `offset(-r).offset(+r)` pattern when you want to round **every convex corner** of a closed sketch.
|
|
28
|
-
|
|
29
|
-
### `filletCorners(points, corners)`
|
|
30
|
-
Round specific corners of a polygon point list (both convex and concave).
|
|
31
|
-
|
|
32
|
-
**Parameters:**
|
|
33
|
-
- `points` (([number, number] | Point2D)[]) - Closed polygon vertices in order
|
|
34
|
-
- `corners` (`{ index: number, radius: number, segments?: number }[]`) - Which vertices to fillet
|
|
35
|
-
|
|
36
|
-
**Returns:** `Sketch`
|
|
37
|
-
|
|
38
|
-
```javascript
|
|
39
|
-
const roofPoints = [
|
|
40
|
-
[0, 0],
|
|
41
|
-
[90, 0],
|
|
42
|
-
[90, 44],
|
|
43
|
-
[66, 74],
|
|
44
|
-
[45, 86],
|
|
45
|
-
[24, 74],
|
|
46
|
-
[0, 44],
|
|
47
|
-
];
|
|
48
|
-
|
|
49
|
-
const roof = filletCorners(roofPoints, [
|
|
50
|
-
{ index: 3, radius: 19 },
|
|
51
|
-
{ index: 4, radius: 19 },
|
|
52
|
-
{ index: 5, radius: 19 },
|
|
53
|
-
]);
|
|
54
|
-
```
|
|
55
|
-
|
|
56
|
-
Notes:
|
|
57
|
-
- both convex and concave corners are supported; convex fillets cut the corner, concave fillets fill the concavity
|
|
58
|
-
- collinear corners (straight edges) cannot be filleted
|
|
59
|
-
- if two neighboring fillets would overlap on the same edge, the function throws
|
|
60
|
-
- compare `polygon(points)` and `filletCorners(points, ...)` before extruding when debugging mixed sharp-and-rounded outlines
|
|
61
|
-
|
|
62
|
-
## Choosing A Rounding Strategy
|
|
63
|
-
|
|
64
|
-
- `offset(-r).offset(+r)` rounds all convex corners of an existing closed profile
|
|
65
|
-
- `stroke(points, width, 'Round')` thickens a centerline path; use it for ribs, traces, and wire-like geometry
|
|
66
|
-
- `filletCorners(points, ...)` is the right tool when some corners stay sharp and others need true tangent fillets
|
|
67
|
-
- See `examples/api/sketch-rounding-strategies.forge.js` for a side-by-side comparison
|
|
68
|
-
|
|
69
|
-
### `.simplify(epsilon?)`
|
|
70
|
-
Removes vertices that don't significantly affect the shape.
|
|
71
|
-
|
|
72
|
-
**Parameters:**
|
|
73
|
-
- `epsilon` (number, optional) - Tolerance for vertex removal. Default: 1e-6
|
|
74
|
-
|
|
75
|
-
```javascript
|
|
76
|
-
const simplified = complexSketch.simplify(0.1);
|
|
77
|
-
```
|
|
78
|
-
|
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
skill-group: sketch
|
|
3
|
-
skill-order: 3
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
# Sketch Path Builder
|
|
7
|
-
|
|
8
|
-
Fluent API for tracing 2D outlines point by point.
|
|
9
|
-
|
|
10
|
-
## Class: PathBuilder
|
|
11
|
-
|
|
12
|
-
### `path()`
|
|
13
|
-
Creates a new path builder.
|
|
14
|
-
|
|
15
|
-
```javascript
|
|
16
|
-
const triangle = path()
|
|
17
|
-
.moveTo(0, 0)
|
|
18
|
-
.lineH(50)
|
|
19
|
-
.lineV(30)
|
|
20
|
-
.close();
|
|
21
|
-
```
|
|
22
|
-
|
|
23
|
-
### Methods
|
|
24
|
-
|
|
25
|
-
#### `.moveTo(x, y)`
|
|
26
|
-
Set starting point.
|
|
27
|
-
|
|
28
|
-
#### `.lineTo(x, y)`
|
|
29
|
-
Line to absolute position.
|
|
30
|
-
|
|
31
|
-
#### `.lineH(dx)`
|
|
32
|
-
Horizontal line (relative).
|
|
33
|
-
|
|
34
|
-
#### `.lineV(dy)`
|
|
35
|
-
Vertical line (relative).
|
|
36
|
-
|
|
37
|
-
#### `.lineAngled(length, degrees)`
|
|
38
|
-
Line at angle (0°=right, 90°=up).
|
|
39
|
-
|
|
40
|
-
#### `.close()`
|
|
41
|
-
Close path into a `Sketch` (auto-fixes winding).
|
|
42
|
-
|
|
43
|
-
#### `.stroke(width, join?)`
|
|
44
|
-
Thicken path into solid profile (see below).
|
|
45
|
-
|
|
46
|
-
## Stroke
|
|
47
|
-
|
|
48
|
-
Thicken a polyline (centerline) into a solid profile with uniform width. Proper miter joins at vertices.
|
|
49
|
-
|
|
50
|
-
### `path().stroke(width, join?)`
|
|
51
|
-
### `stroke(points, width, join?)`
|
|
52
|
-
|
|
53
|
-
**Parameters:**
|
|
54
|
-
- `width` (number) — Profile thickness
|
|
55
|
-
- `join` ('Square' | 'Round', optional) — Corner style. Default: 'Square' (miter)
|
|
56
|
-
|
|
57
|
-
**Returns:** `Sketch`
|
|
58
|
-
|
|
59
|
-
```javascript
|
|
60
|
-
// Fluent path builder
|
|
61
|
-
const bracket = path()
|
|
62
|
-
.moveTo(0, 0)
|
|
63
|
-
.lineH(50)
|
|
64
|
-
.lineV(-70)
|
|
65
|
-
.lineAngled(20, 235)
|
|
66
|
-
.stroke(4);
|
|
67
|
-
|
|
68
|
-
// Or with point array
|
|
69
|
-
const bracket = stroke([[0, 0], [50, 0], [50, -70]], 4);
|
|
70
|
-
|
|
71
|
-
// Rounded corners
|
|
72
|
-
const rounded = stroke([[0, 0], [50, 0], [50, -50]], 4, 'Round');
|
|
73
|
-
```
|
|
74
|
-
|
|
75
|
-
Use `stroke(..., 'Round')` for centerline-based geometry such as ribs, traces, and wire-like profiles. It is not the same as rounding selected corners of an existing closed polygon. For mixed sharp-and-rounded outlines, build the polygon first and use `filletCorners(...)`.
|
|
@@ -1,146 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
skill-group: sketch
|
|
3
|
-
skill-order: 2
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
# Sketch Primitives
|
|
7
|
-
|
|
8
|
-
2D primitive shapes for creating sketches.
|
|
9
|
-
|
|
10
|
-
## Functions
|
|
11
|
-
|
|
12
|
-
### `rect(width, height, center?)`
|
|
13
|
-
Creates a rectangle.
|
|
14
|
-
|
|
15
|
-
**Parameters:**
|
|
16
|
-
- `width` (number) - Width
|
|
17
|
-
- `height` (number) - Height
|
|
18
|
-
- `center` (boolean, optional) - If true, centers at origin. Default: false (corner at origin)
|
|
19
|
-
|
|
20
|
-
```javascript
|
|
21
|
-
const r = rect(50, 30);
|
|
22
|
-
const centered = rect(50, 30, true);
|
|
23
|
-
```
|
|
24
|
-
|
|
25
|
-
### `circle2d(radius, segments?)`
|
|
26
|
-
Creates a circle.
|
|
27
|
-
|
|
28
|
-
**Parameters:**
|
|
29
|
-
- `radius` (number) - Circle radius
|
|
30
|
-
- `segments` (number, optional) - Number of segments. Default: auto (smooth)
|
|
31
|
-
|
|
32
|
-
```javascript
|
|
33
|
-
const c = circle2d(25);
|
|
34
|
-
const octagon = circle2d(25, 8);
|
|
35
|
-
```
|
|
36
|
-
|
|
37
|
-
### `roundedRect(width, height, radius, center?)`
|
|
38
|
-
Creates a rectangle with rounded corners.
|
|
39
|
-
|
|
40
|
-
**Parameters:**
|
|
41
|
-
- `width` (number) - Width
|
|
42
|
-
- `height` (number) - Height
|
|
43
|
-
- `radius` (number) - Corner radius
|
|
44
|
-
- `center` (boolean, optional) - If true, centers at origin. Default: false
|
|
45
|
-
|
|
46
|
-
```javascript
|
|
47
|
-
const rounded = roundedRect(60, 40, 5);
|
|
48
|
-
```
|
|
49
|
-
|
|
50
|
-
### `polygon(points)`
|
|
51
|
-
Creates a polygon from an array of [x, y] points or Point2D objects.
|
|
52
|
-
|
|
53
|
-
**Parameters:**
|
|
54
|
-
- `points` (([number, number] | Point2D)[]) - Array of vertex coordinates or Point2D objects
|
|
55
|
-
|
|
56
|
-
```javascript
|
|
57
|
-
const triangle = polygon([[0, 0], [50, 0], [25, 40]]);
|
|
58
|
-
|
|
59
|
-
// Also accepts Point2D objects
|
|
60
|
-
const p1 = point(0, 0), p2 = point(50, 0), p3 = point(25, 40);
|
|
61
|
-
const triangle2 = polygon([p1, p2, p3]);
|
|
62
|
-
```
|
|
63
|
-
|
|
64
|
-
### `ngon(sides, radius)`
|
|
65
|
-
Creates a regular polygon (equilateral).
|
|
66
|
-
|
|
67
|
-
**Parameters:**
|
|
68
|
-
- `sides` (number) - Number of sides
|
|
69
|
-
- `radius` (number) - Radius from center to vertex
|
|
70
|
-
|
|
71
|
-
```javascript
|
|
72
|
-
const hex = ngon(6, 25);
|
|
73
|
-
const triangle = ngon(3, 30);
|
|
74
|
-
```
|
|
75
|
-
|
|
76
|
-
### `ellipse(rx, ry, segments?)`
|
|
77
|
-
Creates an ellipse.
|
|
78
|
-
|
|
79
|
-
**Parameters:**
|
|
80
|
-
- `rx` (number) - X radius
|
|
81
|
-
- `ry` (number) - Y radius
|
|
82
|
-
- `segments` (number, optional) - Number of segments. Default: 64
|
|
83
|
-
|
|
84
|
-
```javascript
|
|
85
|
-
const oval = ellipse(40, 20);
|
|
86
|
-
```
|
|
87
|
-
|
|
88
|
-
### `slot(length, width)`
|
|
89
|
-
Creates an oblong shape (rectangle with semicircle ends).
|
|
90
|
-
|
|
91
|
-
**Parameters:**
|
|
92
|
-
- `length` (number) - Total length
|
|
93
|
-
- `width` (number) - Width
|
|
94
|
-
|
|
95
|
-
```javascript
|
|
96
|
-
const oblong = slot(60, 20);
|
|
97
|
-
```
|
|
98
|
-
|
|
99
|
-
### `star(points, outerRadius, innerRadius)`
|
|
100
|
-
Creates a star shape.
|
|
101
|
-
|
|
102
|
-
**Parameters:**
|
|
103
|
-
- `points` (number) - Number of star points
|
|
104
|
-
- `outerRadius` (number) - Outer radius (tip of points)
|
|
105
|
-
- `innerRadius` (number) - Inner radius (between points)
|
|
106
|
-
|
|
107
|
-
```javascript
|
|
108
|
-
const star5 = star(5, 30, 15);
|
|
109
|
-
```
|
|
110
|
-
|
|
111
|
-
### `text2d(content, options?)`
|
|
112
|
-
Renders a string as a filled 2D sketch using the built-in "Forge Mono" geometric font — a clean, angular, monoline typeface designed to extrude and engrave crisply. Supports A–Z (case-insensitive), 0–9, and common punctuation.
|
|
113
|
-
|
|
114
|
-
**Parameters:**
|
|
115
|
-
- `content` (string) - Text to render
|
|
116
|
-
- `options.size` (number) - Cap height in model units. Default: `10`
|
|
117
|
-
- `options.letterSpacing` (number) - Extra spacing between characters in model units. Default: `0`
|
|
118
|
-
- `options.align` (`'left' | 'center' | 'right'`) - Horizontal alignment relative to x = 0. Default: `'left'`
|
|
119
|
-
- `options.baseline` (`'baseline' | 'center' | 'top'`) - Vertical alignment relative to y = 0. Default: `'baseline'`
|
|
120
|
-
|
|
121
|
-
**Returns:** `Sketch`
|
|
122
|
-
|
|
123
|
-
```javascript
|
|
124
|
-
// Extruded nameplate
|
|
125
|
-
text2d('FORGE CAD', { size: 8 }).extrude(1.5)
|
|
126
|
-
|
|
127
|
-
// Centered label
|
|
128
|
-
text2d('V 2.0', { size: 6, align: 'center', baseline: 'center' }).extrude(0.8)
|
|
129
|
-
|
|
130
|
-
// Engraved into a face
|
|
131
|
-
myPart.cut(text2d('A-001', { size: 4 }).onFace(myPart, 'top'), { depth: 0.5 })
|
|
132
|
-
```
|
|
133
|
-
|
|
134
|
-
### `textWidth(content, options?)`
|
|
135
|
-
Returns the rendered advance width of a string in model units, using the same metrics as `text2d`.
|
|
136
|
-
|
|
137
|
-
**Parameters:**
|
|
138
|
-
- `content` (string) - Text to measure
|
|
139
|
-
- `options.size` (number) - Cap height in model units. Default: `10`
|
|
140
|
-
- `options.letterSpacing` (number) - Extra spacing between characters. Default: `0`
|
|
141
|
-
|
|
142
|
-
**Returns:** `number`
|
|
143
|
-
|
|
144
|
-
```javascript
|
|
145
|
-
const w = textWidth('HELLO', { size: 10 }); // total advance width
|
|
146
|
-
```
|