surfcad-mcp 0.3.9 → 0.4.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 +70 -49
- package/bin/surfcad-mcp.js +4 -3
- package/data/commands.json +6481 -5817
- package/data/helpers.json +243 -268
- package/package.json +2 -2
- package/src/cli.mjs +221 -23
- package/src/cliCall.mjs +221 -0
- package/src/errors.mjs +8 -5
- package/src/helpers.mjs +7 -5
- package/src/importFile.mjs +186 -0
- package/src/listen/bootstrap.mjs +87 -34
- package/src/listen/claudeCodeWake.mjs +74 -0
- package/src/listen/daemon.mjs +35 -0
- package/src/listen/listenCli.mjs +121 -30
- package/src/listen/listener.mjs +138 -8
- package/src/listen/owner.mjs +293 -0
- package/src/listen/waitCli.mjs +133 -0
- package/src/listen/wake.mjs +39 -19
- package/src/listen/wakeSetupText.mjs +23 -5
- package/src/pairWait.mjs +3 -3
- package/src/pairingCode.mjs +10 -0
- package/src/prompt/buildGuidance.mjs +9 -7
- package/src/prompt/chatFlow.mjs +15 -0
- package/src/prompt/errorHints.mjs +24 -10
- package/src/prompt/guide.mjs +27 -14
- package/src/prompt/promptSession.mjs +74 -10
- package/src/prompt/promptTools.mjs +10 -6
- package/src/prompt/replyConfirm.mjs +69 -0
- package/src/relayMessages.mjs +43 -1
- package/src/remote/config.mjs +17 -13
- package/src/remote/session.mjs +103 -5
- package/src/room/seat.mjs +334 -0
- package/src/screenshotFile.mjs +9 -0
- package/src/server.mjs +155 -111
- package/src/stepUploadLimit.mjs +8 -0
- package/src/bridge/bridgePage.mjs +0 -132
- package/src/bridge/bridgePopup.mjs +0 -288
- package/src/bridge/relayHub.mjs +0 -556
- package/src/bridge/relayServer.mjs +0 -291
- package/src/nodeClient.mjs +0 -63
- package/src/relay.mjs +0 -419
package/data/helpers.json
CHANGED
|
@@ -1,7 +1,26 @@
|
|
|
1
1
|
{
|
|
2
2
|
"generatedFrom": "src/lib/surfcad/runtime.js HELPER_FUNCTIONS",
|
|
3
|
-
"count":
|
|
3
|
+
"count": 83,
|
|
4
4
|
"helpers": [
|
|
5
|
+
{
|
|
6
|
+
"name": "remapSketchRings",
|
|
7
|
+
"signature": "remapSketchRings(contours, map)",
|
|
8
|
+
"params": [
|
|
9
|
+
{
|
|
10
|
+
"name": "contours",
|
|
11
|
+
"text": "contours"
|
|
12
|
+
},
|
|
13
|
+
{
|
|
14
|
+
"name": "map",
|
|
15
|
+
"text": "map"
|
|
16
|
+
}
|
|
17
|
+
],
|
|
18
|
+
"description": "remapSketchRings(contours, map) → the rings with every point mapped, for a profile that is moved or turned in the script after the solve (a revolve about an axis off the sketch origin maps [u, v] to [radius, height]). ",
|
|
19
|
+
"doc": "remapSketchRings(contours, map) → the rings with every point mapped, for a\nprofile that is moved or turned in the script after the solve (a revolve\nabout an axis off the sketch origin maps [u, v] to [radius, height]).\nThe arcs of the solved sketch follow the points: each mapped chord is noted\nas a chord of the same arc, with the arc's centre mapped and its radius\nscaled, so the walls and revolve faces stay one per sketch entity. A plain\n`.map` loses that, and a revolved circle came out as a face per chord with\na line between every two (fixture 104's 90° bends).\n`map` takes and returns a 2D point [x, y]; a rigid or similarity map keeps\narcs round.",
|
|
20
|
+
"examples": [
|
|
21
|
+
"const bend = makeRevolve(remapSketchRings(c5.contours, ([u, v]) => [-v + 78.7, u]), 0, 90);"
|
|
22
|
+
]
|
|
23
|
+
},
|
|
5
24
|
{
|
|
6
25
|
"name": "shell",
|
|
7
26
|
"signature": "shell(manifold, thickness, opening = 'z')",
|
|
@@ -21,7 +40,7 @@
|
|
|
21
40
|
}
|
|
22
41
|
],
|
|
23
42
|
"description": "shell(manifold, thickness, opening) — the CAVITY tool. ",
|
|
24
|
-
"doc": "Hollows a solid out to a **uniform wall thickness**, leaving an opening at the\nface you choose. `hollow()` returns the finished walls; `shell()` returns the\ncavity so the older `part.subtract(shell(part, 2, 'z'))` still works.\n\nEvery boundary vertex is placed on the inward offset of each face meeting it, so\nthe wall measures `thickness` perpendicular to every face and corners stay sharp.\n(The pre-2026 version scaled the solid by one ratio, which gave a 60x20 box a\n2.5mm wall on Y and a 7.5mm wall on X.) A flat met by a fillet keeps its\ntangency line: those vertices move purely along the flat's normal, every\nvertex on a real flat lands exactly on the offset plane (an open rim's\ncorners too, so the rim keeps its corners instead of a fan of collinear\nvertices), and a sliver the warp turns inside out gets its diagonal swapped\nbefore the cavity is built, so a dense fillet (96 steps per quarter) hollows\nwithout fold pairs.\n\n\n\n**Parameters:**\n- `manifold` - The input manifold\n- `thickness` - Wall thickness in mm\n- `opening` - which face(s) the cavity breaks through (default `'z'`, the +Z face):\n - a signed axis: `'z'`, `'-z'`, `'x'`, `'-x'`, `'y'`, `'-y'`\n - `'none'` for a fully closed hollow\n - a face object from `facesByNormal()` / `planarFaceAt()`\n - a viewport face pick: `{ center: [...], normal: [...] }`\n - an array mixing any of the above\n\n**Returns:** `hollow()` the shelled solid; `shell()` the cavity to subtract\n\n**Notes:**\n- Picking a face that is no longer on the body throws and tells you to re-pick,\n rather than silently shelling the wrong side.\n- A thickness the body cannot take throws instead of returning a fold.\n- Curved and lofted walls are supported; the offset follows the tessellation.\n\n---",
|
|
43
|
+
"doc": "Hollows a solid out to a **uniform wall thickness**, leaving an opening at the\nface you choose. `hollow()` returns the finished walls; `shell()` returns the\ncavity so the older `part.subtract(shell(part, 2, 'z'))` still works.\n\nEvery boundary vertex is placed on the inward offset of each face meeting it, so\nthe wall measures `thickness` perpendicular to every face and corners stay sharp.\n(The pre-2026 version scaled the solid by one ratio, which gave a 60x20 box a\n2.5mm wall on Y and a 7.5mm wall on X.) A flat met by a fillet keeps its\ntangency line: those vertices move purely along the flat's normal, every\nvertex on a real flat lands exactly on the offset plane (an open rim's\ncorners too, so the rim keeps its corners instead of a fan of collinear\nvertices), and a sliver the warp turns inside out gets its diagonal swapped\nbefore the cavity is built, so a dense fillet (96 steps per quarter) hollows\nwithout fold pairs. A plane that only sliver triangles hold (under 0.02 mm\ntall, a boolean's leftovers) does not steer a vertex when it is under a\nthousandth of the area of the largest face there: five such triangles on a\nfillet's toe line, 3 to 7 µm tall, used to move three ceiling vertices 6 mm\nsideways and leave lines across the cavity's ceiling. At an opening the cavity pokes through the open face by\nthe wall thickness, and each rim vertex is carried there along its own\nsurface (the mesh edge that runs from it down the wall), so the wall is the\nsame thickness at the rim as at the floor when the walls are drafted: a box\ndrafted 1° with r 4 corner rounds, shelled 1.85 mm, used to read 1.88 to\n1.89 mm on the rounds at the rim.\n\n**The cavity's faces are named for the faces they offset** ([B-REP_METADATA.md](../B-REP_METADATA.md) rule 1): `shell1.wall[boss.side]` is the inner wall of `boss.side`, `shell1.wall[plate.top]` the inner ceiling under `plate.top`, and each carries the source's live record moved inward (a cylinder or sphere at the offset radius, a cone with its apex slid along the axis, a plane from its own triangles) with the source lattice (`segments`), so `surfaceOf` reads a cone for a drafted inner wall, `edgeCurves(part, 'shell1.wall[boss.side]~shell1.wall[boss.top]')` is one circle on the boss lattice, Convert and Offset see it, and a fillet picked on that rim is written as one `edgesNamed` and runs as one tube. Note the vertices of a uniform-wall polygon sit at `r − t / cos(π/n)`, not `r − t`: the wall is `t` thick at the facets.\n\n\n\n**Parameters:**\n- `manifold` - The input manifold\n- `thickness` - Wall thickness in mm\n- `opening` - which face(s) the cavity breaks through (default `'z'`, the +Z face):\n - a signed axis: `'z'`, `'-z'`, `'x'`, `'-x'`, `'y'`, `'-y'`\n - `'none'` for a fully closed hollow\n - a face object from `facesByNormal()` / `planarFaceAt()`\n - a viewport face pick: `{ center: [...], normal: [...] }`\n - an array mixing any of the above\n\n**Returns:** `hollow()` the shelled solid; `shell()` the cavity to subtract\n\n**Notes:**\n- Picking a face that is no longer on the body throws and tells you to re-pick,\n rather than silently shelling the wrong side.\n- A thickness the body cannot take throws instead of returning a fold.\n- Curved and lofted walls are supported; the offset follows the tessellation.\n\n---",
|
|
25
44
|
"examples": [
|
|
26
45
|
"// Uniform 2mm wall, open at the top\nconst box = Manifold.cube([50, 30, 40], true);\nreturn hollow(box, 2, 'z');\n\n// Opening on a face you picked in the viewport, or queried\nlet part = Manifold.cylinder(40, 20, 20, 64);\npart = hollow(part, 2.5, facesByNormal(part, [0, 0, 1])[0]);\n\n// Closed hollow (a sealed void), and two openings at once\nconst sealed = hollow(Manifold.cube([30, 30, 30], true), 3, 'none');\nconst openBoth = hollow(Manifold.cube([30, 30, 30], true), 3, ['z', '-z']);"
|
|
27
46
|
]
|
|
@@ -45,7 +64,7 @@
|
|
|
45
64
|
}
|
|
46
65
|
],
|
|
47
66
|
"description": "hollow(manifold, thickness, opening) — the shelled SOLID (walls only).",
|
|
48
|
-
"doc": "Hollows a solid out to a **uniform wall thickness**, leaving an opening at the\nface you choose. `hollow()` returns the finished walls; `shell()` returns the\ncavity so the older `part.subtract(shell(part, 2, 'z'))` still works.\n\nEvery boundary vertex is placed on the inward offset of each face meeting it, so\nthe wall measures `thickness` perpendicular to every face and corners stay sharp.\n(The pre-2026 version scaled the solid by one ratio, which gave a 60x20 box a\n2.5mm wall on Y and a 7.5mm wall on X.) A flat met by a fillet keeps its\ntangency line: those vertices move purely along the flat's normal, every\nvertex on a real flat lands exactly on the offset plane (an open rim's\ncorners too, so the rim keeps its corners instead of a fan of collinear\nvertices), and a sliver the warp turns inside out gets its diagonal swapped\nbefore the cavity is built, so a dense fillet (96 steps per quarter) hollows\nwithout fold pairs.\n\n\n\n**Parameters:**\n- `manifold` - The input manifold\n- `thickness` - Wall thickness in mm\n- `opening` - which face(s) the cavity breaks through (default `'z'`, the +Z face):\n - a signed axis: `'z'`, `'-z'`, `'x'`, `'-x'`, `'y'`, `'-y'`\n - `'none'` for a fully closed hollow\n - a face object from `facesByNormal()` / `planarFaceAt()`\n - a viewport face pick: `{ center: [...], normal: [...] }`\n - an array mixing any of the above\n\n**Returns:** `hollow()` the shelled solid; `shell()` the cavity to subtract\n\n**Notes:**\n- Picking a face that is no longer on the body throws and tells you to re-pick,\n rather than silently shelling the wrong side.\n- A thickness the body cannot take throws instead of returning a fold.\n- Curved and lofted walls are supported; the offset follows the tessellation.\n\n---",
|
|
67
|
+
"doc": "Hollows a solid out to a **uniform wall thickness**, leaving an opening at the\nface you choose. `hollow()` returns the finished walls; `shell()` returns the\ncavity so the older `part.subtract(shell(part, 2, 'z'))` still works.\n\nEvery boundary vertex is placed on the inward offset of each face meeting it, so\nthe wall measures `thickness` perpendicular to every face and corners stay sharp.\n(The pre-2026 version scaled the solid by one ratio, which gave a 60x20 box a\n2.5mm wall on Y and a 7.5mm wall on X.) A flat met by a fillet keeps its\ntangency line: those vertices move purely along the flat's normal, every\nvertex on a real flat lands exactly on the offset plane (an open rim's\ncorners too, so the rim keeps its corners instead of a fan of collinear\nvertices), and a sliver the warp turns inside out gets its diagonal swapped\nbefore the cavity is built, so a dense fillet (96 steps per quarter) hollows\nwithout fold pairs. A plane that only sliver triangles hold (under 0.02 mm\ntall, a boolean's leftovers) does not steer a vertex when it is under a\nthousandth of the area of the largest face there: five such triangles on a\nfillet's toe line, 3 to 7 µm tall, used to move three ceiling vertices 6 mm\nsideways and leave lines across the cavity's ceiling. At an opening the cavity pokes through the open face by\nthe wall thickness, and each rim vertex is carried there along its own\nsurface (the mesh edge that runs from it down the wall), so the wall is the\nsame thickness at the rim as at the floor when the walls are drafted: a box\ndrafted 1° with r 4 corner rounds, shelled 1.85 mm, used to read 1.88 to\n1.89 mm on the rounds at the rim.\n\n**The cavity's faces are named for the faces they offset** ([B-REP_METADATA.md](../B-REP_METADATA.md) rule 1): `shell1.wall[boss.side]` is the inner wall of `boss.side`, `shell1.wall[plate.top]` the inner ceiling under `plate.top`, and each carries the source's live record moved inward (a cylinder or sphere at the offset radius, a cone with its apex slid along the axis, a plane from its own triangles) with the source lattice (`segments`), so `surfaceOf` reads a cone for a drafted inner wall, `edgeCurves(part, 'shell1.wall[boss.side]~shell1.wall[boss.top]')` is one circle on the boss lattice, Convert and Offset see it, and a fillet picked on that rim is written as one `edgesNamed` and runs as one tube. Note the vertices of a uniform-wall polygon sit at `r − t / cos(π/n)`, not `r − t`: the wall is `t` thick at the facets.\n\n\n\n**Parameters:**\n- `manifold` - The input manifold\n- `thickness` - Wall thickness in mm\n- `opening` - which face(s) the cavity breaks through (default `'z'`, the +Z face):\n - a signed axis: `'z'`, `'-z'`, `'x'`, `'-x'`, `'y'`, `'-y'`\n - `'none'` for a fully closed hollow\n - a face object from `facesByNormal()` / `planarFaceAt()`\n - a viewport face pick: `{ center: [...], normal: [...] }`\n - an array mixing any of the above\n\n**Returns:** `hollow()` the shelled solid; `shell()` the cavity to subtract\n\n**Notes:**\n- Picking a face that is no longer on the body throws and tells you to re-pick,\n rather than silently shelling the wrong side.\n- A thickness the body cannot take throws instead of returning a fold.\n- Curved and lofted walls are supported; the offset follows the tessellation.\n\n---",
|
|
49
68
|
"examples": [
|
|
50
69
|
"// Uniform 2mm wall, open at the top\nconst box = Manifold.cube([50, 30, 40], true);\nreturn hollow(box, 2, 'z');\n\n// Opening on a face you picked in the viewport, or queried\nlet part = Manifold.cylinder(40, 20, 20, 64);\npart = hollow(part, 2.5, facesByNormal(part, [0, 0, 1])[0]);\n\n// Closed hollow (a sealed void), and two openings at once\nconst sealed = hollow(Manifold.cube([30, 30, 30], true), 3, 'none');\nconst openBoth = hollow(Manifold.cube([30, 30, 30], true), 3, ['z', '-z']);"
|
|
51
70
|
]
|
|
@@ -73,7 +92,7 @@
|
|
|
73
92
|
},
|
|
74
93
|
{
|
|
75
94
|
"name": "roundedBox",
|
|
76
|
-
"signature": "roundedBox(size, radius, segments
|
|
95
|
+
"signature": "roundedBox(size, radius, segments)",
|
|
77
96
|
"params": [
|
|
78
97
|
{
|
|
79
98
|
"name": "size",
|
|
@@ -85,8 +104,7 @@
|
|
|
85
104
|
},
|
|
86
105
|
{
|
|
87
106
|
"name": "segments",
|
|
88
|
-
"text": "segments
|
|
89
|
-
"default": "16"
|
|
107
|
+
"text": "segments"
|
|
90
108
|
}
|
|
91
109
|
],
|
|
92
110
|
"description": "Create a rounded box (box with filleted edges)",
|
|
@@ -95,7 +113,7 @@
|
|
|
95
113
|
},
|
|
96
114
|
{
|
|
97
115
|
"name": "tube",
|
|
98
|
-
"signature": "tube(outerRadius, innerRadius, height, segments
|
|
116
|
+
"signature": "tube(outerRadius, innerRadius, height, segments)",
|
|
99
117
|
"params": [
|
|
100
118
|
{
|
|
101
119
|
"name": "outerRadius",
|
|
@@ -111,12 +129,11 @@
|
|
|
111
129
|
},
|
|
112
130
|
{
|
|
113
131
|
"name": "segments",
|
|
114
|
-
"text": "segments
|
|
115
|
-
"default": "32"
|
|
132
|
+
"text": "segments"
|
|
116
133
|
}
|
|
117
134
|
],
|
|
118
135
|
"description": "Create a tube/pipe shape — round or rectangular. ",
|
|
119
|
-
"doc": "Creates a tube/pipe shape — round or **rectangular**. Passing an array as the\nfirst argument switches to the rectangular form (and the 4th argument becomes its\noptions object rather than a segment count).\n\n\n\n**Parameters:**\n- `outerRadius` - Outer radius, or `[width, depth]` for a rectangle (a single\n number in `rectTube` means a square)\n- `innerRadius` - Inner radius. For a rectangle: a **number** is read as a\n uniform wall thickness, `[width, depth]` as an explicit inner size.\n- `height` - Height of the tube (z = 0 .. height)\n- `segments` - Number of circular segments
|
|
136
|
+
"doc": "Creates a tube/pipe shape — round or **rectangular**. Passing an array as the\nfirst argument switches to the rectangular form (and the 4th argument becomes its\noptions object rather than a segment count). With no count both walls take the\nshared segment policy of the outer radius.\n\nA rectangular tube names its faces: `top`, `bottom`, the four outer flats\n`left` `right` `front` `back` (-X, +X, -Y, +Y as built), a rounded outer corner\n`corner[i]` (`i = 2 * (x > 0) + (y > 0)`), and inside `innerLeft` `innerRight`\n`innerFront` `innerBack` and `innerCorner[i]`, named by the side of the tube\nthey sit on. Each flat is a face of its own, so a sketch or a hole goes on one\nside: `facesNamed(part, 'tube1.front')`.\n\n\n\n**Parameters:**\n- `outerRadius` - Outer radius, or `[width, depth]` for a rectangle (a single\n number in `rectTube` means a square)\n- `innerRadius` - Inner radius. For a rectangle: a **number** is read as a\n uniform wall thickness, `[width, depth]` as an explicit inner size.\n- `height` - Height of the tube (z = 0 .. height)\n- `segments` - Number of circular segments; omitted, the shared segment\n policy of the outer radius. For a rectangle this slot is the options object\n instead:\n - `cornerRadius` - outer corner radius (default 0, i.e. sharp)\n - `innerCornerRadius` - defaults to `cornerRadius - wall`, keeping the wall\n uniform around the corner\n - `segments` - segments per full circle for the corner arcs; omitted, the\n shared segment policy of the outer corner radius\n - `center` - center the extrusion on z instead of starting at z = 0\n\n---",
|
|
120
137
|
"examples": [
|
|
121
138
|
"// Round: 10mm outer radius, 8mm inner radius, 30mm tall\nconst pipe = tube(10, 8, 30, 32);\n\n// Rectangular 40 x 20, uniform 2.5mm wall, 60mm tall\nconst box = tube([40, 20], 2.5, 60);\n\n// Explicit inner size, and rounded corners (the wall stays uniform round them)\nconst a = tube([40, 20], [30, 10], 60);\nconst b = tube([40, 20], 2.5, 60, { cornerRadius: 4 });\n\n// Square tube, 3mm wall\nconst sq = rectTube(30, 3, 20);"
|
|
122
139
|
]
|
|
@@ -144,7 +161,7 @@
|
|
|
144
161
|
}
|
|
145
162
|
],
|
|
146
163
|
"description": "rectTube(outer, inner, height, opts) — rectangular (square) tube.",
|
|
147
|
-
"doc": "Creates a tube/pipe shape — round or **rectangular**. Passing an array as the\nfirst argument switches to the rectangular form (and the 4th argument becomes its\noptions object rather than a segment count).\n\n\n\n**Parameters:**\n- `outerRadius` - Outer radius, or `[width, depth]` for a rectangle (a single\n number in `rectTube` means a square)\n- `innerRadius` - Inner radius. For a rectangle: a **number** is read as a\n uniform wall thickness, `[width, depth]` as an explicit inner size.\n- `height` - Height of the tube (z = 0 .. height)\n- `segments` - Number of circular segments
|
|
164
|
+
"doc": "Creates a tube/pipe shape — round or **rectangular**. Passing an array as the\nfirst argument switches to the rectangular form (and the 4th argument becomes its\noptions object rather than a segment count). With no count both walls take the\nshared segment policy of the outer radius.\n\nA rectangular tube names its faces: `top`, `bottom`, the four outer flats\n`left` `right` `front` `back` (-X, +X, -Y, +Y as built), a rounded outer corner\n`corner[i]` (`i = 2 * (x > 0) + (y > 0)`), and inside `innerLeft` `innerRight`\n`innerFront` `innerBack` and `innerCorner[i]`, named by the side of the tube\nthey sit on. Each flat is a face of its own, so a sketch or a hole goes on one\nside: `facesNamed(part, 'tube1.front')`.\n\n\n\n**Parameters:**\n- `outerRadius` - Outer radius, or `[width, depth]` for a rectangle (a single\n number in `rectTube` means a square)\n- `innerRadius` - Inner radius. For a rectangle: a **number** is read as a\n uniform wall thickness, `[width, depth]` as an explicit inner size.\n- `height` - Height of the tube (z = 0 .. height)\n- `segments` - Number of circular segments; omitted, the shared segment\n policy of the outer radius. For a rectangle this slot is the options object\n instead:\n - `cornerRadius` - outer corner radius (default 0, i.e. sharp)\n - `innerCornerRadius` - defaults to `cornerRadius - wall`, keeping the wall\n uniform around the corner\n - `segments` - segments per full circle for the corner arcs; omitted, the\n shared segment policy of the outer corner radius\n - `center` - center the extrusion on z instead of starting at z = 0\n\n---",
|
|
148
165
|
"examples": [
|
|
149
166
|
"// Round: 10mm outer radius, 8mm inner radius, 30mm tall\nconst pipe = tube(10, 8, 30, 32);\n\n// Rectangular 40 x 20, uniform 2.5mm wall, 60mm tall\nconst box = tube([40, 20], 2.5, 60);\n\n// Explicit inner size, and rounded corners (the wall stays uniform round them)\nconst a = tube([40, 20], [30, 10], 60);\nconst b = tube([40, 20], 2.5, 60, { cornerRadius: 4 });\n\n// Square tube, 3mm wall\nconst sq = rectTube(30, 3, 20);"
|
|
150
167
|
]
|
|
@@ -193,14 +210,14 @@
|
|
|
193
210
|
}
|
|
194
211
|
],
|
|
195
212
|
"description": "mirror(manifold, plane, keepOriginal, { bodies }) — reflect one body, or the whole solid. plane is 'xy', 'xz', or 'yz' (through the origin) or { center, normal } (a workplane or a planar face). { normal, originOffset } is the same plane. keepOriginal unions the copy with that ...",
|
|
196
|
-
"doc": "Mirrors a manifold across a plane. A named body is mirrored on its own; every other body stays. With no `bodies`, the whole solid is mirrored (older scripts).\n\n\n\n**Parameters:**\n- `manifold` - The manifold to mirror\n- `plane` - `'xy'`, `'xz'`, or `'yz'` (through the origin), or `{ center, normal }` for a workplane or a planar face. `{ normal, originOffset }` is the same plane.\n- `keepOriginal` - If true, unions the copy with the original (default: true). A third argument that is an object is `opts`, and the copy is kept.\n- `opts.bodies` - One body, `{ at }` its centroid, the same point `move()` uses. Overlap throws instead of dropping the original.\n\n---",
|
|
213
|
+
"doc": "Mirrors a manifold across a plane. A named body (`{ bodies: [{ body: [features] }] }`, or the legacy centroid `{ at }`) is mirrored on its own; every other body stays. With no `bodies`, the whole solid is mirrored (older scripts). With the original kept, the reflected copy is its own body named after this feature (`mirror1`, faces `mirror1.cube1.top`); without it, the reflected solid is the source body moved and keeps its names ([B-REP_METADATA.md](../B-REP_METADATA.md), bodies).\n\n\n\n**Parameters:**\n- `manifold` - The manifold to mirror\n- `plane` - `'xy'`, `'xz'`, or `'yz'` (through the origin), or `{ center, normal }` for a workplane or a planar face. `{ normal, originOffset }` is the same plane.\n- `keepOriginal` - If true, unions the copy with the original (default: true). A third argument that is an object is `opts`, and the copy is kept.\n- `opts.bodies` - One body, `{ at }` its centroid, the same point `move()` uses. Overlap throws instead of dropping the original.\n\n---",
|
|
197
214
|
"examples": [
|
|
198
215
|
"// Symmetric part across the YZ plane through the origin\nconst half = Manifold.cube([20, 10, 10]);\nconst full = mirror(half, 'yz', true);\nreturn full;\n\n// One body across a workplane, keeping the original\npart = mirror(part, { center: [30, 0, 0], normal: [1, 0, 0] }, true, { bodies: [{ at: [20, 0, 0] }] });"
|
|
199
216
|
]
|
|
200
217
|
},
|
|
201
218
|
{
|
|
202
219
|
"name": "array3D",
|
|
203
|
-
"signature": "array3D(manifold, counts, spacing)",
|
|
220
|
+
"signature": "array3D(manifold, counts, spacing, opts = {})",
|
|
204
221
|
"params": [
|
|
205
222
|
{
|
|
206
223
|
"name": "manifold",
|
|
@@ -213,17 +230,22 @@
|
|
|
213
230
|
{
|
|
214
231
|
"name": "spacing",
|
|
215
232
|
"text": "spacing"
|
|
233
|
+
},
|
|
234
|
+
{
|
|
235
|
+
"name": "opts",
|
|
236
|
+
"text": "opts = {}",
|
|
237
|
+
"default": "{}"
|
|
216
238
|
}
|
|
217
239
|
],
|
|
218
240
|
"description": "Create an array/grid of manifolds",
|
|
219
|
-
"doc": "Creates a 3D rectangular array of copies.\n\n\n\n**Parameters:**\n- `manifold` - The manifold to array\n- `counts` - [nx, ny, nz] number of copies in each direction\n- `spacing` - [dx, dy, dz] spacing between copies\n\n---",
|
|
241
|
+
"doc": "Creates a 3D rectangular array of copies. The original keeps its names; copy\nk is its own body named after this feature, `array1[k]` (k from 1), with the\nsource roles folded into its face names (`array1[2].cube1.top`), so\n`{ body: ['array1[2]'] }` names one copy and a boolean after the array still\ntells copy from original ([B-REP_METADATA.md](../B-REP_METADATA.md), bodies).\n\n\n\n**Parameters:**\n- `manifold` - The manifold to array\n- `counts` - [nx, ny, nz] number of copies in each direction\n- `spacing` - [dx, dy, dz] spacing between copies\n- `opts.bodies` - `[{ body: [features] }]` (or `[{ at }]`): array one body of a multi-body part and leave the others where they are; omit it to array the whole solid. The Array card's Body tab writes this.\n\n---",
|
|
220
242
|
"examples": [
|
|
221
243
|
"// Create a 3x3x2 grid of cubes\nconst cube = Manifold.cube([5, 5, 5], true);\nconst grid = array3D(cube, [3, 3, 2], [10, 10, 10]);\nreturn grid;"
|
|
222
244
|
]
|
|
223
245
|
},
|
|
224
246
|
{
|
|
225
247
|
"name": "polarArray",
|
|
226
|
-
"signature": "polarArray(manifold, count, radius = 0, axis = 'z')",
|
|
248
|
+
"signature": "polarArray(manifold, count, radius = 0, axis = 'z', opts = {})",
|
|
227
249
|
"params": [
|
|
228
250
|
{
|
|
229
251
|
"name": "manifold",
|
|
@@ -242,10 +264,15 @@
|
|
|
242
264
|
"name": "axis",
|
|
243
265
|
"text": "axis = 'z'",
|
|
244
266
|
"default": "'z'"
|
|
267
|
+
},
|
|
268
|
+
{
|
|
269
|
+
"name": "opts",
|
|
270
|
+
"text": "opts = {}",
|
|
271
|
+
"default": "{}"
|
|
245
272
|
}
|
|
246
273
|
],
|
|
247
274
|
"description": "Copies of a solid equally spaced around an axis, offset perpendicular to that axis (+Y for x, +X for y and z), without keeping the input as an extra body.",
|
|
248
|
-
"doc": "Copies a solid equally spaced around an axis. The radius offset is perpendicular to that axis (+Y when the axis is x, +X for y and z) so the copies orbit; radius 0 leaves every copy on the axis. The result is only those copies. The input solid is not kept as an extra body
|
|
275
|
+
"doc": "Copies a solid equally spaced around an axis. The radius offset is perpendicular to that axis (+Y when the axis is x, +X for y and z) so the copies orbit; radius 0 leaves every copy on the axis. The result is only those copies. The input solid is not kept as an extra body. Copy 0 is the source body on its orbit and keeps its names; copy i is its own body `array1[i]` with the source roles folded into its face names.\n\n`insert_polar_array` writes this call to copy a body around an axis (`boltCircleRadius` defaults to 0, on the axis). For a bolt circle of holes, use the Hole card with `hole_centres_polar` (`holesOnContour`).\n\n\n\n**Parameters:**\n- `manifold` - The manifold to array\n- `count` - Number of copies\n- `radius` - Orbit radius. 0 leaves the copies on the axis. The offset is perpendicular to `axis`\n- `axis` - Rotation axis: 'x', 'y', or 'z' (default: 'z')\n- `opts.bodies` - `[{ body: [features] }]`: orbit one body of a multi-body part; the others stay. Omit it for the whole solid.\n\n---",
|
|
249
276
|
"examples": [
|
|
250
277
|
"// Create 6 cylinders in a circle\nconst cylinder = Manifold.cylinder(20, 5, 5, 32);\nconst circle = polarArray(cylinder, 6, 30, 'z');\nreturn circle;"
|
|
251
278
|
]
|
|
@@ -269,14 +296,14 @@
|
|
|
269
296
|
}
|
|
270
297
|
],
|
|
271
298
|
"description": "Pattern on points: one copy of `manifold` at every point, turned so its `up` axis follows the point's `axis` when the point has one. ",
|
|
272
|
-
"doc": "One copy of the body at every point, turned so its `up` axis follows the point's `axis` when the point has one. The hardware helper: a bolt onto the hole centers and axes of the part it fastens.\n\n\n\n**Parameters:**\n- `manifold` - The body to copy (one instance)\n- `points` - Array of `[x, y, z]` or `{ at: [x, y, z], axis?: [nx, ny, nz] }` in mm; a point with no axis is a plain translate\n- `opts.up` - The body axis that follows each point's axis (default `[0, 0, 1]`)\n- `opts.keepOriginal` - Also keep the source where it is (default `false`)\n- `opts.merge` - Union the copies (default `true`); `false` composes them as separate bodies\n\nThrows a plain error on an empty list, a point that is not three numbers, or a zero axis. The palette item is **Points** (`patternPoints`, Array Type=Points); the agent tool is `insert_pattern_points { points, up?, keepOriginal?, merge? }`.\n\n---",
|
|
299
|
+
"doc": "One copy of the body at every point, turned so its `up` axis follows the point's `axis` when the point has one. The hardware helper: a bolt onto the hole centers and axes of the part it fastens. Each placed copy is its own body named after this feature, `array1[k]` (k from 1 in point order); a kept original (`keepOriginal: true`) keeps its own names.\n\n\n\n**Parameters:**\n- `manifold` - The body to copy (one instance)\n- `points` - Array of `[x, y, z]` or `{ at: [x, y, z], axis?: [nx, ny, nz] }` in mm; a point with no axis is a plain translate\n- `opts.up` - The body axis that follows each point's axis (default `[0, 0, 1]`)\n- `opts.keepOriginal` - Also keep the source where it is (default `false`)\n- `opts.merge` - Union the copies (default `true`); `false` composes them as separate bodies\n- `opts.bodies` - `[{ body: [features] }]`: pattern one body of a multi-body part; the others stay. Omit it for the whole solid.\n\nThrows a plain error on an empty list, a point that is not three numbers, or a zero axis. The palette item is **Points** (`patternPoints`, Array Type=Points); the agent tool is `insert_pattern_points { points, up?, keepOriginal?, merge? }`.\n\n---",
|
|
273
300
|
"examples": [
|
|
274
301
|
"// Four bolts, one per hole; each hole gives its center and axis\nconst bolt = Manifold.cylinder(12, 2.5, 2.5, 24);\nlet part = patternOnPoints(bolt, [\n { at: [-20, -15, 6], axis: [0, 0, 1] },\n { at: [20, -15, 6], axis: [0, 0, 1] },\n { at: [-20, 15, 6], axis: [0, 0, 1] },\n { at: [20, 15, 6], axis: [0, 0, 1] },\n], { up: [0, 0, 1] });\nreturn part;"
|
|
275
302
|
]
|
|
276
303
|
},
|
|
277
304
|
{
|
|
278
305
|
"name": "center",
|
|
279
|
-
"signature": "center(manifold, axes = [true, true, true])",
|
|
306
|
+
"signature": "center(manifold, axes = [true, true, true], opts = {})",
|
|
280
307
|
"params": [
|
|
281
308
|
{
|
|
282
309
|
"name": "manifold",
|
|
@@ -286,10 +313,15 @@
|
|
|
286
313
|
"name": "axes",
|
|
287
314
|
"text": "axes = [true, true, true]",
|
|
288
315
|
"default": "[true, true, true]"
|
|
316
|
+
},
|
|
317
|
+
{
|
|
318
|
+
"name": "opts",
|
|
319
|
+
"text": "opts = {}",
|
|
320
|
+
"default": "{}"
|
|
289
321
|
}
|
|
290
322
|
],
|
|
291
323
|
"description": "Center a manifold at origin",
|
|
292
|
-
"doc": "Centers a manifold at the origin.\n\n\n\n**Parameters:**\n- `manifold` - The manifold to center\n- `axes` - [centerX, centerY, centerZ] which axes to center (default: all true)\n\n---",
|
|
324
|
+
"doc": "Centers a manifold at the origin. `opts.bodies` (`[{ body: [features] }]`) centers one body of a multi-body part and leaves the others where they are; the Center card's Body tab writes it.\n\n\n\n**Parameters:**\n- `manifold` - The manifold to center\n- `axes` - [centerX, centerY, centerZ] which axes to center (default: all true)\n\n---",
|
|
293
325
|
"examples": [
|
|
294
326
|
"// Center on all axes\nconst box = Manifold.cube([20, 30, 10]);\nconst centered = center(box, [true, true, true]);\nreturn centered;\n\n// Center only on X and Y\nconst partCentered = center(box, [true, true, false]);"
|
|
295
327
|
]
|
|
@@ -309,7 +341,7 @@
|
|
|
309
341
|
}
|
|
310
342
|
],
|
|
311
343
|
"description": "Align a manifold to a specific position",
|
|
312
|
-
"doc": "Aligns a manifold to a specific position.\n\n\n\n**Parameters:**\n- `manifold` - The manifold to align\n- `options.min` - [x, y, z] align min bounds (use undefined to skip)\n- `options.max` - [x, y, z] align max bounds\n- `options.center` - [x, y, z] align center\n\n---",
|
|
344
|
+
"doc": "Aligns a manifold to a specific position.\n\n\n\n**Parameters:**\n- `manifold` - The manifold to align\n- `options.min` - [x, y, z] align min bounds (use undefined to skip)\n- `options.max` - [x, y, z] align max bounds\n- `options.center` - [x, y, z] align center\n- `options.bodies` - `[{ body: [features] }]`: align one body of a multi-body part; the others stay. The Align card's Body tab writes it.\n\n---",
|
|
313
345
|
"examples": [
|
|
314
346
|
"// Align min-Z to the origin\nconst box = Manifold.cube([20, 20, 20], true);\nconst aligned = align(box, { min: [undefined, undefined, 0] });\nreturn aligned;\n\n// Center on X, align max-Y to 50\nconst positioned = align(box, { \n center: [0, undefined, undefined],\n max: [undefined, 50, undefined]\n});"
|
|
315
347
|
]
|
|
@@ -349,7 +381,7 @@
|
|
|
349
381
|
}
|
|
350
382
|
],
|
|
351
383
|
"description": "Add draft angle to a manifold — every side wall, true constant angle. ",
|
|
352
|
-
"doc": "Tilts the faces you select by a **true constant angle**, pivoting about where\neach face meets a reference plane. Essential for injection moulding and casting,\nwhere parts must release from the mould.\n\n`addDraft` is the whole-part form (every side wall, bottom stays put);\n`draftFaces` lets you name the faces, the pull direction, the reference plane and\nthe sign. The angle now comes out the same on every wall — the pre-2026 taper\nscaled perpendicular coordinates, so only the narrowest wall hit the requested\nangle.\n\n\n\n**Parameters:**\n- `manifold` - The manifold to draft\n- `faces` - which faces tilt: a viewport pick `{center, normal}`, a face from\n `facesByNormal()
|
|
384
|
+
"doc": "Tilts the faces you select by a **true constant angle**, pivoting about where\neach face meets a reference plane. Essential for injection moulding and casting,\nwhere parts must release from the mould.\n\n`addDraft` is the whole-part form (every side wall, bottom stays put);\n`draftFaces` lets you name the faces, the pull direction, the reference plane and\nthe sign. The angle now comes out the same on every wall — the pre-2026 taper\nscaled perpendicular coordinates, so only the narrowest wall hit the requested\nangle.\n\n\n\n**Parameters:**\n- `manifold` - The manifold to draft\n- `faces` - which faces tilt: a viewport pick `{center, normal}`, a face from\n `facesByNormal()` or `facesNamed()` (a curved named face such as a cylinder\n wall is drafted facet by facet: `[...facesNamed(part, 'cyl1.side')]`), a\n signed axis like `'-x'`, `'sides'` for every side wall, or an array mixing\n those. A bare `{center, normal}` whose centre is on no triangle of the body\n (the axis point of a curved face) throws; pass the face by name instead\n- `angleDeg` - **signed** draft angle in degrees. Positive tapers inward going\n along the pull (the usual mould-release sense); negative flares outward.\n Typical: 1-2° for smooth surfaces, 3-5° for textured.\n- `opts.pull` - pull / draw direction (default `'z'`; accepts `'-z'`, `[x,y,z]`)\n- `opts.reference` - the neutral plane that does not move: `'min'` (default),\n `'mid'`, `'max'` along the pull, a number (coordinate along pull), or a\n face / plane whose center defines it\n- `opts.sense` - `'taper'` makes every selected wall lean the same way round the\n pull axis, so a hollow part keeps its wall thickness; `'face'` honours each\n face's own outward normal, which is the mould-core sense on a cavity wall.\n Defaults to `'taper'` for `'sides'` and `'face'` for named faces.\n\n**Returns:** The drafted manifold\n\n**Notes:**\n- Drafting a face perpendicular to the pull (a cap) throws — it has no direction\n to tilt in. Pick the side walls, or change `opts.pull`.\n- Vertices shared by two selected faces are solved once against both, so drafted\n corners stay sharp instead of doubling up.\n- An angle the body cannot take throws instead of returning a folded solid.\n- A fillet or chamfer between the neutral plane and a selected wall is not\n drafted. The wall hinges on the blend tangency, so the fillet endpoint stays\n on that line and the requested angle is the wall's angle from there. This\n holds when the blend was part of the selection (`'sides'` after a fillet):\n those facets are not tilted as their own planes, and the face names from\n before the draft (`cube1.top`, `fillet1.round`) stay.\n\n---",
|
|
353
385
|
"examples": [
|
|
354
386
|
"// Whole part: 2° on every side wall, bottom fixed\nconst box = Manifold.cube([60, 20, 30], false);\nreturn addDraft(hollow(box, 2, 'z'), 2, 'z');\n\n// One picked face, pivoting about the top instead of the bottom\nlet part = Manifold.cube([60, 20, 30], false);\npart = draftFaces(part, facesByNormal(part, [1, 0, 0])[0], 3,\n { pull: 'z', reference: 'max' });\n\n// Several faces at once (what a shift-click multi-pick emits), flaring outward\npart = draftFaces(part, [\n { center: [60, 10, 15], normal: [1, 0, 0] },\n { center: [0, 10, 15], normal: [-1, 0, 0] },\n], -3, { pull: 'z', reference: 'min' });"
|
|
355
387
|
]
|
|
@@ -377,7 +409,7 @@
|
|
|
377
409
|
}
|
|
378
410
|
],
|
|
379
411
|
"description": "draftFaces(manifold, faces, angleDeg, opts) — tilt the selected faces by a true constant angle about their intersection with a reference plane. ",
|
|
380
|
-
"doc": "Tilts the faces you select by a **true constant angle**, pivoting about where\neach face meets a reference plane. Essential for injection moulding and casting,\nwhere parts must release from the mould.\n\n`addDraft` is the whole-part form (every side wall, bottom stays put);\n`draftFaces` lets you name the faces, the pull direction, the reference plane and\nthe sign. The angle now comes out the same on every wall — the pre-2026 taper\nscaled perpendicular coordinates, so only the narrowest wall hit the requested\nangle.\n\n\n\n**Parameters:**\n- `manifold` - The manifold to draft\n- `faces` - which faces tilt: a viewport pick `{center, normal}`, a face from\n `facesByNormal()
|
|
412
|
+
"doc": "Tilts the faces you select by a **true constant angle**, pivoting about where\neach face meets a reference plane. Essential for injection moulding and casting,\nwhere parts must release from the mould.\n\n`addDraft` is the whole-part form (every side wall, bottom stays put);\n`draftFaces` lets you name the faces, the pull direction, the reference plane and\nthe sign. The angle now comes out the same on every wall — the pre-2026 taper\nscaled perpendicular coordinates, so only the narrowest wall hit the requested\nangle.\n\n\n\n**Parameters:**\n- `manifold` - The manifold to draft\n- `faces` - which faces tilt: a viewport pick `{center, normal}`, a face from\n `facesByNormal()` or `facesNamed()` (a curved named face such as a cylinder\n wall is drafted facet by facet: `[...facesNamed(part, 'cyl1.side')]`), a\n signed axis like `'-x'`, `'sides'` for every side wall, or an array mixing\n those. A bare `{center, normal}` whose centre is on no triangle of the body\n (the axis point of a curved face) throws; pass the face by name instead\n- `angleDeg` - **signed** draft angle in degrees. Positive tapers inward going\n along the pull (the usual mould-release sense); negative flares outward.\n Typical: 1-2° for smooth surfaces, 3-5° for textured.\n- `opts.pull` - pull / draw direction (default `'z'`; accepts `'-z'`, `[x,y,z]`)\n- `opts.reference` - the neutral plane that does not move: `'min'` (default),\n `'mid'`, `'max'` along the pull, a number (coordinate along pull), or a\n face / plane whose center defines it\n- `opts.sense` - `'taper'` makes every selected wall lean the same way round the\n pull axis, so a hollow part keeps its wall thickness; `'face'` honours each\n face's own outward normal, which is the mould-core sense on a cavity wall.\n Defaults to `'taper'` for `'sides'` and `'face'` for named faces.\n\n**Returns:** The drafted manifold\n\n**Notes:**\n- Drafting a face perpendicular to the pull (a cap) throws — it has no direction\n to tilt in. Pick the side walls, or change `opts.pull`.\n- Vertices shared by two selected faces are solved once against both, so drafted\n corners stay sharp instead of doubling up.\n- An angle the body cannot take throws instead of returning a folded solid.\n- A fillet or chamfer between the neutral plane and a selected wall is not\n drafted. The wall hinges on the blend tangency, so the fillet endpoint stays\n on that line and the requested angle is the wall's angle from there. This\n holds when the blend was part of the selection (`'sides'` after a fillet):\n those facets are not tilted as their own planes, and the face names from\n before the draft (`cube1.top`, `fillet1.round`) stay.\n\n---",
|
|
381
413
|
"examples": [
|
|
382
414
|
"// Whole part: 2° on every side wall, bottom fixed\nconst box = Manifold.cube([60, 20, 30], false);\nreturn addDraft(hollow(box, 2, 'z'), 2, 'z');\n\n// One picked face, pivoting about the top instead of the bottom\nlet part = Manifold.cube([60, 20, 30], false);\npart = draftFaces(part, facesByNormal(part, [1, 0, 0])[0], 3,\n { pull: 'z', reference: 'max' });\n\n// Several faces at once (what a shift-click multi-pick emits), flaring outward\npart = draftFaces(part, [\n { center: [60, 10, 15], normal: [1, 0, 0] },\n { center: [0, 10, 15], normal: [-1, 0, 0] },\n], -3, { pull: 'z', reference: 'min' });"
|
|
383
415
|
]
|
|
@@ -401,7 +433,7 @@
|
|
|
401
433
|
}
|
|
402
434
|
],
|
|
403
435
|
"description": "cut(manifold, plane, opts) — split one or more bodies with a plane, then optionally delete pieces. ",
|
|
404
|
-
"doc": "Splits every selected body with a plane, then optionally deletes pieces. The\ncut is Manifold's `splitByPlane`: the `'+'` piece is the side the normal\npoints to, and `'-'` is the other side. Pieces you keep stay separate bodies\n(`decompose()` returns them one by one). A body that does not cross the plane\nis left alone — same solid, same volume, still one body
|
|
436
|
+
"doc": "Splits every selected body with a plane, then optionally deletes pieces. The\ncut is Manifold's `splitByPlane`: the `'+'` piece is the side the normal\npoints to, and `'-'` is the other side. Pieces you keep stay separate bodies\n(`decompose()` returns them one by one). A body that does not cross the plane\nis left alone — same solid, same volume, still one body. `bodies` names each\nbody to cut by its features (`{ body: ['cylinder1', 'shell1'] }`, see\n`bodyFeatures`) or by the legacy centroid `{ at }`; `drop` pieces stay\n`{ at, side }`.\n\n\n\n**Parameters:**\n- `manifold` - The solid, or several solids grouped by `Manifold.compose`\n- `plane` - a face `{ center, normal }`, or an explicit `{ normal, originOffset }`.\n `offset` on a face is added along the normal (positive in the normal\n direction). Offset 0 is omitted and the call stays `{ center, normal }`.\n A world-axis name such as `'z'` is rejected.\n- `opts.keep` - `'both'` (default), `'+'`, or `'-'`\n- `opts.bodies` - which bodies to cut, each `{ body: [features] }` or `{ at }`\n near that body's centroid (`tri`, a triangle of the body, tells apart two\n bodies that share a centroid). Omit to cut every body. Bodies you skip are\n unchanged.\n- `opts.drop` - pieces to delete when you are not dropping a whole side:\n `{ at, side: '+' | '-' }`\n\n**Returns:** The kept pieces. One piece is that solid. Several pieces are one\ncomposed manifold whose `decompose()` length is the number of pieces.\n\n**Notes:**\n- A body that only touches the plane is not cut.\n- Deleting every piece throws.\n- Pass `keep` or `drop`, not both.\n\n---",
|
|
405
437
|
"examples": [
|
|
406
438
|
"// Mid plane z = 0, keep both halves\nlet part = Manifold.cube([40, 30, 20], true);\npart = cut(part, { normal: [0, 0, 1], originOffset: 0 });\n\n// Same cut, keep only the +Z half\npart = cut(part, { normal: [0, 0, 1], originOffset: 0 }, { keep: '+' });\n\n// The plane is the face you picked — not a guessed world axis.\n// Offset 0 keeps this shape. A nonzero offset is along the face normal.\npart = cut(part, { center: [0, 0, 10], normal: [0, 0, 1] });\npart = cut(part, { center: [0, 0, 10], normal: [0, 0, 1], offset: -10 });"
|
|
407
439
|
]
|
|
@@ -498,7 +530,7 @@
|
|
|
498
530
|
}
|
|
499
531
|
],
|
|
500
532
|
"description": "rotateAbout(manifold, axis, angleDeg, center, { bodies: [{ at }] }) — turn one body. ",
|
|
501
|
-
"doc": "Turns one body by `angleDeg` degrees (right-hand rule) about the line through `center` along `axis`. `axis` is `'x'`, `'y'`, `'z'` (a leading `-` flips it) or a vector `[ax, ay, az]`. `center` is `[x, y, z]` in mm, or `null` for that body's own vertex centroid. The body is named the way `move()` names it: `{ bodies: [{
|
|
533
|
+
"doc": "Turns one body by `angleDeg` degrees (right-hand rule) about the line through `center` along `axis`. `axis` is `'x'`, `'y'`, `'z'` (a leading `-` flips it) or a vector `[ax, ay, az]`. `center` is `[x, y, z]` in mm, or `null` for that body's own vertex centroid. The body is named the way `move()` names it: `{ bodies: [{ body: ['cylinder1', 'shell1'] }] }`, the features with faces on it (`bodyFeatures(part)`, `list_bodies`), or the legacy centroid `{ at }` from the Rotate card's double-click. The named body turns; every other body stays. Volume is unchanged and the bounding box follows the turn. A zero angle returns the input. The Rotate button (below Move) writes this call inside `// --- rotate begin --- / end ---` markers, so the strip shows a Rotate chip with edit, delete, and undo.\n\n\n\nA point that is not a body centroid, a zero-length axis, or a missing `bodies` entry throws with a `rotateAbout:` message.",
|
|
502
534
|
"examples": [
|
|
503
535
|
"part = rotateAbout(part, 'z', 90, null, { bodies: [{ at: [40, 0, 0] }] }); // quarter turn about its own centre\npart = rotateAbout(part, [0, 1, 0], -15, [0, 0, 10], { bodies: [{ at: [40, 0, 0] }] }); // about a line through [0, 0, 10]"
|
|
504
536
|
]
|
|
@@ -624,7 +656,7 @@
|
|
|
624
656
|
}
|
|
625
657
|
],
|
|
626
658
|
"description": "Sweep a 2D profile along a 3D path Creates a 3D manifold by extruding a cross-section profile along a parametric path curve. ",
|
|
627
|
-
"doc": "Sweeps a 2D cross-section along a parametric 3D path using Frenet-Serret frames.\n\n\n**Parameters:**\n- `profile` - CrossSection to sweep (should be centered at origin)\n- `path` - Parametric path object:\n - `position(t)` - Function returning [x, y, z] at parameter t (required)\n - `derivative(t)` - Function returning first derivative (optional, computed numerically if omitted)\n - `secondDerivative(t)` - Function returning second derivative (optional)\n - `tMin` - Start parameter (default: 0)\n - `tMax` - End parameter (default: 1)\n- `options` - Optional settings:\n - `arcSamples` - Samples for arc-length table (default: 1000)\n - `extrudeSegments` - Segments along extrusion (default: 64)\n - `epsilon` - Delta for numerical derivatives (default: 1e-5)\n\n**Example - Trefoil Knot:**\n\n\n---",
|
|
659
|
+
"doc": "Sweeps a 2D cross-section along a parametric 3D path using Frenet-Serret frames.\n\n\n**Parameters:**\n- `profile` - CrossSection to sweep (should be centered at origin)\n- `path` - Parametric path object:\n - `position(t)` - Function returning [x, y, z] at parameter t (required)\n - `derivative(t)` - Function returning first derivative (optional, computed numerically if omitted)\n - `secondDerivative(t)` - Function returning second derivative (optional)\n - `tMin` - Start parameter (default: 0)\n - `tMax` - End parameter (default: 1)\n- `options` - Optional settings:\n - `arcSamples` - Samples for arc-length table (default: 1000)\n - `extrudeSegments` - Segments along extrusion (default: 64)\n - `epsilon` - Delta for numerical derivatives (default: 1e-5)\n - `twist` - Degrees about the path tangent. The profile origin is the\n point that rides the path, in the sweep's rotation-minimizing frame.\n The angle is 0 at the start and the full twist at the end of the arc\n length. Omit it, or pass 0, and the sweep is unchanged. A twist adds\n segments along the path, capped so a multi-turn sweep stays cheap,\n and a bad or empty result throws.\n\n**Example - Trefoil Knot:**\n\n\n---",
|
|
628
660
|
"examples": [
|
|
629
661
|
"// Sweep a circle along a helix\nconst profile = CrossSection.circle(2, 32);\nconst helix = {\n position: (t) => [20 * Math.cos(t), 20 * Math.sin(t), 5 * t],\n tMin: 0,\n tMax: 4 * Math.PI\n};\nreturn sweep(profile, helix);",
|
|
630
662
|
"const scale = 5;\nconst profile = CrossSection.circle(1, 32);\nconst trefoil = {\n position: (t) => [\n scale * (Math.sin(t) + 2 * Math.sin(2 * t)),\n scale * (Math.cos(t) - 2 * Math.cos(2 * t)),\n scale * (-Math.sin(3 * t))\n ],\n derivative: (t) => [\n scale * (Math.cos(t) + 4 * Math.cos(2 * t)),\n scale * (-Math.sin(t) + 4 * Math.sin(2 * t)),\n scale * (-3 * Math.cos(3 * t))\n ],\n tMin: 0,\n tMax: 2 * Math.PI\n};\nreturn sweep(profile, trefoil, { arcSamples: 2000, extrudeSegments: 128 });"
|
|
@@ -649,7 +681,7 @@
|
|
|
649
681
|
}
|
|
650
682
|
],
|
|
651
683
|
"description": "Sweep a profile along a path defined by an array of points Convenience wrapper for sweep() that accepts a polyline path. ",
|
|
652
|
-
"doc": "Sweeps a profile along a path defined by an array of points using Catmull-Rom spline interpolation.\n\n\n**Parameters:**\n- `profile` - CrossSection to sweep\n- `points` - Array of [x, y, z] coordinates defining the path (minimum 2 points)\n- `options` - Optional settings:\n - `closed` - If true, creates a closed loop (default: false)\n - Plus all options from `sweep()`\n\n**Example - Closed Loop:**\n\n\n---",
|
|
684
|
+
"doc": "Sweeps a profile along a path defined by an array of points using Catmull-Rom spline interpolation.\n\n\n**Parameters:**\n- `profile` - CrossSection to sweep\n- `points` - Array of [x, y, z] coordinates defining the path (minimum 2 points)\n- `options` - Optional settings:\n - `closed` - If true, creates a closed loop (default: false)\n - Plus all options from `sweep()`\n\n**Faces** (`sweep` and `sweepPoints`): `cap0` and `cap1` on the path's end\nplanes and `wall[g]`, one per edge of the profile. A profile made from a\n`solveContour` result (`new CrossSection(sketch.contours)`, as the Sweep card\nwrites it) has one wall per sketch entity: an arc is one wall, whatever its\nsegment count, with `profileArc` on its `swept` record. Its points come back\nfrom the CrossSection a few nanometres off, and are matched to the sketch's\nwithin 1e-6 mm.\n\n**Example - Closed Loop:**\n\n\n---",
|
|
653
685
|
"examples": [
|
|
654
686
|
"// Sweep along a curved path\nconst profile = CrossSection.circle(2, 16);\nconst points = [\n [0, 0, 0],\n [20, 10, 0],\n [40, 0, 20],\n [60, -10, 20],\n [80, 0, 0]\n];\nreturn sweepPoints(profile, points);",
|
|
655
687
|
"const profile = CrossSection.square([3, 3], true);\nconst ring = [\n [30, 0, 0],\n [0, 30, 10],\n [-30, 0, 0],\n [0, -30, 10]\n];\nreturn sweepPoints(profile, ring, { closed: true });"
|
|
@@ -951,41 +983,6 @@
|
|
|
951
983
|
"const fr = workplaneFromFace(part, facesByNormal(part, [0,0,1])[0]);\nconst rib = placeOnFace(part, fr, ({ put, Manifold }) =>\n put(Manifold.cube([40, 4, 6], true), [0, 0, -3]));\nreturn Manifold.union(part, rib);"
|
|
952
984
|
]
|
|
953
985
|
},
|
|
954
|
-
{
|
|
955
|
-
"name": "hole",
|
|
956
|
-
"signature": "hole(part, frame, u, v, dia, span)",
|
|
957
|
-
"params": [
|
|
958
|
-
{
|
|
959
|
-
"name": "part",
|
|
960
|
-
"text": "part"
|
|
961
|
-
},
|
|
962
|
-
{
|
|
963
|
-
"name": "frame",
|
|
964
|
-
"text": "frame"
|
|
965
|
-
},
|
|
966
|
-
{
|
|
967
|
-
"name": "u",
|
|
968
|
-
"text": "u"
|
|
969
|
-
},
|
|
970
|
-
{
|
|
971
|
-
"name": "v",
|
|
972
|
-
"text": "v"
|
|
973
|
-
},
|
|
974
|
-
{
|
|
975
|
-
"name": "dia",
|
|
976
|
-
"text": "dia"
|
|
977
|
-
},
|
|
978
|
-
{
|
|
979
|
-
"name": "span",
|
|
980
|
-
"text": "span"
|
|
981
|
-
}
|
|
982
|
-
],
|
|
983
|
-
"description": "hole(part, frame, u, v, dia, span) — cut a round hole through `part`. frame from workplaneFromFace; (u,v) local coords (mm), span = cut length along the outward normal from the face (use holeSpan() for full thickness). ",
|
|
984
|
-
"doc": "hole(part, frame, u, v, dia, span) — cut a round hole through `part`.\nframe from workplaneFromFace; (u,v) local coords (mm), span = cut length\nalong the outward normal from the face (use holeSpan() for full thickness).\nReturns the cut part.",
|
|
985
|
-
"examples": [
|
|
986
|
-
"const fr = workplaneFromFace(part, facesByNormal(part, [0,0,1])[0]);\npart = hole(part, fr, 10, 5, 6, holeSpan(part, fr));"
|
|
987
|
-
]
|
|
988
|
-
},
|
|
989
986
|
{
|
|
990
987
|
"name": "holeSpan",
|
|
991
988
|
"signature": "holeSpan(part, frame)",
|
|
@@ -1003,88 +1000,6 @@
|
|
|
1003
1000
|
"doc": "holeSpan(part, frame) — full extent of the part measured along the frame\nnormal (both directions from the face plane) + 2mm overshoot. A safe\nfull-through cut length from that face.",
|
|
1004
1001
|
"examples": []
|
|
1005
1002
|
},
|
|
1006
|
-
{
|
|
1007
|
-
"name": "cboreHole",
|
|
1008
|
-
"signature": "cboreHole(part, frame, u, v, diaThru, diaCbore, cboreDepth, span)",
|
|
1009
|
-
"params": [
|
|
1010
|
-
{
|
|
1011
|
-
"name": "part",
|
|
1012
|
-
"text": "part"
|
|
1013
|
-
},
|
|
1014
|
-
{
|
|
1015
|
-
"name": "frame",
|
|
1016
|
-
"text": "frame"
|
|
1017
|
-
},
|
|
1018
|
-
{
|
|
1019
|
-
"name": "u",
|
|
1020
|
-
"text": "u"
|
|
1021
|
-
},
|
|
1022
|
-
{
|
|
1023
|
-
"name": "v",
|
|
1024
|
-
"text": "v"
|
|
1025
|
-
},
|
|
1026
|
-
{
|
|
1027
|
-
"name": "diaThru",
|
|
1028
|
-
"text": "diaThru"
|
|
1029
|
-
},
|
|
1030
|
-
{
|
|
1031
|
-
"name": "diaCbore",
|
|
1032
|
-
"text": "diaCbore"
|
|
1033
|
-
},
|
|
1034
|
-
{
|
|
1035
|
-
"name": "cboreDepth",
|
|
1036
|
-
"text": "cboreDepth"
|
|
1037
|
-
},
|
|
1038
|
-
{
|
|
1039
|
-
"name": "span",
|
|
1040
|
-
"text": "span"
|
|
1041
|
-
}
|
|
1042
|
-
],
|
|
1043
|
-
"description": "cboreHole(part, frame, u, v, diaThru, diaCbore, cboreDepth, span) — through hole + larger counterbore from the face. ",
|
|
1044
|
-
"doc": "cboreHole(part, frame, u, v, diaThru, diaCbore, cboreDepth, span)\n— through hole + larger counterbore from the face. (CadQuery cboreHole)",
|
|
1045
|
-
"examples": []
|
|
1046
|
-
},
|
|
1047
|
-
{
|
|
1048
|
-
"name": "cskHole",
|
|
1049
|
-
"signature": "cskHole(part, frame, u, v, diaThru, diaCsk, cskDepth, span)",
|
|
1050
|
-
"params": [
|
|
1051
|
-
{
|
|
1052
|
-
"name": "part",
|
|
1053
|
-
"text": "part"
|
|
1054
|
-
},
|
|
1055
|
-
{
|
|
1056
|
-
"name": "frame",
|
|
1057
|
-
"text": "frame"
|
|
1058
|
-
},
|
|
1059
|
-
{
|
|
1060
|
-
"name": "u",
|
|
1061
|
-
"text": "u"
|
|
1062
|
-
},
|
|
1063
|
-
{
|
|
1064
|
-
"name": "v",
|
|
1065
|
-
"text": "v"
|
|
1066
|
-
},
|
|
1067
|
-
{
|
|
1068
|
-
"name": "diaThru",
|
|
1069
|
-
"text": "diaThru"
|
|
1070
|
-
},
|
|
1071
|
-
{
|
|
1072
|
-
"name": "diaCsk",
|
|
1073
|
-
"text": "diaCsk"
|
|
1074
|
-
},
|
|
1075
|
-
{
|
|
1076
|
-
"name": "cskDepth",
|
|
1077
|
-
"text": "cskDepth"
|
|
1078
|
-
},
|
|
1079
|
-
{
|
|
1080
|
-
"name": "span",
|
|
1081
|
-
"text": "span"
|
|
1082
|
-
}
|
|
1083
|
-
],
|
|
1084
|
-
"description": "cskHole(part, frame, u, v, diaThru, diaCsk, cskDepth, span) — through hole + cone countersink: the cone spans diaThru→diaCsk over cskDepth (118° style for cskDepth ≈ 1.17·(diaCsk−diaThru)/2). ",
|
|
1085
|
-
"doc": "cskHole(part, frame, u, v, diaThru, diaCsk, cskDepth, span)\n— through hole + cone countersink: the cone spans diaThru→diaCsk over\ncskDepth (118° style for cskDepth ≈ 1.17·(diaCsk−diaThru)/2).\n(CadQuery cskHole)",
|
|
1086
|
-
"examples": []
|
|
1087
|
-
},
|
|
1088
1003
|
{
|
|
1089
1004
|
"name": "chamferEdges",
|
|
1090
1005
|
"signature": "chamferEdges(part, edges, c)",
|
|
@@ -1169,70 +1084,8 @@
|
|
|
1169
1084
|
]
|
|
1170
1085
|
},
|
|
1171
1086
|
{
|
|
1172
|
-
"name": "
|
|
1173
|
-
"signature": "
|
|
1174
|
-
"params": [
|
|
1175
|
-
{
|
|
1176
|
-
"name": "part",
|
|
1177
|
-
"text": "part"
|
|
1178
|
-
},
|
|
1179
|
-
{
|
|
1180
|
-
"name": "frame",
|
|
1181
|
-
"text": "frame"
|
|
1182
|
-
},
|
|
1183
|
-
{
|
|
1184
|
-
"name": "opts",
|
|
1185
|
-
"text": "opts"
|
|
1186
|
-
}
|
|
1187
|
-
],
|
|
1188
|
-
"description": "holePattern(part, frame, { n, m, spacingU, spacingV, dia, span, u0=0, v0=0 }) — linear grid of through holes (CadQuery rarray idiom). ",
|
|
1189
|
-
"doc": "holePattern(part, frame, { n, m, spacingU, spacingV, dia, span, u0=0, v0=0 })\n— linear grid of through holes (CadQuery rarray idiom).\nGrid centered on the face center + (u0, v0) offset.",
|
|
1190
|
-
"examples": [
|
|
1191
|
-
"const fr = workplaneFromFace(part, facesByNormal(part, [0,0,1])[0]);\npart = holePattern(part, fr, { n: 3, m: 2, spacingU: 12, spacingV: 10, dia: 4 });"
|
|
1192
|
-
]
|
|
1193
|
-
},
|
|
1194
|
-
{
|
|
1195
|
-
"name": "clearanceHole",
|
|
1196
|
-
"signature": "clearanceHole(part, frame, u, v, size, spanOrOpts, fitArg)",
|
|
1197
|
-
"params": [
|
|
1198
|
-
{
|
|
1199
|
-
"name": "part",
|
|
1200
|
-
"text": "part"
|
|
1201
|
-
},
|
|
1202
|
-
{
|
|
1203
|
-
"name": "frame",
|
|
1204
|
-
"text": "frame"
|
|
1205
|
-
},
|
|
1206
|
-
{
|
|
1207
|
-
"name": "u",
|
|
1208
|
-
"text": "u"
|
|
1209
|
-
},
|
|
1210
|
-
{
|
|
1211
|
-
"name": "v",
|
|
1212
|
-
"text": "v"
|
|
1213
|
-
},
|
|
1214
|
-
{
|
|
1215
|
-
"name": "size",
|
|
1216
|
-
"text": "size"
|
|
1217
|
-
},
|
|
1218
|
-
{
|
|
1219
|
-
"name": "spanOrOpts",
|
|
1220
|
-
"text": "spanOrOpts"
|
|
1221
|
-
},
|
|
1222
|
-
{
|
|
1223
|
-
"name": "fitArg",
|
|
1224
|
-
"text": "fitArg"
|
|
1225
|
-
}
|
|
1226
|
-
],
|
|
1227
|
-
"description": "clearanceHole(part, frame, u, v, size, spanOrOpts?, fit?) Cut a clearance hole for fastener `size` ('M3', 3, '#8-32', …). fit: 'close'|'normal'|'loose' (default 'normal'). span defaults to holeSpan(). ",
|
|
1228
|
-
"doc": "Cut a **clearance** hole sized for fastener `size`. `size` accepts `'M3'`,\n`3`, `'M2.5'`, `'#8-32'`, `'1/4-20'`, etc. `fit` is `'close'|'normal'|'loose'`\n(aliases: tight/medium/coarse). `span` defaults to `holeSpan(part, frame)`.\nYou can also pass an options object as the 6th argument:\n`{ fit: 'close', span: 12 }`.\n\n\n\nThrows on unknown size/fit, non-positive derived diameter, bad frame, or empty /\nnon-manifold result.",
|
|
1229
|
-
"examples": [
|
|
1230
|
-
"const fr = workplaneFromFace(part, facesByNormal(part, [0,0,1])[0]);\npart = clearanceHole(part, fr, 10, 8, 'M3'); // normal fit\npart = clearanceHole(part, fr, -10, 8, 'M4', undefined, 'close');\npart = clearanceHole(part, fr, 0, 0, 'M5', { fit: 'loose' });"
|
|
1231
|
-
]
|
|
1232
|
-
},
|
|
1233
|
-
{
|
|
1234
|
-
"name": "tapDrillHole",
|
|
1235
|
-
"signature": "tapDrillHole(part, frame, u, v, size, span)",
|
|
1087
|
+
"name": "screwBoss",
|
|
1088
|
+
"signature": "screwBoss(part, frame, u, v, opts = {})",
|
|
1236
1089
|
"params": [
|
|
1237
1090
|
{
|
|
1238
1091
|
"name": "part",
|
|
@@ -1251,50 +1104,38 @@
|
|
|
1251
1104
|
"text": "v"
|
|
1252
1105
|
},
|
|
1253
1106
|
{
|
|
1254
|
-
"name": "
|
|
1255
|
-
"text": "
|
|
1256
|
-
|
|
1257
|
-
{
|
|
1258
|
-
"name": "span",
|
|
1259
|
-
"text": "span"
|
|
1107
|
+
"name": "opts",
|
|
1108
|
+
"text": "opts = {}",
|
|
1109
|
+
"default": "{}"
|
|
1260
1110
|
}
|
|
1261
1111
|
],
|
|
1262
|
-
"description": "
|
|
1263
|
-
"doc": "
|
|
1112
|
+
"description": "screwBoss(part, frame, u, v, opts): a screw boss on a face, one body, with a tap-drill, clearance or no hole. ",
|
|
1113
|
+
"doc": "A screw boss standing on a face, one body. It is a cylinder of `height` on\nthe frame plane at `(u, v)`, unioned into `part`, with a **tap-drill** pilot\nfor fastener `size` (the default, for a self-tapping or tapped screw), a\n**clearance** hole, or no hole. The base sinks 0.1 mm into the part below the frame plane, so the union\nis one body even when the frame carries float noise (a hand-built cylinder a\nhair off the face leaves two). `opts`: `size` (`'M3'`),\n`dia` (outer Ø, default 2.5 × the screw's major Ø: M3 → 7.5), `height` (8),\n`hole` (`'tap'` | `'clearance'` | `'none'`), `holeDepth` (from the boss top,\ndefault the boss height; deeper cuts on into the part), `through: true`\n(the bore runs on through the part below; not with `holeDepth`), `fit`\n(clearance: `'close'` | `'normal'` | `'loose'`), `segments` (48). Faces are\nnamed `boss.side`, `boss.top`, `boss.bottom`, and for the hole `boss.bore` and\n`boss.floor`. Throws on a bad frame, a hole as wide as the boss, or an unknown\n`hole`.",
|
|
1264
1114
|
"examples": [
|
|
1265
|
-
"const fr = workplaneFromFace(part, facesByNormal(part, [0,0,1])[0]);\npart =
|
|
1115
|
+
"const fr = workplaneFromFace(part, facesByNormal(part, [0, 0, 1])[0]);\npart = screwBoss(part, fr, 12, 8, { size: 'M3', height: 8 }); // Ø7.5, Ø2.5 pilot\npart = screwBoss(part, fr, -12, 8, { size: 'M4', height: 6, hole: 'clearance' }); // through Ø4.5\npart = screwBoss(part, fr, 0, -8, { size: 'M3', height: 10, hole: 'none', dia: 9 });"
|
|
1266
1116
|
]
|
|
1267
1117
|
},
|
|
1268
1118
|
{
|
|
1269
|
-
"name": "
|
|
1270
|
-
"signature": "
|
|
1119
|
+
"name": "bossesOnContour",
|
|
1120
|
+
"signature": "bossesOnContour(part, section, spec)",
|
|
1271
1121
|
"params": [
|
|
1272
1122
|
{
|
|
1273
1123
|
"name": "part",
|
|
1274
1124
|
"text": "part"
|
|
1275
1125
|
},
|
|
1276
1126
|
{
|
|
1277
|
-
"name": "
|
|
1278
|
-
"text": "
|
|
1279
|
-
},
|
|
1280
|
-
{
|
|
1281
|
-
"name": "u",
|
|
1282
|
-
"text": "u"
|
|
1283
|
-
},
|
|
1284
|
-
{
|
|
1285
|
-
"name": "v",
|
|
1286
|
-
"text": "v"
|
|
1127
|
+
"name": "section",
|
|
1128
|
+
"text": "section"
|
|
1287
1129
|
},
|
|
1288
1130
|
{
|
|
1289
|
-
"name": "
|
|
1290
|
-
"text": "
|
|
1291
|
-
"default": "{}"
|
|
1131
|
+
"name": "spec",
|
|
1132
|
+
"text": "spec"
|
|
1292
1133
|
}
|
|
1293
1134
|
],
|
|
1294
|
-
"description": "
|
|
1295
|
-
"doc": "
|
|
1135
|
+
"description": "bossesOnContour(part, section, spec): one screwBoss per centre of a contour. `spec` is screwBoss's opts plus `through`; the section plane is the face the bosses stand on (the Boss card's face pick and centre taps). ",
|
|
1136
|
+
"doc": "One screw boss at every sketch point of a centres contour, the way\n`holesOnContour` cuts holes: `section` is a `makeCrossSection` of\n`solveContour({ centers: true, ... })` on the face the bosses stand on, and\n`spec` is `screwBoss`'s `opts` (`size`, `dia`, `height`, `hole`, `holeDepth`\nor `through`, `fit`). The bosses stand out of the plane; the Boss card\nwrites this call from its face pick and centre taps. No centres returns\n`part`.",
|
|
1296
1137
|
"examples": [
|
|
1297
|
-
"const fr = workplaneFromFace(part, facesByNormal(part, [0, 0, 1])[0]);\
|
|
1138
|
+
"const fr = workplaneFromFace(part, facesByNormal(part, [0, 0, 1])[0]);\nconst c1 = makeCrossSection(fr, solveContour({ centers: true, points: [{ id: 'p0', at: [-10, 0] }, { id: 'p1', at: [10, 0] }] }));\npart = bossesOnContour(part, c1, { size: 'M3', height: 8, through: true });"
|
|
1298
1139
|
]
|
|
1299
1140
|
},
|
|
1300
1141
|
{
|
|
@@ -1315,9 +1156,9 @@
|
|
|
1315
1156
|
}
|
|
1316
1157
|
],
|
|
1317
1158
|
"description": "holesOnContour(part, section, spec) — one hole at every sketch point of a centres contour, including arc centres. `section` is a makeCrossSection (plane + profile). ",
|
|
1318
|
-
"doc": "
|
|
1159
|
+
"doc": "One hole at every non-construction sketch point of a centres contour, arc\ncentres included (`construction: true` points, such as a bolt circle's center,\nare skipped). `section` is a `makeCrossSection` of\n`solveContour({ centers: true, ... })`. Construction lines are not centres. No\ncentres returns `part`. `dia` is a raw millimetre diameter and wins over\nfastener `size` and `fit`. `side: 1` cuts toward −normal; `side: -1` or\n`flip: true` cuts the other way, so two calls can share one section. `depth` is\nmillimetres past the plane on that side. `through: true` defaults to up-to-next\n(stops at the first exit from material so a hole on a flange does not drill\nacross an air gap into geometry behind it); pass `throughAll: true` to span the\nfull part via `holeSpan`. A far c-bore or c-sink requires a through hole.\n\nEvery centre is the same feature, so the faces are pieces by centre:\n`hole1.bore[k]`, and with ends `hole1.cbore[k]`, `hole1.shoulder[k]`,\n`hole1.csk[k]` (no `[k]` for a single centre). A countersink at either end\nputs the bore on the countersink rim's segment count. The result is passed\nthrough `weld`.",
|
|
1319
1160
|
"examples": [
|
|
1320
|
-
"const c1 = makeCrossSection(plane, solveContour({\n centers: true,\n points: [{ id: 'p0', at: [10, 0] }, { id: '
|
|
1161
|
+
"const c1 = makeCrossSection(plane, solveContour({\n centers: true,\n points: [{ id: 'p0', at: [10, 0] }, { id: 'p1', at: [-10, 0] }],\n}));\npart = holesOnContour(part, c1, { dia: 4, through: false, depth: 6, side: 1 });\npart = holesOnContour(part, c1, { type: 'clearance', size: 'M3', fit: 'normal', through: true, side: -1 });"
|
|
1321
1162
|
]
|
|
1322
1163
|
},
|
|
1323
1164
|
{
|
|
@@ -1337,7 +1178,7 @@
|
|
|
1337
1178
|
"description": "Clearance diameter (mm) for a fastener size + fit.",
|
|
1338
1179
|
"doc": "Return the clearance or tap-drill diameter in **mm** without cutting. Useful\nfor custom patterns:\n\n\n\n`listFastenerSizes()` → `{ metric: ['M1.6','M2',…], unc: ['#4-40',…] }`.\n\n---\n\n## Fillet Helper (C6)",
|
|
1339
1180
|
"examples": [
|
|
1340
|
-
"const d = fastenerClearanceDia('M6', 'normal'); // 6.6\
|
|
1181
|
+
"const d = fastenerClearanceDia('M6', 'normal'); // 6.6\nconst c1 = makeCrossSection(fr, solveContour({ centers: true, points: [{ id: 'p0', at: [-10, -10] }, { id: 'p1', at: [10, -10] }, { id: 'p2', at: [-10, 10] }, { id: 'p3', at: [10, 10] }] }));\npart = holesOnContour(part, c1, { dia: d, through: true });"
|
|
1341
1182
|
]
|
|
1342
1183
|
},
|
|
1343
1184
|
{
|
|
@@ -1352,7 +1193,7 @@
|
|
|
1352
1193
|
"description": "Tap-drill diameter (mm) for a fastener size.",
|
|
1353
1194
|
"doc": "Return the clearance or tap-drill diameter in **mm** without cutting. Useful\nfor custom patterns:\n\n\n\n`listFastenerSizes()` → `{ metric: ['M1.6','M2',…], unc: ['#4-40',…] }`.\n\n---\n\n## Fillet Helper (C6)",
|
|
1354
1195
|
"examples": [
|
|
1355
|
-
"const d = fastenerClearanceDia('M6', 'normal'); // 6.6\
|
|
1196
|
+
"const d = fastenerClearanceDia('M6', 'normal'); // 6.6\nconst c1 = makeCrossSection(fr, solveContour({ centers: true, points: [{ id: 'p0', at: [-10, -10] }, { id: 'p1', at: [10, -10] }, { id: 'p2', at: [-10, 10] }, { id: 'p3', at: [10, 10] }] }));\npart = holesOnContour(part, c1, { dia: d, through: true });"
|
|
1356
1197
|
]
|
|
1357
1198
|
},
|
|
1358
1199
|
{
|
|
@@ -1426,7 +1267,7 @@
|
|
|
1426
1267
|
},
|
|
1427
1268
|
{
|
|
1428
1269
|
"name": "makeRevolve",
|
|
1429
|
-
"signature": "makeRevolve(contours, segments =
|
|
1270
|
+
"signature": "makeRevolve(contours, segments = 0, degrees = 360)",
|
|
1430
1271
|
"params": [
|
|
1431
1272
|
{
|
|
1432
1273
|
"name": "contours",
|
|
@@ -1434,8 +1275,8 @@
|
|
|
1434
1275
|
},
|
|
1435
1276
|
{
|
|
1436
1277
|
"name": "segments",
|
|
1437
|
-
"text": "segments =
|
|
1438
|
-
"default": "
|
|
1278
|
+
"text": "segments = 0",
|
|
1279
|
+
"default": "0"
|
|
1439
1280
|
},
|
|
1440
1281
|
{
|
|
1441
1282
|
"name": "degrees",
|
|
@@ -1443,15 +1284,15 @@
|
|
|
1443
1284
|
"default": "360"
|
|
1444
1285
|
}
|
|
1445
1286
|
],
|
|
1446
|
-
"description": "makeRevolve(contours, segments=
|
|
1447
|
-
"doc": "Revolve a 2D profile around its **Y** axis → result axis = **Z
|
|
1287
|
+
"description": "makeRevolve(contours, segments=0, degrees=360) — revolve a 2D profile around its Y axis (result's axis = Z). contours = [[x,y]...] outer first + optional holes; winding is normalized automatically; throws loudly on an invalid profile instead of returning a silent empty manifold. ",
|
|
1288
|
+
"doc": "Revolve a 2D profile around its **Y** axis → result axis = **Z**. `segments`\nis the count per full turn; omitted or `0`, the shared segment policy of the\nprofile's outermost radius (so a revolved rim shares its lattice with a\ncylinder of that radius). The Revolve card has no Segments field.\n`contours` = `[[x,y]...]` outer first + optional hole contours after;\nwinding is **auto-normalized** (outermost CCW, holes CW) — do NOT hand-roll\n`new CrossSection(...).revolve()` and fight winding yourself (wrong winding\nfails silently in raw CrossSection). Profile: **x = radial distance (≥ 0),\ny = height along the axis**. If a polygon crosses the Y-axis, only the\npositive-X side is used (Manifold clip). `degrees` is the sweep (default\n360, must be > 0 and ≤ 360). Throws a named error on an invalid profile\ninstead of returning a silent empty manifold.\n\n**Faces:** `seg[g]`, one per edge of the profile in loop order, and `end0` /\n`end1` on the flat ends of a partial revolve. A profile from `solveContour`\nhas one face per sketch entity, as an extrude has one wall per entity: an\narc is one face with a torus record (`axisOrigin`, `axisDir`, `majorRadius`,\n`minorRadius`), or a sphere record when its centre is on the axis. A line is\na plane, a cylinder or a cone. A typed point list gets a face per point\npair. Nothing re-fits a torus, so once the face is moved its record keeps\nthe built values with `fit: 'none'`.",
|
|
1448
1289
|
"examples": [
|
|
1449
1290
|
"// revolved flange ⌀90×10 + boss ⌀30 base, 30 tall — one closed silhouette\nlet part = makeRevolve([ [[0,0],[45,0],[45,10],[15,10],[15,30],[0,30]] ], 96);\n\n// hollow tube OD40 ID28 × 30: outer contour + inner (through) contour\nconst tube = makeRevolve([ [[0,0],[20,0],[20,30],[0,30]],\n [[14,0],[14,30],[20,30],[20,0]] ], 64);"
|
|
1450
1291
|
]
|
|
1451
1292
|
},
|
|
1452
1293
|
{
|
|
1453
1294
|
"name": "makeExtrude",
|
|
1454
|
-
"signature": "makeExtrude(contours, height)",
|
|
1295
|
+
"signature": "makeExtrude(contours, height, opts)",
|
|
1455
1296
|
"params": [
|
|
1456
1297
|
{
|
|
1457
1298
|
"name": "contours",
|
|
@@ -1460,12 +1301,16 @@
|
|
|
1460
1301
|
{
|
|
1461
1302
|
"name": "height",
|
|
1462
1303
|
"text": "height"
|
|
1304
|
+
},
|
|
1305
|
+
{
|
|
1306
|
+
"name": "opts",
|
|
1307
|
+
"text": "opts"
|
|
1463
1308
|
}
|
|
1464
1309
|
],
|
|
1465
|
-
"description": "makeExtrude(contours, height) — extrude a 2D profile by `height` along Z. ",
|
|
1466
|
-
"doc": "Extrude a 2D profile by `height` along +Z. Same contour rules as\nmakeRevolve (outer + optional holes, winding auto-fixed).\n\n\n\n**Contour-mode Extrude (Slice 25):** game-mode **Extrude** builds a profile on\nthe workplane, then Confirm emits:\n\n\n\n`height` is always > 0. When `part` already exists, Advanced Confirm is\nadditive (`part.add` of the placed solid). An empty script still uses\n`let part = placeInFrame(...)`. The Extrude card labels Out / In / Both as\nDirection. **In** uses `w = −height`; **Both** uses `w = −height/2`. The axis\ndefaults to the plane normal; a world axis is\nrefused unless it is parallel to that normal. Loud-fail on a bad plane,\nprofile, or distance.\n\n**Contour-mode Revolve (Slice 26):** game-mode **Revolve** builds a profile on\nthe workplane, then Confirm emits `makeCrossSection` + `makeRevolve` placed\nso the axis lies **on the profile plane** (default: along V). The profile\nis remapped with identity `(u,v)→(radial,height)` in the axis/radial basis\n(axis through the workplane origin). A centered circle therefore revolves\nabout a diameter — a sphere. Profiles that cross the axis are clipped to\n+radial (`makeRevolve` / Manifold); on-axis, zero-width, and entirely\n−radial profiles loud-fail.\n\n\n\n`angle` is always > 0 and ≤ 360 (default 360). Sense **In** starts at\n`−angle`; **Both** starts at `−angle/2`. Axis defaults to plane **V**; a\nworld axis is refused unless it lies on the profile plane. Loud-fail on a\nbad plane, profile, angle, or an on-axis / zero-width / entirely-negative\nradial profile.",
|
|
1310
|
+
"description": "makeExtrude(contours, height, opts?) — extrude a 2D profile by `height` along Z. ",
|
|
1311
|
+
"doc": "Extrude a 2D profile by `height` along +Z. Same contour rules as\nmakeRevolve (outer + optional holes, winding auto-fixed).\n\n`opts.twist` is degrees about the profile's area centroid (outer contour\nminus holes). That centroid is the extrude axis. It is the workplane\norigin when the profile is centered there, which is the usual circle and\nrectangle. The angle is 0 at the base and the full twist at the end.\nPositive degrees are counter-clockwise about +Z (right-hand). Omit\n`twist`, or pass 0, and the call is the straight extrude: same mesh, and\nthe third argument is left off the script. `opts.unit` is card metadata\n(`'turns'` or `'degrees'`). The kernel reads `twist` only. Turns are a\ndisplay unit: 1 turn is 360 degrees. A twist uses\n`CrossSection.extrude`'s `nDivisions` and `twistDegrees`, with the section\nshifted so the centroid sits on the cross-section origin and shifted back\nafterwards. Divisions scale with the angle (about one step per 1.4°, at least 4,\ncapped at 96) so a 90° square stays within about 1% of its volume. A bad status or a near-zero volume throws.\n\n\n\n**Faces:** `cap0` (z = 0), `cap1` (z = height) and `wall[g]`, one per edge of\nthe profile in loop order. A profile from `solveContour` has one wall per\nsketch entity: a line is a wall, and an arc is one wall with a cylinder\nrecord, whatever its segment count. A full circle is one wall. A typed point\nlist, or a ring that was scaled or moved in the script after the solve, has\nno entities and gets a wall per point pair.\n\n**Contour-mode Extrude (Slice 25):** game-mode **Extrude** builds a profile on\nthe workplane, then Confirm emits:\n\n\n\n`height` is always > 0. When `part` already exists, Advanced Confirm is\nadditive (`part.add` of the placed solid). An empty script still uses\n`let part = placeInFrame(...)`. The Extrude card labels Out / In / Both as\nDirection. **In** uses `w = −height`; **Both** uses `w = −height/2`. The axis\ndefaults to the plane normal; a world axis is\nrefused unless it is parallel to that normal. Loud-fail on a bad plane,\nprofile, or distance.\n\n**Contour-mode Revolve (Slice 26):** game-mode **Revolve** builds a profile on\nthe workplane, then Confirm emits `makeCrossSection` + `makeRevolve` placed\nso the axis lies **on the profile plane** (default: along V). The profile\nis remapped with identity `(u,v)→(radial,height)` in the axis/radial basis\n(axis through the workplane origin). A centered circle therefore revolves\nabout a diameter — a sphere. Profiles that cross the axis are clipped to\n+radial (`makeRevolve` / Manifold); on-axis, zero-width, and entirely\n−radial profiles loud-fail.\n\n\n\n`angle` is always > 0 and ≤ 360 (default 360). Sense **In** starts at\n`−angle`; **Both** starts at `−angle/2`. Axis defaults to plane **V**; a\nworld axis is refused unless it lies on the profile plane. Loud-fail on a\nbad plane, profile, angle, or an on-axis / zero-width / entirely-negative\nradial profile.",
|
|
1467
1312
|
"examples": [
|
|
1468
|
-
"const plate = makeExtrude([ [[-40,-15],[40,-15],[40,15],[-40,15]] ], 3);",
|
|
1313
|
+
"const plate = makeExtrude([ [[-40,-15],[40,-15],[40,15],[-40,15]] ], 3);\nconst twisted = makeExtrude([ [[-5,-5],[5,-5],[5,5],[-5,5]] ], 20, { twist: 90 });",
|
|
1469
1314
|
"const fr = { center: [0, 0, 0], normal: [0, 0, 1], x: [1, 0, 0], y: [0, 1, 0] };\nconst xs = makeCrossSection(fr, profileCircle(5, 32));\npart = placeInFrame(xs.plane, makeExtrude(xs.contours, 10), [0, 0, 0]);\n// when part already exists, Confirm unions instead of replacing:\n// part = part.add(placeInFrame(xs.plane, makeExtrude(xs.contours, 10), [0, 0, 0]));",
|
|
1470
1315
|
"const fr = { center: [0, 0, 0], normal: [0, 0, 1], x: [1, 0, 0], y: [0, 1, 0] };\nconst xs = makeCrossSection(fr, profileCircle(5, 32));\npart = placeInFrame({\n center: xs.plane.center,\n x: xs.plane.x, y: xs.plane.normal, normal: xs.plane.y,\n}, makeRevolve(xs.contours.map((ring) => ring.map(([u, v]) => [u, v])), 96, 360));"
|
|
1471
1316
|
]
|
|
@@ -1513,22 +1358,26 @@
|
|
|
1513
1358
|
},
|
|
1514
1359
|
{
|
|
1515
1360
|
"name": "sheetMetalSolid",
|
|
1516
|
-
"signature": "sheetMetalSolid(spec)",
|
|
1361
|
+
"signature": "sheetMetalSolid(spec, contour)",
|
|
1517
1362
|
"params": [
|
|
1518
1363
|
{
|
|
1519
1364
|
"name": "spec",
|
|
1520
1365
|
"text": "spec"
|
|
1366
|
+
},
|
|
1367
|
+
{
|
|
1368
|
+
"name": "contour",
|
|
1369
|
+
"text": "contour"
|
|
1521
1370
|
}
|
|
1522
1371
|
],
|
|
1523
|
-
"description": "sheetMetalSolid(spec) —
|
|
1524
|
-
"doc": "sheetMetalSolid(spec) —
|
|
1372
|
+
"description": "sheetMetalSolid(spec, contour?) — the folded sheet-metal part. `contour` is a sketch profile (`makeCrossSection(...)` result: `{ plane, contours }`): the base flange takes its plane and its outline from it, and follows the sketch when it changes. ",
|
|
1373
|
+
"doc": "sheetMetalSolid(spec, contour?) — the folded sheet-metal part. `contour` is\na sketch profile (`makeCrossSection(...)` result: `{ plane, contours }`):\nthe base flange takes its plane and its outline from it, and follows the\nsketch when it changes. Without it the base is the spec's rectangle.",
|
|
1525
1374
|
"examples": [
|
|
1526
1375
|
"let part = sheetMetalSolid(sheetSpec);"
|
|
1527
1376
|
]
|
|
1528
1377
|
},
|
|
1529
1378
|
{
|
|
1530
1379
|
"name": "profileCircle",
|
|
1531
|
-
"signature": "profileCircle(radius, segments
|
|
1380
|
+
"signature": "profileCircle(radius, segments)",
|
|
1532
1381
|
"params": [
|
|
1533
1382
|
{
|
|
1534
1383
|
"name": "radius",
|
|
@@ -1536,14 +1385,13 @@
|
|
|
1536
1385
|
},
|
|
1537
1386
|
{
|
|
1538
1387
|
"name": "segments",
|
|
1539
|
-
"text": "segments
|
|
1540
|
-
"default": "32"
|
|
1388
|
+
"text": "segments"
|
|
1541
1389
|
}
|
|
1542
1390
|
],
|
|
1543
|
-
"description": "profileCircle(radius, segments
|
|
1544
|
-
"doc": "profileCircle(radius, segments
|
|
1391
|
+
"description": "profileCircle(radius, segments?) → { type:'circle', radius, segments, contours } Contours centered at UV origin. ",
|
|
1392
|
+
"doc": "profileCircle(radius, segments?) → { type:'circle', radius, segments, contours }\nContours centered at UV origin. With no count the shared segment policy\n(`circleSegments(radius)`) decides, so the profile shares its vertex count\nwith a cylinder or hole of the same radius.",
|
|
1545
1393
|
"examples": [
|
|
1546
|
-
"const p = profileCircle(5, 32);"
|
|
1394
|
+
"const p = profileCircle(5); // policy count\nconst q = profileCircle(5, 32); // explicit"
|
|
1547
1395
|
]
|
|
1548
1396
|
},
|
|
1549
1397
|
{
|
|
@@ -1607,15 +1455,19 @@
|
|
|
1607
1455
|
},
|
|
1608
1456
|
{
|
|
1609
1457
|
"name": "solveContour",
|
|
1610
|
-
"signature": "solveContour(spec)",
|
|
1458
|
+
"signature": "solveContour(spec, part)",
|
|
1611
1459
|
"params": [
|
|
1612
1460
|
{
|
|
1613
1461
|
"name": "spec",
|
|
1614
1462
|
"text": "spec"
|
|
1463
|
+
},
|
|
1464
|
+
{
|
|
1465
|
+
"name": "part",
|
|
1466
|
+
"text": "part"
|
|
1615
1467
|
}
|
|
1616
1468
|
],
|
|
1617
1469
|
"description": "solveContour(spec) → a contour profile in plane UV. spec is `{ points, lines, arcs, dimensions, constraints, refs }`. ",
|
|
1618
|
-
"doc": "Solve a constrained contour in plane UV. Lengths are millimetres. Angles are\ndegrees. A dimension name is a string on that dimension and is not a script\nbinding. Horizontal is constant `v`. Vertical is constant `u`. Both are the\nworkplane frame, not the screen.\n\n\n\n**Returns:** `{ type:'contour', contours, points, lines, arcs, dimensions, constraints, dof, status, conflict, repeated, open }
|
|
1470
|
+
"doc": "Solve a constrained contour in plane UV. Lengths are millimetres. Angles are\ndegrees. A dimension name is a string on that dimension and is not a script\nbinding. Horizontal is constant `v`. Vertical is constant `u`. Both are the\nworkplane frame, not the screen.\n\n\n\nAn open run of three or more points gets its closing line by default, so `{ points, lines }` of a tapped polyline is a polygon. `spec.openChains: true` takes the sketch as drawn: no line is added, and a run that does not close is on the sketch but is not a profile (`contours` leaves it out). The Polyline tool writes that mark.\n\n**Returns:** `{ type:'contour', contours, points, lines, arcs, dimensions, constraints, imports, importEntities, offsets, offsetEntities, dof, status, conflict, repeated, open }`. `spec.imports` are converted edges (`convertEdges`): fixed geometry tessellated into the profile and reported under `importEntities`, not among the user's points, lines and arcs. An import marked `source: true` is a hidden source: an offset can name it, but it is not drawn into the profile itself (the Offset tool writes these for a face or model edge it offsets). `solveContour(spec, part)` with linked imports re-projects them from `part` when `makeCrossSection` places the profile. `spec.offsets` are offset rules (`{ id, of, distance, side?, corners? }`, see `offsetContour`): each is derived after the solve from the pieces `of` names (user lines and arcs, or an import id), tessellated into the profile on the source's lattice and reported under `offsetEntities`. A dimension `{ kind: 'offset', offset: 'o0', value }` is the rule's handle: its value drives the rule's distance (the solved `offsets` report it) and it adds no residual; the sketch tool writes one per offset. Converted edges whose ends coincide share one corner point, so several converted edges form one loop. `of` pieces that do not close are offset as an open chain: it is reported under `offsetEntities`, adds no closed profile, and sets `open`. `distance` may be 0 (the offset is then its source's outline, the usual form over `source` imports). An offset whose pieces branch or do not connect, or whose distance collapses it, fails the solve naming the offset.\n`status` is `under`, `full`, or `conflict`. `repeated` lists constraints\nwhose removal does not change the rank, each with `warning: 'repeated'`.\nThat warning is not a failure. More than 128 points throws. An open chain\nof three or more points is closed with one more line before the solve.\nA contour may hold more than one chain. A vertex with more than two\nedges throws.\n\n**Loud failures:** unknown id, unknown kind, equal of a line and an arc,\na name that is not an identifier or is used twice on the contour, a bare\nidentifier where a number belongs.",
|
|
1619
1471
|
"examples": [
|
|
1620
1472
|
"const contour = solveContour({\n points: [\n { id: 'p0', at: [0, 0] },\n { id: 'p1', at: [40, 0] },\n { id: 'p2', at: [40, 20] },\n { id: 'p3', at: [0, 20] },\n ],\n lines: [\n { id: 'e0', a: 'p0', b: 'p1' },\n { id: 'e1', a: 'p1', b: 'p2' },\n { id: 'e2', a: 'p2', b: 'p3' },\n { id: 'e3', a: 'p3', b: 'p0' },\n ],\n arcs: [],\n dimensions: [\n { id: 'd0', kind: 'length', edge: 'e0', value: 40, name: 'width' },\n ],\n constraints: [\n { id: 'k0', kind: 'horizontal', items: ['e0'] },\n { id: 'k1', kind: 'fix', items: ['p0'], at: { p0: [0, 0] } },\n ],\n});\nconst xs = makeCrossSection(fr, contour);"
|
|
1621
1473
|
]
|
|
@@ -1635,7 +1487,7 @@
|
|
|
1635
1487
|
}
|
|
1636
1488
|
],
|
|
1637
1489
|
"description": "makeSweepPath(edges, opts?) → reusable ordered sweep path / wire. edges: feature / convexEdges-style {a,b,va,vb,...} (selection or query). ",
|
|
1638
|
-
"doc": "**Parameters:**\n- `edges` — array of feature edges `{ a, b, va, vb, length?, key? }` (from\n `convexEdges` / Edge pick selection)\n- `opts.reverse` — optional; reverse polyline direction\n\n**Returns:** `{ kind:'sweepPath', closed, points, length, edgeCount }
|
|
1490
|
+
"doc": "**Parameters:**\n- `edges` — array of feature edges `{ a, b, va, vb, length?, key? }` (from\n `convexEdges` / Edge pick selection)\n- `opts.reverse` — optional; reverse polyline direction\n\n**Returns:** `{ kind:'sweepPath', closed, points, crease, length, edgeCount }`.\n`points` is the path, thinned to a 1.2 mm floor; `crease` is every vertex of\nthe picked edges in the same order, which `filletAlongPath` uses to keep an\nearlier blend's own vertices as knots.\n\n**Edge sets.** The edges need not form one chain. Every connected chain or\nloop is a component; a vertex where three or more edges meet (a box corner)\nsplits its component into chains that end there. One component is returned\nas the plain path. Several come back as the longest component (so\n`sweep` / `sweepPoints` keep a usable path) with `components` listing every\nchain, `edgeCount` and `setLength` over the whole set, and `junctions`. The\nbox's twelve edges are twelve chains and eight junctions; four vertical\nedges plus the top rim are eight chains and four junctions.\n`filletAlongPath` fillets every component. Nothing is dropped: an earlier\nversion kept the largest piece of a broken loop and filleted that.\n\n**Loud failures (script):** empty / unusable edges; walk failure.\n\n**UI:** FEAT rail → **Path** → param popup (Body, Reverse). Uses current Edge\nselection + Tangent chip. Viewport preview shows order/direction (green→magenta\ngradient polyline, chevron arrows, start/end markers) — distinct from the\norange #20 selection halo. Auto-Run unchanged.\n\n**Non-goals (Slice 22):** fillet-via-sweep shipped in Slice 23; extrude/revolve/loft\nstill wait for Product brief; Profile API changes; full sketcher; C6 soft counters.\n\n\n---\n\n## Fillet via swept cross-section (Slice 23)\n\nUnlock fillets on **compound / curved-adjacent** edges (cases where C6\n`filletEdges` throws `curved-face fillet not supported`, e.g. post-fillet seams\nor when you prefer Path-driven construction) by sweeping a cutter along\n`makeSweepPath` and boolean-subtracting.",
|
|
1639
1491
|
"examples": [
|
|
1640
1492
|
"let part = Manifold.cube([40, 30, 20], true);\nconst top = facesByNormal(part, [0, 0, 1])[0];\nconst fr = workplaneFromFace(part, top);\n// Script path: pass convexEdges (or a filtered subset) — UI emits mid-matched selection.\nconst rim = convexEdges(part); // or selected edges from Edge pick + Tangent\nconst path = makeSweepPath(rim); // { kind:'sweepPath', closed, points, length, edgeCount }\n// Later: sweepPoints(profile, path.points, { closed: path.closed })\nreturn part;"
|
|
1641
1493
|
]
|
|
@@ -1662,8 +1514,8 @@
|
|
|
1662
1514
|
"default": "{}"
|
|
1663
1515
|
}
|
|
1664
1516
|
],
|
|
1665
|
-
"description": "
|
|
1666
|
-
"doc": "**Parameters:**\n- `part` — manifold body\n- `path` — `makeSweepPath` result, `{ points, closed }`, or `points[]` (+ `opts.closed`).\n A `makeSweepPath` result with `components` (an edge set: disjoint edges,\n several loops, a pick with junctions) fillets every component: each builds\n its cutter against the untouched solid, with its own frames, then one\n n-way subtract and the set-level guards (removed volume against the summed\n expectation, scrap components, degenerate triangles). Chains meeting at a\n vertex are cut from the same solid, so the shared vertex is still there\n when the second chain is probed. A vertex where exactly three convex\n chains end at right angles gets the spherical corner patch (one face,\n `<block>.corner[k]`), built as a mesh on the chains' own end rings; any\n other junction keeps the cusp. `filletAlongPath(part,\n makeSweepPath(convexEdges(part)), r)` on a box is the fully rounded box.\n- `radius` — fillet radius, or chamfer leg length (> 0)\n- `opts.profile` — `'fillet'` (default) or `'chamfer'`\n- `opts.segments` — arc segments for the fillet profile (default 12)\n- `opts.initialNormal` — optional. When set, keeps the legacy 90° wedge and a single start-frame RMF. Leave unset for the dihedral cutter.\n- `opts.arcSamples` / `opts.extrudeSegments` — legacy RMF sweep quality only\n\n**Path / cutter:** open chains sweep the wedge along a **linear polyline** of the\nedge wire (not Catmull-Rom — spline bulge left purple scraps). Closed paths that\nfit a circle use a **revolved meridian wedge** (C6-style, phase-locked to the\ntessellation). **Fillet-on-fillet / path on a prior blend:** keep the full wire,\nincluding tessellated micro rim arcs — do **not** skip those segments (skipping\nleft a gap instead of wrapping the prior fillet). The quarter-circle / chamfer\ncutter origin is pushed into a rear exterior bumper `(−e,−e)` plus thickness-`e`\nstrips so the boolean consumes coincident sliver sheets **without growing the\nrequested blend** (realized first-quadrant extent stays at `r`). Mixed-radius /\ntighter follow-on sweeps use a deeper rear pad than the original 4%·r sliver.\nDisconnected cutter scraps are dropped via `decompose` when present.\nLoud-fail if the kept solid is still scrap-sheet dirty.\n\n**Dihedral cutter:** each path segment is probed from the two adjacent triangles\n(in-face rays from the third vertices — not face normals, not faceID groups).\n`N` lies in one face, `B = T×N` points toward the other, and the profile is built\nfor that interior angle θ: fillet setback `t = r/tan(θ/2)`, removed area\n`r·t − ½·r²·(π−θ)` (at 90° this is `r²(1−π/4)`); chamfer area `½·c²·sin θ`\n(at 90° this is `½·c²`). Segments whose θ stays within 3° share one profile and\nare swept with those per-segment frames. A smooth segment that is not a convex\nedge keeps the neighboring frame, so a compound chain can still sweep. A closed run that fits a circle is\nrevolved. `opts.initialNormal` is the only path that still uses a 90° wedge and\none start-frame RMF. The exterior bumper still keeps cutter legs off the faces;\nat 90° it matches the old `(−e,−e)` pad.",
|
|
1517
|
+
"description": "**Parameters:** - `part` — manifold body - `path` — `makeSweepPath` result, `{ points, closed }`, or `points[]` (+ `opts.closed`). ",
|
|
1518
|
+
"doc": "**Parameters:**\n- `part` — manifold body\n- `path` — `makeSweepPath` result, `{ points, closed }`, or `points[]` (+ `opts.closed`).\n A `makeSweepPath` result with `components` (an edge set: disjoint edges,\n several loops, a pick with junctions) fillets every component: each builds\n its cutter against the untouched solid, with its own frames, then one\n n-way subtract and the set-level guards (removed volume against the summed\n expectation, scrap components, degenerate triangles). Chains meeting at a\n vertex are cut from the same solid, so the shared vertex is still there\n when the second chain is probed. A vertex where exactly three convex\n chains end at right angles gets the spherical corner patch (one face,\n `<block>.corner[k]`), built as a mesh on the chains' own end rings; any\n other junction keeps the cusp. `filletAlongPath(part,\n makeSweepPath(convexEdges(part)), r)` on a box is the fully rounded box.\n- `radius` — fillet radius, or chamfer leg length (> 0). A chamfer's leg is\n measured along each wall from the edge, also where a wall curves (the\n corner of a round body and a flat, a post against a wall)\n- `opts.profile` — `'fillet'` (default) or `'chamfer'`\n- `opts.segments` — arc segments for the fillet profile (default 12)\n- `opts.initialNormal` — optional. When set, keeps the legacy 90° wedge and a single start-frame RMF. Leave unset for the dihedral cutter.\n- `opts.arcSamples` / `opts.extrudeSegments` — legacy RMF sweep quality only\n\n**Path / cutter:** open chains sweep the wedge along a **linear polyline** of the\nedge wire (not Catmull-Rom — spline bulge left purple scraps). Closed paths that\nfit a circle use a **revolved meridian wedge** (C6-style, phase-locked to the\ntessellation). **Fillet-on-fillet / path on a prior blend:** keep the full wire,\nincluding tessellated micro rim arcs — do **not** skip those segments (skipping\nleft a gap instead of wrapping the prior fillet). The quarter-circle / chamfer\ncutter origin is pushed into a rear exterior bumper `(−e,−e)` plus thickness-`e`\nstrips so the boolean consumes coincident sliver sheets **without growing the\nrequested blend** (realized first-quadrant extent stays at `r`). Mixed-radius /\ntighter follow-on sweeps use a deeper rear pad than the original 4%·r sliver.\nDisconnected cutter scraps are dropped via `decompose` when present.\nLoud-fail if the kept solid is still scrap-sheet dirty.\n\n**Dihedral cutter:** each path segment is probed from the two adjacent triangles\n(in-face rays from the third vertices — not face normals, not faceID groups).\n`N` lies in one face, `B = T×N` points toward the other, and the profile is built\nfor that interior angle θ: fillet setback `t = r/tan(θ/2)`, removed area\n`r·t − ½·r²·(π−θ)` (at 90° this is `r²(1−π/4)`); chamfer area `½·c²·sin θ`\n(at 90° this is `½·c²`). Segments whose θ stays within 3° share one profile and\nare swept with those per-segment frames. A smooth segment that is not a convex\nedge keeps the neighboring frame, so a compound chain can still sweep. A closed run that fits a circle is\nrevolved. `opts.initialNormal` is the only path that still uses a 90° wedge and\none start-frame RMF. The exterior bumper still keeps cutter legs off the faces;\nat 90° it matches the old `(−e,−e)` pad.",
|
|
1667
1519
|
"examples": [
|
|
1668
1520
|
"let part = Manifold.cube([40, 30, 20], true);\n// Planar–planar (unchanged):\nconst e = convexEdges(part).filter(/* … */);\npart = filletEdges(part, e, 3, { sphericalCorners: true });\n\n// Sweep fillet (curved-adjacent / closed rim / post-fillet seam):\nconst rim = /* Edge pick + Tangent → selection, or convexEdges subset */;\nconst path = makeSweepPath(rim); // { kind:'sweepPath', closed, points, length, edgeCount }\npart = filletAlongPath(part, path, 2); // dihedral fillet\n// part = filletAlongPath(part, path, 2, { profile: 'chamfer' }); // equal-leg chamfer\nreturn part;"
|
|
1669
1521
|
]
|
|
@@ -1735,7 +1587,7 @@
|
|
|
1735
1587
|
}
|
|
1736
1588
|
],
|
|
1737
1589
|
"description": "faceNames(part) → every face name on the part, sorted. ",
|
|
1738
|
-
"doc": "Faces by the name the helper that built them recorded (see [docs/architecture.md](architecture.md), Face identity). `Manifold.cube` / `cylinder` / `sphere`, `tube`, `hexPrism`, `roundedBox`, `makeExtrude`, `makeRevolve`, `sweep` / `sweepPoints` and a parallel `makeLoft` stamp every face with `feature.role`: `feature` is the id of the marked block the call ran in (`cube1`, `tapDrillHole-11`), else `<helper>@<n>` in script order; `role` is `top bottom left right front back`, `side top bottom inner`, `surface`, `wall[i]`, `band[i]` / `corner[i]`, `cap0 cap1 wall[g]` (extrude and sweep), `seg[g] end0 end1` (revolve), `cap0 cap1 span[i][j]` (loft: bottom edge `i`, station span `j`). A label in several pieces (a slot through a top, a union of two copies) gets `[k]`, ordered by centre.\n\n\n\n`edgesOf(part, name, { includeConcave?, minAngleDeg? })` returns the convex feature edges that touch the named face, in the shape `convexEdges` returns, so they go straight into `filletEdges` / `chamferEdges`. Only edges on that face: four on a box top, never every edge on the body whose neighbour faces the same way. Concave edges are skipped and counted on `result.skipped` (pass `includeConcave: true` to blend them); it throws, naming the face and the concave count, when no convex edge is left.\n\n`facesNamed` throws, naming the faces that exist, when nothing matches; it never picks a nearby face. The faces carry `center`, `normal`, `tris`, `verts`, `area`, `body`, `name`, `label { feature, role, ordinal }` and `record`, and work wherever a `facesByNormal` face does. `surfaceOf` is the
|
|
1590
|
+
"doc": "Faces by the name the helper that built them recorded (see [docs/architecture.md](architecture.md), Face identity). `Manifold.cube` / `cylinder` / `sphere`, `tube`, `rectTube`, `hexPrism`, `roundedBox`, `makeExtrude`, `makeRevolve`, `sweep` / `sweepPoints` and a parallel `makeLoft` stamp every face with `feature.role`: `feature` is the id of the marked block the call ran in (`cube1`, `tapDrillHole-11`), else `<helper>@<n>` in script order; `role` is `top bottom left right front back`, `side top bottom inner`, `surface`, `wall[i]`, `band[i]` / `corner[i]`, `top bottom left right front back corner[i] innerLeft innerRight innerFront innerBack innerCorner[i]` (rectangular tube), `cap0 cap1 wall[g]` (extrude and sweep), `seg[g] end0 end1` (revolve), `cap0 cap1 span[i][j]` (loft: bottom edge `i`, station span `j`). The hole helper (`holesOnContour`) stamps the faces it cuts: `bore floor` (the wall, a blind hole's bottom), `cbore shoulder` (a counterbore's wall and its flat) and `csk` (a countersink's cone), under the block the call ran in, else `hole@<n>` per call. A label in several pieces (a slot through a top, a union of two copies) gets `[k]`, ordered by centre.\n\n\n\n`edgesOf(part, name, { includeConcave?, minAngleDeg? })` returns the convex feature edges that touch the named face, in the shape `convexEdges` returns, so they go straight into `filletEdges` / `chamferEdges`. Only edges on that face: four on a box top, never every edge on the body whose neighbour faces the same way. Concave edges are skipped and counted on `result.skipped` (pass `includeConcave: true` to blend them); it throws, naming the face and the concave count, when no convex edge is left.\n\n`facesNamed` throws, naming the faces that exist, when nothing matches; it never picks a nearby face. The faces carry `center`, `normal`, `tris`, `verts`, `area`, `body`, `name`, `label { feature, role, ordinal }` and `record`, and work wherever a `facesByNormal` face does. `surfaceOf` is the live surface of the face (`plane`, `cylinder`, `cone`, `sphere`, else the stamp's own kind: `swept`, `lofted`, `mesh`): the record the helper wrote is validated against the face's triangles and re-fit when a translate, rotate, draft, moveFace or blend moved the face, so it is where the face is now. `fit` says `stamped`, `refit` or `none`, `residual` is the worst vertex miss in mm, and `built` is the as-built stamp (see [B-REP_METADATA.md](../B-REP_METADATA.md)). A hull, a fillet cutter or a freehand `Manifold.*` call outside those primitives has no stamped faces.",
|
|
1739
1591
|
"examples": [
|
|
1740
1592
|
"faceNames(part); // ['base.bottom', 'base.top', 'boss.side', …]\nconst top = facesNamed(part, 'base.top')[0];\nconst wp = workplaneFromFace(part, top);\npart = hole(part, wp, 10, 0, 4, 6);\nfacesNamed(part, 'plate.top'); // every piece: plate.top[0], plate.top[1]\nfacesNamed(part, 'boss.wall[*]'); // glob\nsurfaceOf(top); // { kind: 'plane', origin, normal }\npart = chamferEdges(part, edgesOf(part, 'boss.top'), 2); // the edges around that face only\nconst e = edgesOf(part, 'plate.top'); e.skipped; // concave edges left out, counted"
|
|
1741
1593
|
]
|
|
@@ -1754,11 +1606,26 @@
|
|
|
1754
1606
|
}
|
|
1755
1607
|
],
|
|
1756
1608
|
"description": "facesNamed(part, pattern) → the faces whose name matches `pattern`. ",
|
|
1757
|
-
"doc": "Faces by the name the helper that built them recorded (see [docs/architecture.md](architecture.md), Face identity). `Manifold.cube` / `cylinder` / `sphere`, `tube`, `hexPrism`, `roundedBox`, `makeExtrude`, `makeRevolve`, `sweep` / `sweepPoints` and a parallel `makeLoft` stamp every face with `feature.role`: `feature` is the id of the marked block the call ran in (`cube1`, `tapDrillHole-11`), else `<helper>@<n>` in script order; `role` is `top bottom left right front back`, `side top bottom inner`, `surface`, `wall[i]`, `band[i]` / `corner[i]`, `cap0 cap1 wall[g]` (extrude and sweep), `seg[g] end0 end1` (revolve), `cap0 cap1 span[i][j]` (loft: bottom edge `i`, station span `j`). A label in several pieces (a slot through a top, a union of two copies) gets `[k]`, ordered by centre.\n\n\n\n`edgesOf(part, name, { includeConcave?, minAngleDeg? })` returns the convex feature edges that touch the named face, in the shape `convexEdges` returns, so they go straight into `filletEdges` / `chamferEdges`. Only edges on that face: four on a box top, never every edge on the body whose neighbour faces the same way. Concave edges are skipped and counted on `result.skipped` (pass `includeConcave: true` to blend them); it throws, naming the face and the concave count, when no convex edge is left.\n\n`facesNamed` throws, naming the faces that exist, when nothing matches; it never picks a nearby face. The faces carry `center`, `normal`, `tris`, `verts`, `area`, `body`, `name`, `label { feature, role, ordinal }` and `record`, and work wherever a `facesByNormal` face does. `surfaceOf` is the
|
|
1609
|
+
"doc": "Faces by the name the helper that built them recorded (see [docs/architecture.md](architecture.md), Face identity). `Manifold.cube` / `cylinder` / `sphere`, `tube`, `rectTube`, `hexPrism`, `roundedBox`, `makeExtrude`, `makeRevolve`, `sweep` / `sweepPoints` and a parallel `makeLoft` stamp every face with `feature.role`: `feature` is the id of the marked block the call ran in (`cube1`, `tapDrillHole-11`), else `<helper>@<n>` in script order; `role` is `top bottom left right front back`, `side top bottom inner`, `surface`, `wall[i]`, `band[i]` / `corner[i]`, `top bottom left right front back corner[i] innerLeft innerRight innerFront innerBack innerCorner[i]` (rectangular tube), `cap0 cap1 wall[g]` (extrude and sweep), `seg[g] end0 end1` (revolve), `cap0 cap1 span[i][j]` (loft: bottom edge `i`, station span `j`). The hole helper (`holesOnContour`) stamps the faces it cuts: `bore floor` (the wall, a blind hole's bottom), `cbore shoulder` (a counterbore's wall and its flat) and `csk` (a countersink's cone), under the block the call ran in, else `hole@<n>` per call. A label in several pieces (a slot through a top, a union of two copies) gets `[k]`, ordered by centre.\n\n\n\n`edgesOf(part, name, { includeConcave?, minAngleDeg? })` returns the convex feature edges that touch the named face, in the shape `convexEdges` returns, so they go straight into `filletEdges` / `chamferEdges`. Only edges on that face: four on a box top, never every edge on the body whose neighbour faces the same way. Concave edges are skipped and counted on `result.skipped` (pass `includeConcave: true` to blend them); it throws, naming the face and the concave count, when no convex edge is left.\n\n`facesNamed` throws, naming the faces that exist, when nothing matches; it never picks a nearby face. The faces carry `center`, `normal`, `tris`, `verts`, `area`, `body`, `name`, `label { feature, role, ordinal }` and `record`, and work wherever a `facesByNormal` face does. `surfaceOf` is the live surface of the face (`plane`, `cylinder`, `cone`, `sphere`, else the stamp's own kind: `swept`, `lofted`, `mesh`): the record the helper wrote is validated against the face's triangles and re-fit when a translate, rotate, draft, moveFace or blend moved the face, so it is where the face is now. `fit` says `stamped`, `refit` or `none`, `residual` is the worst vertex miss in mm, and `built` is the as-built stamp (see [B-REP_METADATA.md](../B-REP_METADATA.md)). A hull, a fillet cutter or a freehand `Manifold.*` call outside those primitives has no stamped faces.",
|
|
1758
1610
|
"examples": [
|
|
1759
1611
|
"faceNames(part); // ['base.bottom', 'base.top', 'boss.side', …]\nconst top = facesNamed(part, 'base.top')[0];\nconst wp = workplaneFromFace(part, top);\npart = hole(part, wp, 10, 0, 4, 6);\nfacesNamed(part, 'plate.top'); // every piece: plate.top[0], plate.top[1]\nfacesNamed(part, 'boss.wall[*]'); // glob\nsurfaceOf(top); // { kind: 'plane', origin, normal }\npart = chamferEdges(part, edgesOf(part, 'boss.top'), 2); // the edges around that face only\nconst e = edgesOf(part, 'plate.top'); e.skipped; // concave edges left out, counted"
|
|
1760
1612
|
]
|
|
1761
1613
|
},
|
|
1614
|
+
{
|
|
1615
|
+
"name": "bodyFeatures",
|
|
1616
|
+
"signature": "bodyFeatures(part)",
|
|
1617
|
+
"params": [
|
|
1618
|
+
{
|
|
1619
|
+
"name": "part",
|
|
1620
|
+
"text": "part"
|
|
1621
|
+
}
|
|
1622
|
+
],
|
|
1623
|
+
"description": "bodyFeatures(part) → one row per body: `{ index, features, at, ordinal? }`. `features` are the ids of the features with stamped faces on that body, in creation order (`['cylinder1', 'shell1']` for a hollowed cylinder); `index` is the order move / rotateAbout / cut / booleanBod...",
|
|
1624
|
+
"doc": "One row per body of `part`: `{ index, features, at, ordinal? }`. `features`\nare the ids of the features with stamped faces on that body, in creation\norder: a hollowed cylinder is `['cylinder1', 'shell1']`, a box with a hex\ncut is `['cube1', 'hexPrism1']`. That list is the body's name\n([B-REP_METADATA.md](../B-REP_METADATA.md), bodies): `move`, `rotateAbout`,\n`mirror`, `cut`, `booleanBodies` and `externalBody` take\n`{ body: [...features] }` and pick the body with the most of those features,\nthen the fewest others, so naming one feature of the body is enough while\nit stays unique. `ordinal` appears only when another body carries the same\nlist (a pattern or mirror copy before it carries its own stamp), their order\nby centroid; pass it back to pick one of the twins. `index` is the order\nthose helpers see; `at` is the vertex centroid, the legacy `{ at }` form the\ncards still write, which the kernel rewrites to names after the run that\nresolves it.\n\n\n\nA list that matches no body throws, naming every body's features. A list\nthat matches several equally throws asking for `ordinal`, unless the\nreference also carries `at`, which then settles it.",
|
|
1625
|
+
"examples": [
|
|
1626
|
+
"bodyFeatures(part);\n// [{ index: 0, features: ['cube1', 'hexPrism1'], at: [-80, 0, 0] },\n// { index: 1, features: ['cylinder1', 'shell1'], at: [0, 0, 15.5] }]\npart = rotateAbout(part, 'z', -72, null, { bodies: [{ body: ['cylinder1', 'shell1'] }] });\npart = cut(part, plane, { bodies: [{ body: ['cube1'] }], keep: '-' });"
|
|
1627
|
+
]
|
|
1628
|
+
},
|
|
1762
1629
|
{
|
|
1763
1630
|
"name": "edgesOf",
|
|
1764
1631
|
"signature": "edgesOf(part, pattern, opts = {})",
|
|
@@ -1778,7 +1645,7 @@
|
|
|
1778
1645
|
}
|
|
1779
1646
|
],
|
|
1780
1647
|
"description": "edgesOf(part, name, opts?) → the convex feature edges around the named face(s), in the shape convexEdges returns, so they go straight into filletEdges / chamferEdges. `name` is anything facesNamed accepts. ",
|
|
1781
|
-
"doc": "Faces by the name the helper that built them recorded (see [docs/architecture.md](architecture.md), Face identity). `Manifold.cube` / `cylinder` / `sphere`, `tube`, `hexPrism`, `roundedBox`, `makeExtrude`, `makeRevolve`, `sweep` / `sweepPoints` and a parallel `makeLoft` stamp every face with `feature.role`: `feature` is the id of the marked block the call ran in (`cube1`, `tapDrillHole-11`), else `<helper>@<n>` in script order; `role` is `top bottom left right front back`, `side top bottom inner`, `surface`, `wall[i]`, `band[i]` / `corner[i]`, `cap0 cap1 wall[g]` (extrude and sweep), `seg[g] end0 end1` (revolve), `cap0 cap1 span[i][j]` (loft: bottom edge `i`, station span `j`). A label in several pieces (a slot through a top, a union of two copies) gets `[k]`, ordered by centre.\n\n\n\n`edgesOf(part, name, { includeConcave?, minAngleDeg? })` returns the convex feature edges that touch the named face, in the shape `convexEdges` returns, so they go straight into `filletEdges` / `chamferEdges`. Only edges on that face: four on a box top, never every edge on the body whose neighbour faces the same way. Concave edges are skipped and counted on `result.skipped` (pass `includeConcave: true` to blend them); it throws, naming the face and the concave count, when no convex edge is left.\n\n`facesNamed` throws, naming the faces that exist, when nothing matches; it never picks a nearby face. The faces carry `center`, `normal`, `tris`, `verts`, `area`, `body`, `name`, `label { feature, role, ordinal }` and `record`, and work wherever a `facesByNormal` face does. `surfaceOf` is the
|
|
1648
|
+
"doc": "Faces by the name the helper that built them recorded (see [docs/architecture.md](architecture.md), Face identity). `Manifold.cube` / `cylinder` / `sphere`, `tube`, `rectTube`, `hexPrism`, `roundedBox`, `makeExtrude`, `makeRevolve`, `sweep` / `sweepPoints` and a parallel `makeLoft` stamp every face with `feature.role`: `feature` is the id of the marked block the call ran in (`cube1`, `tapDrillHole-11`), else `<helper>@<n>` in script order; `role` is `top bottom left right front back`, `side top bottom inner`, `surface`, `wall[i]`, `band[i]` / `corner[i]`, `top bottom left right front back corner[i] innerLeft innerRight innerFront innerBack innerCorner[i]` (rectangular tube), `cap0 cap1 wall[g]` (extrude and sweep), `seg[g] end0 end1` (revolve), `cap0 cap1 span[i][j]` (loft: bottom edge `i`, station span `j`). The hole helper (`holesOnContour`) stamps the faces it cuts: `bore floor` (the wall, a blind hole's bottom), `cbore shoulder` (a counterbore's wall and its flat) and `csk` (a countersink's cone), under the block the call ran in, else `hole@<n>` per call. A label in several pieces (a slot through a top, a union of two copies) gets `[k]`, ordered by centre.\n\n\n\n`edgesOf(part, name, { includeConcave?, minAngleDeg? })` returns the convex feature edges that touch the named face, in the shape `convexEdges` returns, so they go straight into `filletEdges` / `chamferEdges`. Only edges on that face: four on a box top, never every edge on the body whose neighbour faces the same way. Concave edges are skipped and counted on `result.skipped` (pass `includeConcave: true` to blend them); it throws, naming the face and the concave count, when no convex edge is left.\n\n`facesNamed` throws, naming the faces that exist, when nothing matches; it never picks a nearby face. The faces carry `center`, `normal`, `tris`, `verts`, `area`, `body`, `name`, `label { feature, role, ordinal }` and `record`, and work wherever a `facesByNormal` face does. `surfaceOf` is the live surface of the face (`plane`, `cylinder`, `cone`, `sphere`, else the stamp's own kind: `swept`, `lofted`, `mesh`): the record the helper wrote is validated against the face's triangles and re-fit when a translate, rotate, draft, moveFace or blend moved the face, so it is where the face is now. `fit` says `stamped`, `refit` or `none`, `residual` is the worst vertex miss in mm, and `built` is the as-built stamp (see [B-REP_METADATA.md](../B-REP_METADATA.md)). A hull, a fillet cutter or a freehand `Manifold.*` call outside those primitives has no stamped faces.",
|
|
1782
1649
|
"examples": [
|
|
1783
1650
|
"faceNames(part); // ['base.bottom', 'base.top', 'boss.side', …]\nconst top = facesNamed(part, 'base.top')[0];\nconst wp = workplaneFromFace(part, top);\npart = hole(part, wp, 10, 0, 4, 6);\nfacesNamed(part, 'plate.top'); // every piece: plate.top[0], plate.top[1]\nfacesNamed(part, 'boss.wall[*]'); // glob\nsurfaceOf(top); // { kind: 'plane', origin, normal }\npart = chamferEdges(part, edgesOf(part, 'boss.top'), 2); // the edges around that face only\nconst e = edgesOf(part, 'plate.top'); e.skipped; // concave edges left out, counted"
|
|
1784
1651
|
]
|
|
@@ -1797,9 +1664,80 @@
|
|
|
1797
1664
|
}
|
|
1798
1665
|
],
|
|
1799
1666
|
"description": "edgesNamed(part, ...names) → the mesh segments of the edges between two named faces, for makeSweepPath / filletAlongPath. ",
|
|
1800
|
-
"doc": "The one edge reference a script should hold. An edge is the pair of stamped faces it lies between, so the name survives every edit that keeps those faces, where `edge(part, 17)` renumbers after any earlier change and a literal `va/vb` wire breaks as soon as the geometry moves.\n\n\n\n- Face order inside a name does not matter (`a~b` is `b~a`). Names come from `faceNames(part)`, `list_feature_edges`, or the Fillet card.\n- A bare pair returns every chain between those faces. `[k]` picks one chain and throws when the pair no longer has that many chains (the pieces changed): re-pick, or use the bare name. `*` globs either side.\n- A face role may already end in `[i]` (`extrude1.wall[0]~extrude1.wall[1]`). That index stays on the face. The chain ordinal is a further `[k]` only when that pair meets in more than one chain.\n- Returns the same segment rows `edge()` returns (`a`, `b`, `va`, `vb`, `length`, `mid`, plus `n0` / `n1` and `name`), so `makeSweepPath` and `filletAlongPath` are unchanged. `result.names` lists the chains it matched.\n- Throws, listing the edges that exist, when a name matches nothing. It never substitutes a nearby edge.\n- Every face has a name: helper roles (`cube1.top`), fillet and chamfer surfaces (`fillet1.round`, `chamfer2.bevel`, and the spherical corner balls of `filletEdges(..., { sphericalCorners: true })` as `fillet1.corner[k]`; the block id Accept mints, positional like `fillet-16` only on an older block with no `id=`, one piece per contiguous strip), uploads by coplanar group (`import@1.f3`),
|
|
1667
|
+
"doc": "The one edge reference a script should hold. An edge is the pair of stamped faces it lies between, so the name survives every edit that keeps those faces, where `edge(part, 17)` renumbers after any earlier change and a literal `va/vb` wire breaks as soon as the geometry moves.\n\n\n\n- Face order inside a name does not matter (`a~b` is `b~a`). Names come from `faceNames(part)`, `list_feature_edges`, or the Fillet card.\n- A bare pair returns every chain between those faces. `[k]` picks one chain and throws when the pair no longer has that many chains (the pieces changed): re-pick, or use the bare name. `*` globs either side.\n- A face role may already end in `[i]` (`extrude1.wall[0]~extrude1.wall[1]`). That index stays on the face. The chain ordinal is a further `[k]` only when that pair meets in more than one chain.\n- A role built in several pieces carries an index on each piece: a blend on two edges is `fillet1.round[0]` and `fillet1.round[1]`. The bare role names every piece, so `plate.top~fillet1.round` is the foot of both.\n- A blend that fills a concave corner ends in flat caps, `fillet1.cap[k]`, in the plane of the faces it ends at. Its end arc is `fillet1.cap~fillet1.round`: write that to carry a fillet along a wall's top edge over the blend (`edgesNamed(part, 'wall.back~wall.top', 'fillet1.cap[0]~fillet1.round[0]')`). Where that path ends on a taller round boss, the fillet stops at the boss.\n- Returns the same segment rows `edge()` returns (`a`, `b`, `va`, `vb`, `length`, `mid`, plus `n0` / `n1` and `name`), so `makeSweepPath` and `filletAlongPath` are unchanged. A row of an edge that is a line or a circle also carries `tan`, the curve's direction at its two ends: `makeSweepPath` reads from it where two named edges meet at a corner, and keeps that vertex as a knot of the path (`corners`). `result.names` lists the chains it matched.\n- Throws, listing the edges that exist, when a name matches nothing. It never substitutes a nearby edge.\n- Every face has a name: helper roles (`cube1.top`), fillet and chamfer surfaces (`fillet1.round`, `chamfer2.bevel`, and the spherical corner balls of `filletEdges(..., { sphericalCorners: true })` as `fillet1.corner[k]`; the block id Accept mints, positional like `fillet-16` only on an older block with no `id=`, one piece per contiguous strip), uploads by coplanar group (`import@1.f3`), freehand `Manifold.*` runs by their block (`snippet2.f7`, else `script.f7`), and a sheet-metal part by role under its block: `sheetMetal-1.base.top`, a flange `b1.top` / `b1.bottom` / its tip `b1.u1`, the bend `b1.inner` / `b1.outer`, an outline wall `base.wall[e]`, a cut-out `c1.wall[e]`, a hole `h1.bore`, a bead `d1.outer` (so `sheetMetal-1.base.top~sheetMetal-1.d1.outer` is a bead's toe).\n- `filletAlongPath` also refuses a path whose knots are not on an edge of the solid (a stale literal wire), instead of sweeping a cutter through air.\n- A name resolves at any angle, a round's tangency seam included (`fillet1.round~plate.top`): it is an edge to draw, pick, convert, offset and sweep along. It has no corner to blend, so `filletAlongPath` on it throws \"this fillet edge is a tangency seam\" (and `filletEdges` its concavity error). Blend the edges of the round that do have a corner: its end arcs (`plate.left~fillet1.round`).",
|
|
1668
|
+
"examples": [
|
|
1669
|
+
"const e1 = edgesNamed(part, 'plate.top~boss.side'); // every chain between those faces\nconst e2 = edgesNamed(part, 'plate.top~boss.side[1]'); // one chain of a pair that meets twice\nconst e3 = edgesNamed(part, 'cube1.top~cube1.front', 'cube1.top~cube1.right'); // several edges, one list\nconst e4 = edgesNamed(part, 'boss.top~boss.wall[*]'); // glob: the rim of a hex boss\npart = filletAlongPath(part, makeSweepPath(e1), 2);\npart = filletAlongPath(part, makeSweepPath(edgesNamed(part, 'plate.left~fillet1.round')), 0.5, { profile: 'chamfer' }); // the round's end arc on the side wall"
|
|
1670
|
+
]
|
|
1671
|
+
},
|
|
1672
|
+
{
|
|
1673
|
+
"name": "edgeCurves",
|
|
1674
|
+
"signature": "edgeCurves(part, ...names)",
|
|
1675
|
+
"params": [
|
|
1676
|
+
{
|
|
1677
|
+
"name": "part",
|
|
1678
|
+
"text": "part"
|
|
1679
|
+
},
|
|
1680
|
+
{
|
|
1681
|
+
"name": "names",
|
|
1682
|
+
"text": "...names"
|
|
1683
|
+
}
|
|
1684
|
+
],
|
|
1685
|
+
"description": "edgeCurves(part, ...names) → each named edge's curve. ",
|
|
1686
|
+
"doc": "The analytic curve of each named edge: one row per chain the names match (`edgesNamed` naming: a bare pair, `[k]`, `*`; no names lists every edge). A row is `{ name, kind, … }` with `kind` `line` (`a`, `b`, `dir`, `length`), `circle` (`center`, `axis`, `radius`, `closed`, `start`, `end`, `sweep`, and the lattice `segments` / `phaseDir` its vertices sit on), `ellipse` (`center`, `normal`, `majorDir`, `major`, `minor`) or `polyline` (`points`) when nothing analytic is within 0.05 mm of every vertex. `fit` says `derived` (from the two faces' live surface records: two planes meet along a line, a plane and a cylinder along a circle or an ellipse, a plane and a cone or a sphere along a circle), `fit` (from the vertices alone, for a blend seam or a loft wall) or `mesh`; `residual` is the worst vertex miss in mm. The same rows appear as `curve` on `list_feature_edges` and are what Convert (slice 5) builds a sketch from. Throws, naming the edges that exist, when a name matches nothing ([B-REP_METADATA.md](../B-REP_METADATA.md)).",
|
|
1801
1687
|
"examples": [
|
|
1802
|
-
"
|
|
1688
|
+
"edgeCurves(part, 'boss.top~boss.side')[0]; // { kind: 'circle', center, axis, radius: 5, closed: true, segments: 52, phaseDir, fit: 'derived' }\nedgeCurves(part, 'plate.top~plate.front')[0]; // { kind: 'line', a, b, dir, length: 40 }\nedgeCurves(part, 'cut1.plane~post.side')[0]; // { kind: 'ellipse', major, minor, … } for an oblique cut through a cylinder\nedgeCurves(part).filter((e) => e.kind === 'circle'); // every circular edge on the part"
|
|
1689
|
+
]
|
|
1690
|
+
},
|
|
1691
|
+
{
|
|
1692
|
+
"name": "convertEdges",
|
|
1693
|
+
"signature": "convertEdges(part, plane, names, opts = {})",
|
|
1694
|
+
"params": [
|
|
1695
|
+
{
|
|
1696
|
+
"name": "part",
|
|
1697
|
+
"text": "part"
|
|
1698
|
+
},
|
|
1699
|
+
{
|
|
1700
|
+
"name": "plane",
|
|
1701
|
+
"text": "plane"
|
|
1702
|
+
},
|
|
1703
|
+
{
|
|
1704
|
+
"name": "names",
|
|
1705
|
+
"text": "names"
|
|
1706
|
+
},
|
|
1707
|
+
{
|
|
1708
|
+
"name": "opts",
|
|
1709
|
+
"text": "opts = {}",
|
|
1710
|
+
"default": "{}"
|
|
1711
|
+
}
|
|
1712
|
+
],
|
|
1713
|
+
"description": "convertEdges(part, plane, names, opts?) → sketch geometry from named edges. ",
|
|
1714
|
+
"doc": "Convert: sketch geometry from named edges, on a plane ([B-REP_METADATA.md](../B-REP_METADATA.md) slice 5). Each name (`edgesNamed` naming) becomes one *import* whose `geom` is the edge's curve (`edgeCurves`) projected into `plane` (a `workplaneFromFace` frame): a `line`, a `circle` or `arc` that keeps the rim's lattice (`segments`, `phase`, so an extrude of it meets the rim vertex for vertex), or a `polyline` of the chain's vertices when the edge is seen obliquely. Imports are fixed sketch geometry the solver tessellates into the profile; their entities are addressable by constraints and dimensions as `<id>.c` (centre), `<id>.a` / `<id>.b` (ends), `<id>.e` (the line or arc), `<id>.p<k>` / `<id>.e<k>` (polyline).\n\n**Linked (the default).** Put the imports in the spec and pass the part as `solveContour`'s second argument: `makeCrossSection` then re-projects every import from the live part on its plane on every run, so the sketch follows the model (a bigger boss moves the converted circle). An edge that is gone fails the run naming the edges that exist. **Detached:** `{ linked: false }` returns plain `{ points, lines, arcs }` to splice into a sketch, which then stays where it was. Throws when a name matches nothing or an edge is seen edge-on in that plane.",
|
|
1715
|
+
"examples": [
|
|
1716
|
+
"const fr = workplaneFromFace(part, facesNamed(part, 'boss.top')[0]);\nconst conv = convertEdges(part, fr, ['boss.top~boss.side']); // { imports: [{ id: 'i0', edge, geom: { kind: 'circle', … }, linked: true }] }\nconst c1 = makeCrossSection(fr, solveContour({ points: [], lines: [], arcs: [], dimensions: [], constraints: [], imports: conv.imports }, part));\npart = weld(part.add(placeInFrame(c1.plane, makeExtrude(c1.contours, 4), [0, 0, 0]))); // one taller boss, no slivers\n// A sketch line from the converted arc's end:\n// lines: [{ id: 'e0', a: 'i0.a', b: 'p1' }]"
|
|
1717
|
+
]
|
|
1718
|
+
},
|
|
1719
|
+
{
|
|
1720
|
+
"name": "offsetContour",
|
|
1721
|
+
"signature": "offsetContour(contour, distance, opts = {})",
|
|
1722
|
+
"params": [
|
|
1723
|
+
{
|
|
1724
|
+
"name": "contour",
|
|
1725
|
+
"text": "contour"
|
|
1726
|
+
},
|
|
1727
|
+
{
|
|
1728
|
+
"name": "distance",
|
|
1729
|
+
"text": "distance"
|
|
1730
|
+
},
|
|
1731
|
+
{
|
|
1732
|
+
"name": "opts",
|
|
1733
|
+
"text": "opts = {}",
|
|
1734
|
+
"default": "{}"
|
|
1735
|
+
}
|
|
1736
|
+
],
|
|
1737
|
+
"description": "offsetContour(contour, distance, opts?) → a solved contour's closed chain moved `distance` mm, lines and arcs kept. `contour` is a `solveContour` result or a `makeCrossSection` value made from one; `opts` is `{ side: 'in' | 'out', corners: 'sharp' | 'round', of: [ids] }` (`of`...",
|
|
1738
|
+
"doc": "Offset: a closed loop of a solved contour moved `distance` mm to one side, as a new profile ([B-REP_METADATA.md](../B-REP_METADATA.md) slice 6). `contour` is a `solveContour` result (or a `makeCrossSection` of one); its lines and arcs, and its converted edges, must form one closed chain (pass `opts.of`, ids of the pieces, to choose one loop of a multi-loop sketch; an import id such as `i0` names its whole piece). Lines stay lines, arcs stay arcs about the same centre, and a circle stays a circle with the **same `segments` and `phase`**, so an extrude of the offset of a converted rim meets the rim's lattice vertex for vertex (a lip around a boss welds clean). `opts.side` is `out` (default: away from the loop's inside, whichever way it was drawn) or `in`; `opts.corners` is `sharp` (default: the offset lines meet at a point) or `round` (a quarter arc of radius `distance` about each convex corner). Throws, naming the reason, when the loop is open, when the distance collapses a side or an arc (`vanish`), or when an inward offset turns the loop inside out. The result is `{ type: 'contour', contours, points, lines, arcs, chain }` and goes into `makeCrossSection` like any profile.\n\n\n\nA sketch keeps an offset as a rule rather than as geometry: `solveContour({ …, offsets: [{ id: 'o0', of: ['i0'], distance: 2, side: 'out' }] })` derives the offset loop after every solve from the pieces it names, so it follows a dimension change or a linked edge, and reports it under `offsetEntities` (ids `o0.p<k>`, `o0.e<k>`, `o0.c<k>`). The rail Offset tool and `sketch_offset` write that form. Offsetting a face or model edges writes the outline as `source: true` imports and a rule over them, so the sketch holds the offset only.",
|
|
1739
|
+
"examples": [
|
|
1740
|
+
"const fr = workplaneFromFace(part, facesNamed(part, 'boss.top')[0]);\nconst rim = solveContour({ points: [], lines: [], arcs: [], dimensions: [], constraints: [], imports: convertEdges(part, fr, ['boss.top~boss.side']).imports }, part);\nconst ring = offsetContour(rim, 2); // r = 7, 52 segments, same phase as the rim\nconst cap = makeCrossSection(fr, ring);\npart = part.add(placeInFrame(cap.plane, makeExtrude(cap.contours, 3), [0, 0, 0]));\nconst wall = offsetContour(rect, 3, { side: 'in', corners: 'round' }); // a rounded inner outline of a rectangle sketch"
|
|
1803
1741
|
]
|
|
1804
1742
|
},
|
|
1805
1743
|
{
|
|
@@ -1811,11 +1749,48 @@
|
|
|
1811
1749
|
"text": "face"
|
|
1812
1750
|
}
|
|
1813
1751
|
],
|
|
1814
|
-
"description": "surfaceOf(face) → the SurfaceRecord
|
|
1815
|
-
"doc": "Faces by the name the helper that built them recorded (see [docs/architecture.md](architecture.md), Face identity). `Manifold.cube` / `cylinder` / `sphere`, `tube`, `hexPrism`, `roundedBox`, `makeExtrude`, `makeRevolve`, `sweep` / `sweepPoints` and a parallel `makeLoft` stamp every face with `feature.role`: `feature` is the id of the marked block the call ran in (`cube1`, `tapDrillHole-11`), else `<helper>@<n>` in script order; `role` is `top bottom left right front back`, `side top bottom inner`, `surface`, `wall[i]`, `band[i]` / `corner[i]`, `cap0 cap1 wall[g]` (extrude and sweep), `seg[g] end0 end1` (revolve), `cap0 cap1 span[i][j]` (loft: bottom edge `i`, station span `j`). A label in several pieces (a slot through a top, a union of two copies) gets `[k]`, ordered by centre.\n\n\n\n`edgesOf(part, name, { includeConcave?, minAngleDeg? })` returns the convex feature edges that touch the named face, in the shape `convexEdges` returns, so they go straight into `filletEdges` / `chamferEdges`. Only edges on that face: four on a box top, never every edge on the body whose neighbour faces the same way. Concave edges are skipped and counted on `result.skipped` (pass `includeConcave: true` to blend them); it throws, naming the face and the concave count, when no convex edge is left.\n\n`facesNamed` throws, naming the faces that exist, when nothing matches; it never picks a nearby face. The faces carry `center`, `normal`, `tris`, `verts`, `area`, `body`, `name`, `label { feature, role, ordinal }` and `record`, and work wherever a `facesByNormal` face does. `surfaceOf` is the
|
|
1752
|
+
"description": "surfaceOf(face) → the live SurfaceRecord of a stamped face: `{ kind: 'plane', origin, normal }`, `{ kind: 'cylinder', axisOrigin, axisDir, radius }`, `{ kind: 'cone', apex, axisDir, halfAngle }`, `{ kind: 'sphere', center, radius }`, else the stamp's own kind (`swept`, `lofted...",
|
|
1753
|
+
"doc": "Faces by the name the helper that built them recorded (see [docs/architecture.md](architecture.md), Face identity). `Manifold.cube` / `cylinder` / `sphere`, `tube`, `rectTube`, `hexPrism`, `roundedBox`, `makeExtrude`, `makeRevolve`, `sweep` / `sweepPoints` and a parallel `makeLoft` stamp every face with `feature.role`: `feature` is the id of the marked block the call ran in (`cube1`, `tapDrillHole-11`), else `<helper>@<n>` in script order; `role` is `top bottom left right front back`, `side top bottom inner`, `surface`, `wall[i]`, `band[i]` / `corner[i]`, `top bottom left right front back corner[i] innerLeft innerRight innerFront innerBack innerCorner[i]` (rectangular tube), `cap0 cap1 wall[g]` (extrude and sweep), `seg[g] end0 end1` (revolve), `cap0 cap1 span[i][j]` (loft: bottom edge `i`, station span `j`). The hole helper (`holesOnContour`) stamps the faces it cuts: `bore floor` (the wall, a blind hole's bottom), `cbore shoulder` (a counterbore's wall and its flat) and `csk` (a countersink's cone), under the block the call ran in, else `hole@<n>` per call. A label in several pieces (a slot through a top, a union of two copies) gets `[k]`, ordered by centre.\n\n\n\n`edgesOf(part, name, { includeConcave?, minAngleDeg? })` returns the convex feature edges that touch the named face, in the shape `convexEdges` returns, so they go straight into `filletEdges` / `chamferEdges`. Only edges on that face: four on a box top, never every edge on the body whose neighbour faces the same way. Concave edges are skipped and counted on `result.skipped` (pass `includeConcave: true` to blend them); it throws, naming the face and the concave count, when no convex edge is left.\n\n`facesNamed` throws, naming the faces that exist, when nothing matches; it never picks a nearby face. The faces carry `center`, `normal`, `tris`, `verts`, `area`, `body`, `name`, `label { feature, role, ordinal }` and `record`, and work wherever a `facesByNormal` face does. `surfaceOf` is the live surface of the face (`plane`, `cylinder`, `cone`, `sphere`, else the stamp's own kind: `swept`, `lofted`, `mesh`): the record the helper wrote is validated against the face's triangles and re-fit when a translate, rotate, draft, moveFace or blend moved the face, so it is where the face is now. `fit` says `stamped`, `refit` or `none`, `residual` is the worst vertex miss in mm, and `built` is the as-built stamp (see [B-REP_METADATA.md](../B-REP_METADATA.md)). A hull, a fillet cutter or a freehand `Manifold.*` call outside those primitives has no stamped faces.",
|
|
1816
1754
|
"examples": [
|
|
1817
1755
|
"faceNames(part); // ['base.bottom', 'base.top', 'boss.side', …]\nconst top = facesNamed(part, 'base.top')[0];\nconst wp = workplaneFromFace(part, top);\npart = hole(part, wp, 10, 0, 4, 6);\nfacesNamed(part, 'plate.top'); // every piece: plate.top[0], plate.top[1]\nfacesNamed(part, 'boss.wall[*]'); // glob\nsurfaceOf(top); // { kind: 'plane', origin, normal }\npart = chamferEdges(part, edgesOf(part, 'boss.top'), 2); // the edges around that face only\nconst e = edgesOf(part, 'plate.top'); e.skipped; // concave edges left out, counted"
|
|
1818
1756
|
]
|
|
1757
|
+
},
|
|
1758
|
+
{
|
|
1759
|
+
"name": "circleSegments",
|
|
1760
|
+
"signature": "circleSegments(radius, opts)",
|
|
1761
|
+
"params": [
|
|
1762
|
+
{
|
|
1763
|
+
"name": "radius",
|
|
1764
|
+
"text": "radius"
|
|
1765
|
+
},
|
|
1766
|
+
{
|
|
1767
|
+
"name": "opts",
|
|
1768
|
+
"text": "opts"
|
|
1769
|
+
}
|
|
1770
|
+
],
|
|
1771
|
+
"description": "circleSegments(radius, opts?) → segments for a `radius` mm circle. ",
|
|
1772
|
+
"doc": "Segments for a circle of `radius` mm. This is the tessellation contract ([B-REP_METADATA.md](../B-REP_METADATA.md), rule 5): the one segment policy, used whenever a helper is handed no count. The chord stays within 0.01 mm of the circle, rounded up to a multiple of four (every quadrant has a vertex), clamped to 32..256. `Manifold.cylinder` and `Manifold.sphere` with no or `0` segments, `profileCircle`, `tube` (round, and the corners of a rectangular one by their corner radius), `roundedBox` (by its edge radius), `makeRevolve` (by the profile's outermost radius), the hole cutters, `screwBoss`, and a sketch circle or arc with no `segments` all take it. No card asks for a count. `profileCircle` and the sketch circle evaluate their vertices the way Manifold's own circle does (degree-reduced sin and cos), so their doubles equal a kernel cylinder's bit for bit; a polygon still enters Manifold through `CrossSection`, which quantises it to about 1e-9 mm, and a frame transform adds float noise, so the rims end up a few nanometres apart and `weld` closes them. An explicit count on any helper still wins. `opts` is `{ tol, min, max }` for one call.",
|
|
1773
|
+
"examples": [
|
|
1774
|
+
"circleSegments(5); // 52\ncircleSegments(2.5); // 36\nconst boss = Manifold.cylinder(10, 6, 6); // 56 segments, the policy\nconst c1 = makeCrossSection(fr, profileCircle(6)); // the same 56 vertices\npart = weld(part.add(placeInFrame(c1.plane, makeExtrude(c1.contours, 4), [0, 0, 0])));"
|
|
1775
|
+
]
|
|
1776
|
+
},
|
|
1777
|
+
{
|
|
1778
|
+
"name": "weld",
|
|
1779
|
+
"signature": "weld(part, tolMm = 0.001)",
|
|
1780
|
+
"params": [
|
|
1781
|
+
{
|
|
1782
|
+
"name": "part",
|
|
1783
|
+
"text": "part"
|
|
1784
|
+
},
|
|
1785
|
+
{
|
|
1786
|
+
"name": "tolMm",
|
|
1787
|
+
"text": "tolMm = 0.001",
|
|
1788
|
+
"default": "0.001"
|
|
1789
|
+
}
|
|
1790
|
+
],
|
|
1791
|
+
"description": "Merge vertices within `tolMm` after a boolean. ",
|
|
1792
|
+
"doc": "Merge vertices within `tolMm` after a boolean. The triangles that collapse are dropped, two coincident opposite faces bounded by the same vertices (the host's cap and the base of a solid placed on it) are dropped as a pair, and face ids and names are kept. `part.add(tool)` calls it when the tool only touches the part and the plain union left two bodies, so a sketch solid extruded from a face joins its host through the shared rim instead of being nudged into it. A boolean between two bodies that share a lattice circle leaves rim vertices nanometres apart (Clipper quantisation, frame float noise) and a ring of slivers between them; `weld` closes it, and the shared lattice is what makes that possible (vertices a tenth of a millimetre apart could not be merged). The result is kept only when it is a valid solid whose volume moved by less than 0.02 mm³, otherwise `part` comes back unchanged. `hole` and `screwBoss` weld their own results; wrap a script's own `part.add(...)` of a sketch extrude in `weld(...)` for the same effect.",
|
|
1793
|
+
"examples": []
|
|
1819
1794
|
}
|
|
1820
1795
|
]
|
|
1821
1796
|
}
|