fluidcad 0.0.32 → 0.0.34
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 +3 -2
- package/bin/commands/init.js +55 -0
- package/bin/commands/mcp.js +33 -0
- package/bin/commands/serve.js +77 -0
- package/bin/fluidcad.js +15 -107
- package/lib/dist/common/scene-object.d.ts +4 -1
- package/lib/dist/common/scene-object.js +9 -2
- package/lib/dist/common/solid.d.ts +4 -1
- package/lib/dist/common/solid.js +13 -0
- package/lib/dist/core/2d/tarc.d.ts +20 -2
- package/lib/dist/core/2d/tarc.js +24 -0
- package/lib/dist/core/index.d.ts +2 -1
- package/lib/dist/core/index.js +1 -0
- package/lib/dist/core/interfaces.d.ts +107 -2
- package/lib/dist/core/load.d.ts +2 -2
- package/lib/dist/core/repeat.js +62 -46
- package/lib/dist/core/rib.d.ts +18 -0
- package/lib/dist/core/rib.js +37 -0
- package/lib/dist/features/2d/arc.d.ts +8 -2
- package/lib/dist/features/2d/arc.js +94 -17
- package/lib/dist/features/2d/back.js +3 -2
- package/lib/dist/features/2d/sketch.d.ts +4 -0
- package/lib/dist/features/2d/sketch.js +21 -0
- package/lib/dist/features/2d/tarc-constrained.d.ts +2 -0
- package/lib/dist/features/2d/tarc-constrained.js +8 -0
- package/lib/dist/features/2d/tarc-radius-to-object.d.ts +16 -0
- package/lib/dist/features/2d/tarc-radius-to-object.js +58 -0
- package/lib/dist/features/2d/tarc-to-object.d.ts +18 -0
- package/lib/dist/features/2d/tarc-to-object.js +66 -0
- package/lib/dist/features/2d/tarc-to-point-tangent.d.ts +2 -0
- package/lib/dist/features/2d/tarc-to-point-tangent.js +3 -0
- package/lib/dist/features/2d/tarc-to-point.d.ts +2 -0
- package/lib/dist/features/2d/tarc-to-point.js +3 -0
- package/lib/dist/features/2d/tarc-with-tangent.d.ts +2 -0
- package/lib/dist/features/2d/tarc-with-tangent.js +3 -0
- package/lib/dist/features/2d/tarc.d.ts +2 -0
- package/lib/dist/features/2d/tarc.js +3 -0
- package/lib/dist/features/extrude-base.d.ts +9 -0
- package/lib/dist/features/extrude-base.js +22 -0
- package/lib/dist/features/extrude-to-face.js +1 -5
- package/lib/dist/features/extrude-two-distances.js +1 -2
- package/lib/dist/features/extrude.js +1 -2
- package/lib/dist/features/load.d.ts +6 -0
- package/lib/dist/features/load.js +53 -1
- package/lib/dist/features/mirror-feature.d.ts +3 -2
- package/lib/dist/features/mirror-feature.js +1 -1
- package/lib/dist/features/repeat-circular.d.ts +3 -3
- package/lib/dist/features/repeat-circular.js +8 -1
- package/lib/dist/features/repeat-linear.d.ts +4 -2
- package/lib/dist/features/repeat-linear.js +10 -1
- package/lib/dist/features/repeat-matrix.d.ts +3 -1
- package/lib/dist/features/repeat-matrix.js +7 -2
- package/lib/dist/features/rib.d.ts +31 -0
- package/lib/dist/features/rib.js +321 -0
- package/lib/dist/features/select.d.ts +1 -0
- package/lib/dist/features/select.js +81 -10
- package/lib/dist/features/shell.d.ts +4 -1
- package/lib/dist/features/shell.js +14 -3
- package/lib/dist/filters/edge/belongs-to-face.d.ts +12 -9
- package/lib/dist/filters/edge/belongs-to-face.js +64 -15
- package/lib/dist/filters/filter-builder-base.d.ts +25 -0
- package/lib/dist/filters/filter-builder-base.js +47 -0
- package/lib/dist/filters/filter.js +39 -14
- package/lib/dist/filters/from-object.d.ts +4 -0
- package/lib/dist/filters/from-object.js +10 -0
- package/lib/dist/helpers/clone-transform.d.ts +2 -1
- package/lib/dist/helpers/scene-helpers.d.ts +1 -1
- package/lib/dist/helpers/scene-helpers.js +146 -12
- package/lib/dist/index.d.ts +7 -1
- package/lib/dist/index.js +3 -3
- package/lib/dist/io/file-import.d.ts +5 -1
- package/lib/dist/io/file-import.js +29 -18
- package/lib/dist/math/lazy-matrix.d.ts +31 -0
- package/lib/dist/math/lazy-matrix.js +66 -0
- package/lib/dist/oc/color-transfer.d.ts +19 -8
- package/lib/dist/oc/color-transfer.js +70 -12
- package/lib/dist/oc/constraints/constraint-solver-adaptor.d.ts +5 -0
- package/lib/dist/oc/constraints/constraint-solver-adaptor.js +16 -0
- package/lib/dist/oc/constraints/constraint-solver.d.ts +4 -0
- package/lib/dist/oc/constraints/curve/curve-constraint-solver.d.ts +4 -0
- package/lib/dist/oc/constraints/curve/curve-constraint-solver.js +3 -0
- package/lib/dist/oc/constraints/geometric/geometric-constraint-solver.d.ts +6 -1
- package/lib/dist/oc/constraints/geometric/geometric-constraint-solver.js +4 -0
- package/lib/dist/oc/constraints/geometric/tangent-arc-from-point-tangent.d.ts +8 -0
- package/lib/dist/oc/constraints/geometric/tangent-arc-from-point-tangent.js +111 -0
- package/lib/dist/oc/constraints/geometric/tangent-arc-radius-to-object.d.ts +8 -0
- package/lib/dist/oc/constraints/geometric/tangent-arc-radius-to-object.js +161 -0
- package/lib/dist/oc/extrude-ops.d.ts +2 -1
- package/lib/dist/oc/extrude-ops.js +51 -2
- package/lib/dist/oc/mesh.d.ts +9 -4
- package/lib/dist/oc/mesh.js +14 -13
- package/lib/dist/oc/rib-ops.d.ts +35 -0
- package/lib/dist/oc/rib-ops.js +619 -0
- package/lib/dist/oc/shell-ops.d.ts +2 -1
- package/lib/dist/oc/shell-ops.js +5 -2
- package/lib/dist/oc/topology-index.d.ts +6 -0
- package/lib/dist/oc/topology-index.js +36 -0
- package/lib/dist/rendering/mesh-builder.d.ts +3 -0
- package/lib/dist/rendering/mesh-builder.js +8 -4
- package/lib/dist/rendering/render-edge.d.ts +2 -1
- package/lib/dist/rendering/render-edge.js +2 -2
- package/lib/dist/rendering/render-face.d.ts +2 -1
- package/lib/dist/rendering/render-face.js +2 -2
- package/lib/dist/rendering/render-solid.d.ts +2 -1
- package/lib/dist/rendering/render-solid.js +3 -5
- package/lib/dist/rendering/render-wire.d.ts +2 -1
- package/lib/dist/rendering/render-wire.js +2 -2
- package/lib/dist/rendering/render.d.ts +4 -0
- package/lib/dist/rendering/render.js +50 -2
- package/lib/dist/rendering/scene-compare.js +3 -0
- package/lib/dist/rendering/scene.d.ts +1 -0
- package/lib/dist/rendering/scene.js +4 -0
- package/lib/dist/scene-manager.d.ts +4 -2
- package/lib/dist/scene-manager.js +12 -4
- package/lib/dist/tests/features/2d/arc.test.js +64 -0
- package/lib/dist/tests/features/2d/back.test.js +17 -1
- package/lib/dist/tests/features/2d/tarc.test.js +157 -0
- package/lib/dist/tests/features/color-lineage.test.js +18 -0
- package/lib/dist/tests/features/filter-positional.test.d.ts +1 -0
- package/lib/dist/tests/features/filter-positional.test.js +129 -0
- package/lib/dist/tests/features/repeat-user-repro.test.d.ts +1 -0
- package/lib/dist/tests/features/repeat-user-repro.test.js +60 -0
- package/lib/dist/tests/features/rib.test.d.ts +1 -0
- package/lib/dist/tests/features/rib.test.js +598 -0
- package/lib/dist/tests/features/shell.test.js +36 -0
- package/lib/dist/tests/global-setup.js +2 -1
- package/lib/dist/tests/helpers/extract-blocks.d.ts +9 -0
- package/lib/dist/tests/helpers/extract-blocks.js +56 -0
- package/lib/dist/tests/llm-docs-examples.test.d.ts +1 -0
- package/lib/dist/tests/llm-docs-examples.test.js +62 -0
- package/lib/dist/tests/scene-compare.test.d.ts +1 -0
- package/lib/dist/tests/scene-compare.test.js +77 -0
- package/lib/dist/tests/setup.js +2 -1
- package/lib/dist/tsconfig.tsbuildinfo +1 -1
- package/llm-docs/.coverage-allowlist.txt +9 -0
- package/llm-docs/api/arc.md +48 -0
- package/llm-docs/api/axis.md +42 -0
- package/llm-docs/api/bezier.md +42 -0
- package/llm-docs/api/booleans.md +44 -0
- package/llm-docs/api/chamfer.md +40 -0
- package/llm-docs/api/circle.md +36 -0
- package/llm-docs/api/color.md +34 -0
- package/llm-docs/api/connect.md +41 -0
- package/llm-docs/api/constraint-qualifiers.md +48 -0
- package/llm-docs/api/copy.md +63 -0
- package/llm-docs/api/cursor-lines.md +50 -0
- package/llm-docs/api/cursor-move.md +61 -0
- package/llm-docs/api/cut.md +55 -0
- package/llm-docs/api/draft.md +36 -0
- package/llm-docs/api/edge-filter.md +57 -0
- package/llm-docs/api/ellipse.md +34 -0
- package/llm-docs/api/extrude.md +74 -0
- package/llm-docs/api/face-filter.md +61 -0
- package/llm-docs/api/fillet.md +51 -0
- package/llm-docs/api/index.json +139 -0
- package/llm-docs/api/line.md +42 -0
- package/llm-docs/api/load.md +37 -0
- package/llm-docs/api/local.md +38 -0
- package/llm-docs/api/loft.md +37 -0
- package/llm-docs/api/mirror.md +44 -0
- package/llm-docs/api/offset.md +36 -0
- package/llm-docs/api/part.md +40 -0
- package/llm-docs/api/plane.md +44 -0
- package/llm-docs/api/polygon.md +37 -0
- package/llm-docs/api/primitive-solids.md +39 -0
- package/llm-docs/api/project-intersect.md +48 -0
- package/llm-docs/api/rect.md +48 -0
- package/llm-docs/api/remove.md +32 -0
- package/llm-docs/api/repeat.md +79 -0
- package/llm-docs/api/revolve.md +38 -0
- package/llm-docs/api/rib.md +40 -0
- package/llm-docs/api/rotate.md +37 -0
- package/llm-docs/api/select.md +41 -0
- package/llm-docs/api/shell.md +41 -0
- package/llm-docs/api/sketch.md +76 -0
- package/llm-docs/api/slot.md +36 -0
- package/llm-docs/api/split-trim.md +42 -0
- package/llm-docs/api/sweep.md +43 -0
- package/llm-docs/api/tarc.md +45 -0
- package/llm-docs/api/tcircle.md +38 -0
- package/llm-docs/api/tline.md +42 -0
- package/llm-docs/api/translate.md +40 -0
- package/llm-docs/api/types/aline.md +35 -0
- package/llm-docs/api/types/arc-angles.md +29 -0
- package/llm-docs/api/types/arc-points.md +48 -0
- package/llm-docs/api/types/axis-like.md +38 -0
- package/llm-docs/api/types/axis.md +21 -0
- package/llm-docs/api/types/boolean-operation.md +50 -0
- package/llm-docs/api/types/circular-repeat-options.md +31 -0
- package/llm-docs/api/types/common.md +32 -0
- package/llm-docs/api/types/cut.md +125 -0
- package/llm-docs/api/types/draft.md +21 -0
- package/llm-docs/api/types/extrudable-geometry.md +23 -0
- package/llm-docs/api/types/extrude.md +194 -0
- package/llm-docs/api/types/geometry.md +51 -0
- package/llm-docs/api/types/hline.md +35 -0
- package/llm-docs/api/types/linear-repeat-options.md +31 -0
- package/llm-docs/api/types/loft.md +154 -0
- package/llm-docs/api/types/mirror.md +35 -0
- package/llm-docs/api/types/offset.md +31 -0
- package/llm-docs/api/types/plane-like.md +35 -0
- package/llm-docs/api/types/plane-transform-options.md +29 -0
- package/llm-docs/api/types/plane.md +21 -0
- package/llm-docs/api/types/point-like.md +22 -0
- package/llm-docs/api/types/point2dlike.md +26 -0
- package/llm-docs/api/types/polygon.md +46 -0
- package/llm-docs/api/types/rect.md +128 -0
- package/llm-docs/api/types/revolve.md +102 -0
- package/llm-docs/api/types/rib.md +133 -0
- package/llm-docs/api/types/scene-object.md +33 -0
- package/llm-docs/api/types/select.md +21 -0
- package/llm-docs/api/types/shell.md +54 -0
- package/llm-docs/api/types/slot.md +43 -0
- package/llm-docs/api/types/sweep.md +189 -0
- package/llm-docs/api/types/tangent-arc-two-objects.md +46 -0
- package/llm-docs/api/types/transformable.md +93 -0
- package/llm-docs/api/types/trim.md +27 -0
- package/llm-docs/api/types/two-objects-tangent-line.md +46 -0
- package/llm-docs/api/types/vertex.md +17 -0
- package/llm-docs/api/types/vline.md +35 -0
- package/llm-docs/concepts/coordinate-system.md +45 -0
- package/llm-docs/concepts/history-and-rollback.md +40 -0
- package/llm-docs/concepts/last-selection.md +49 -0
- package/llm-docs/concepts/scene-graph.md +37 -0
- package/llm-docs/index.json +1750 -0
- package/mcp/dist/client.d.ts +64 -0
- package/mcp/dist/client.js +248 -0
- package/mcp/dist/discovery.d.ts +11 -0
- package/mcp/dist/discovery.js +78 -0
- package/mcp/dist/docs-index.d.ts +81 -0
- package/mcp/dist/docs-index.js +261 -0
- package/mcp/dist/resources.d.ts +4 -0
- package/mcp/dist/resources.js +115 -0
- package/mcp/dist/server.d.ts +12 -0
- package/mcp/dist/server.js +489 -0
- package/mcp/dist/tools/coordination.d.ts +9 -0
- package/mcp/dist/tools/coordination.js +46 -0
- package/mcp/dist/tools/docs.d.ts +66 -0
- package/mcp/dist/tools/docs.js +122 -0
- package/mcp/dist/tools/engine.d.ts +56 -0
- package/mcp/dist/tools/engine.js +145 -0
- package/mcp/dist/tools/inspection.d.ts +75 -0
- package/mcp/dist/tools/inspection.js +121 -0
- package/mcp/dist/tools/screenshot.d.ts +63 -0
- package/mcp/dist/tools/screenshot.js +263 -0
- package/mcp/dist/tools/source.d.ts +84 -0
- package/mcp/dist/tools/source.js +434 -0
- package/mcp/dist/tools/workspaces.d.ts +13 -0
- package/mcp/dist/tools/workspaces.js +33 -0
- package/mcp/dist/types.d.ts +18 -0
- package/mcp/dist/types.js +11 -0
- package/package.json +19 -5
- package/server/dist/code-editor.d.ts +36 -0
- package/server/dist/code-editor.js +8 -0
- package/server/dist/fluidcad-server.d.ts +50 -0
- package/server/dist/fluidcad-server.js +153 -1
- package/server/dist/global-registry.d.ts +30 -0
- package/server/dist/global-registry.js +126 -0
- package/server/dist/index.js +171 -26
- package/server/dist/instance-file.d.ts +31 -0
- package/server/dist/instance-file.js +73 -0
- package/server/dist/lint-fluid-js.d.ts +15 -0
- package/server/dist/lint-fluid-js.js +271 -0
- package/server/dist/routes/editor.d.ts +24 -0
- package/server/dist/routes/editor.js +44 -0
- package/server/dist/routes/export.d.ts +1 -1
- package/server/dist/routes/export.js +45 -8
- package/server/dist/routes/health.d.ts +7 -0
- package/server/dist/routes/health.js +14 -0
- package/server/dist/routes/lint.d.ts +10 -0
- package/server/dist/routes/lint.js +28 -0
- package/server/dist/routes/render.d.ts +33 -0
- package/server/dist/routes/render.js +34 -0
- package/server/dist/routes/scene.d.ts +5 -0
- package/server/dist/routes/scene.js +48 -0
- package/server/dist/routes/screenshot.js +68 -1
- package/server/dist/ws-protocol.d.ts +56 -2
- package/ui/dist/assets/{index-DMw0OYCF.js → index-BdqrMDRu.js} +30 -30
- package/ui/dist/index.html +1 -1
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
---
|
|
2
|
+
id: api/part
|
|
3
|
+
title: part(name, callback)
|
|
4
|
+
summary: Isolation boundary for assembly modeling. Shapes inside a part only auto-fuse with each other, never with siblings outside.
|
|
5
|
+
tags: [api, utility, assembly]
|
|
6
|
+
symbols: [part]
|
|
7
|
+
seeAlso: [concepts/scene-graph]
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
# part
|
|
11
|
+
|
|
12
|
+
Imported from `fluidcad/core`.
|
|
13
|
+
|
|
14
|
+
```ts
|
|
15
|
+
part(name: string, callback: () => void)
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
Creates an isolation boundary. Shapes inside the callback auto-fuse with
|
|
19
|
+
each other but **not** with siblings outside the part. Reach for `part`
|
|
20
|
+
when you have multiple distinct components in one assembly file.
|
|
21
|
+
|
|
22
|
+
Wrapping `part(...)` in a function gives parametric, reusable parts.
|
|
23
|
+
|
|
24
|
+
## Example
|
|
25
|
+
|
|
26
|
+
```fluid.js
|
|
27
|
+
import { cylinder, extrude, part, rect, sketch } from "fluidcad/core";
|
|
28
|
+
|
|
29
|
+
part("base", () => {
|
|
30
|
+
sketch("xy", () => rect(120, 80).centered());
|
|
31
|
+
extrude(20);
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
part("pillar", () => {
|
|
35
|
+
cylinder(15, 50).translate(0, 0, 20);
|
|
36
|
+
});
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
See [[concepts/scene-graph]] for how parts compose with the rest of the
|
|
40
|
+
feature tree.
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
---
|
|
2
|
+
id: api/plane
|
|
3
|
+
title: plane(reference, options?)
|
|
4
|
+
summary: Builds a reference plane from a standard name, an existing plane, a face, or the midpoint between two planes. Optional offset/rotation parametrize it.
|
|
5
|
+
tags: [api, reference, geometry]
|
|
6
|
+
symbols: [plane]
|
|
7
|
+
seeAlso: [api/axis, api/local, api/sketch]
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
# plane
|
|
11
|
+
|
|
12
|
+
Imported from `fluidcad/core`.
|
|
13
|
+
|
|
14
|
+
```ts
|
|
15
|
+
plane(plane: PlaneLike, options: PlaneTransformOptions)
|
|
16
|
+
plane(plane: PlaneLike, offset: number)
|
|
17
|
+
plane(selection: SceneObject) // from a face
|
|
18
|
+
plane(selection: SceneObject, options)
|
|
19
|
+
plane(selection: SceneObject, offset)
|
|
20
|
+
plane(plane: Plane, options) // transform an existing plane
|
|
21
|
+
plane(p1: PlaneLike, p2: PlaneLike, options?) // midplane between two planes
|
|
22
|
+
plane(p1: Plane, p2: Plane, options?)
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
`PlaneTransformOptions`:
|
|
26
|
+
|
|
27
|
+
- `offset: number` — translate along the normal.
|
|
28
|
+
- `rotateX`, `rotateY`, `rotateZ` — degrees.
|
|
29
|
+
|
|
30
|
+
## Example
|
|
31
|
+
|
|
32
|
+
```fluid.js
|
|
33
|
+
import { circle, extrude, plane, rect, sketch } from "fluidcad/core";
|
|
34
|
+
|
|
35
|
+
sketch("xy", () => rect(100, 60).centered());
|
|
36
|
+
extrude(20);
|
|
37
|
+
|
|
38
|
+
const top = plane("xy", 80); // XY shifted up 80
|
|
39
|
+
sketch(top, () => circle(20));
|
|
40
|
+
extrude(10);
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
See [[api/axis]] for the axis counterpart and [[api/local]] for the
|
|
44
|
+
sketch-relative axes.
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
---
|
|
2
|
+
id: api/polygon
|
|
3
|
+
title: polygon(n, diameter, mode?)
|
|
4
|
+
summary: Regular n-sided polygon sized by the inscribed or circumscribed diameter — no manual `[r*cos, r*sin]` math.
|
|
5
|
+
tags: [api, 2d, primitive]
|
|
6
|
+
symbols: [polygon]
|
|
7
|
+
seeAlso: [api/circle, api/sketch]
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
# polygon
|
|
11
|
+
|
|
12
|
+
Imported from `fluidcad/core`.
|
|
13
|
+
|
|
14
|
+
```ts
|
|
15
|
+
polygon(numberOfSides, diameter, mode?)
|
|
16
|
+
polygon(center, numberOfSides, diameter, mode?)
|
|
17
|
+
polygon(targetPlane, numberOfSides, diameter)
|
|
18
|
+
polygon(targetPlane, numberOfSides, diameter, mode)
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
Regular polygon. `mode` is `"inscribed"` (default — corners sit on the
|
|
22
|
+
diameter circle) or `"circumscribed"` (edge midpoints sit on the diameter
|
|
23
|
+
circle). Returns `Polygon` with `.getEdge(i)` / `.getVertex(i)` (0-based).
|
|
24
|
+
|
|
25
|
+
## Example
|
|
26
|
+
|
|
27
|
+
```fluid.js
|
|
28
|
+
import { extrude, polygon, sketch } from "fluidcad/core";
|
|
29
|
+
|
|
30
|
+
sketch("xy", () => polygon(6, 60)); // hexagon, 60 diameter
|
|
31
|
+
extrude(10);
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
Prefer this over computing corner coordinates with trig — the kernel
|
|
35
|
+
handles inscribed/circumscribed sizing exactly.
|
|
36
|
+
|
|
37
|
+
See [[api/circle]] for the matching curve primitive.
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
---
|
|
2
|
+
id: api/primitive-solids
|
|
3
|
+
title: sphere / cylinder
|
|
4
|
+
summary: Sketch-free primitive solids. Both return Transformable, so translate/rotate/mirror chain directly off the result.
|
|
5
|
+
tags: [api, 3d, solid, primitive]
|
|
6
|
+
symbols: [sphere, cylinder]
|
|
7
|
+
seeAlso: [api/extrude, api/revolve]
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
# sphere / cylinder
|
|
11
|
+
|
|
12
|
+
Imported from `fluidcad/core`.
|
|
13
|
+
|
|
14
|
+
```ts
|
|
15
|
+
sphere(radius)
|
|
16
|
+
sphere(radius, angle) // partial sphere (degrees)
|
|
17
|
+
|
|
18
|
+
cylinder(radius, height)
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
Both return `Transformable`, so you can chain `.translate()`, `.rotate()`,
|
|
22
|
+
or `.mirror()` directly on the result instead of wrapping in a separate
|
|
23
|
+
transform call.
|
|
24
|
+
|
|
25
|
+
These primitives don't need a sketch — reach for them when you want a
|
|
26
|
+
ball-bearing, dowel, or shaft and the parametric sketch+revolve dance
|
|
27
|
+
would be ceremony.
|
|
28
|
+
|
|
29
|
+
## Example
|
|
30
|
+
|
|
31
|
+
```fluid.js
|
|
32
|
+
import { cylinder, sphere } from "fluidcad/core";
|
|
33
|
+
|
|
34
|
+
sphere(25).translate(0, 0, 100);
|
|
35
|
+
cylinder(10, 50).rotate("x", 90);
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
See [[api/revolve]] for fully custom solids of revolution and
|
|
39
|
+
[[api/extrude]] for the sketch-driven equivalent.
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
---
|
|
2
|
+
id: api/project-intersect
|
|
3
|
+
title: project / intersect
|
|
4
|
+
summary: Reduce 3D geometry to 2D sketch wires. `project` flattens edges along the sketch normal; `intersect` cuts the sketch plane through 3D objects.
|
|
5
|
+
tags: [api, 2d, modifier, projection]
|
|
6
|
+
symbols: [project, intersect]
|
|
7
|
+
seeAlso: [api/sketch, api/offset]
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
# project / intersect
|
|
11
|
+
|
|
12
|
+
Imported from `fluidcad/core`.
|
|
13
|
+
|
|
14
|
+
```ts
|
|
15
|
+
project(...sourceObjects: SceneObject[])
|
|
16
|
+
project(targetPlane, sourceObjects)
|
|
17
|
+
|
|
18
|
+
intersect(...sourceObjects: SceneObject[])
|
|
19
|
+
intersect(targetPlane, sourceObjects)
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
Both operate inside a sketch context and return `ExtrudableGeometry`.
|
|
23
|
+
|
|
24
|
+
- `project(obj)` projects the edges of 3D faces or edges down to the
|
|
25
|
+
active sketch plane along the normal — the resulting 2D wire matches
|
|
26
|
+
the silhouette of `obj`.
|
|
27
|
+
- `intersect(obj)` cuts the sketch plane through `obj` and returns the
|
|
28
|
+
cross-section edges where they meet.
|
|
29
|
+
|
|
30
|
+
Pair either with `extrude` / `cut` / `offset` to re-use 3D geometry as
|
|
31
|
+
the input to a new 2D operation.
|
|
32
|
+
|
|
33
|
+
## Example
|
|
34
|
+
|
|
35
|
+
```fluid.js
|
|
36
|
+
import { circle, extrude, intersect, sketch } from "fluidcad/core";
|
|
37
|
+
|
|
38
|
+
sketch("xz", () => circle(40));
|
|
39
|
+
const cyl = extrude(80).symmetric();
|
|
40
|
+
|
|
41
|
+
sketch("xy", () => {
|
|
42
|
+
intersect(cyl); // cross-section where xy slices the cylinder
|
|
43
|
+
});
|
|
44
|
+
extrude(3);
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
See [[api/offset]] for offsetting the resulting wire and [[api/sketch]]
|
|
48
|
+
for the sketch context.
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
---
|
|
2
|
+
id: api/rect
|
|
3
|
+
title: rect(width, height?)
|
|
4
|
+
summary: Draws an axis-aligned rectangle on the active sketch plane. Optional corner radii via `.radius(...)` and edge/vertex accessors for downstream selections.
|
|
5
|
+
tags: [api, 2d, primitive]
|
|
6
|
+
symbols: [rect]
|
|
7
|
+
seeAlso: [api/sketch, api/extrude]
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
# rect
|
|
11
|
+
|
|
12
|
+
Imported from `fluidcad/core`.
|
|
13
|
+
|
|
14
|
+
```ts
|
|
15
|
+
rect(width, height?)
|
|
16
|
+
rect(start: Point2D, width, height?)
|
|
17
|
+
rect(targetPlane, width, height)
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
Draws a rectangle. `height` defaults to `width` (square). Returns `Rect`.
|
|
21
|
+
|
|
22
|
+
## Chain methods
|
|
23
|
+
|
|
24
|
+
- `.centered(value?)` — `true` (default) to center on both axes;
|
|
25
|
+
`"horizontal"` or `"vertical"` to center on one axis only.
|
|
26
|
+
- `.radius(...r)` — corner radii. `radius(5)` rounds all four. The
|
|
27
|
+
four-arg form is `[bottomLeft, bottomRight, topRight, topLeft]`.
|
|
28
|
+
|
|
29
|
+
## Direct accessors
|
|
30
|
+
|
|
31
|
+
```js
|
|
32
|
+
const r = rect(100, 60);
|
|
33
|
+
r.topEdge(); r.bottomEdge(); r.leftEdge(); r.rightEdge();
|
|
34
|
+
r.topLeft(); r.topRight(); r.bottomLeft(); r.bottomRight();
|
|
35
|
+
r.topLeftArcEdge(); // only present when a corner radius is applied
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
## Example
|
|
39
|
+
|
|
40
|
+
```fluid.js
|
|
41
|
+
import { extrude, rect, sketch } from "fluidcad/core";
|
|
42
|
+
|
|
43
|
+
sketch("xy", () => rect(100, 60).centered().radius(8));
|
|
44
|
+
extrude(15);
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
See [[api/sketch]] for the sketch context and [[api/extrude]] for the
|
|
48
|
+
typical follow-up operation.
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
---
|
|
2
|
+
id: api/remove
|
|
3
|
+
title: remove(...objects)
|
|
4
|
+
summary: Deletes scene objects. Most useful after `.reusable()` once a profile is no longer needed.
|
|
5
|
+
tags: [api, utility]
|
|
6
|
+
symbols: [remove]
|
|
7
|
+
seeAlso: [api/sketch]
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
# remove
|
|
11
|
+
|
|
12
|
+
Imported from `fluidcad/core`.
|
|
13
|
+
|
|
14
|
+
```ts
|
|
15
|
+
remove(...objects: SceneObject[])
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
Removes objects from the scene. The common pattern is cleaning up a
|
|
19
|
+
`.reusable()` profile once every consumer has been built.
|
|
20
|
+
|
|
21
|
+
## Example
|
|
22
|
+
|
|
23
|
+
```fluid.js
|
|
24
|
+
import { circle, extrude, remove, sketch } from "fluidcad/core";
|
|
25
|
+
|
|
26
|
+
const profile = sketch("xy", () => circle(40)).reusable();
|
|
27
|
+
extrude(20);
|
|
28
|
+
extrude(40);
|
|
29
|
+
remove(profile); // clean up the profile
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
See [[api/sketch]] for `.reusable()`.
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
---
|
|
2
|
+
id: api/repeat
|
|
3
|
+
title: repeat(kind, axis | plane, options, ...features)
|
|
4
|
+
summary: Re-applies a modeling feature (extrude, cut, fillet, …) at multiple positions, producing one solid with N copies of the feature.
|
|
5
|
+
tags: [api, pattern, transform]
|
|
6
|
+
symbols: [repeat]
|
|
7
|
+
seeAlso: [api/extrude, concepts/scene-graph]
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
# repeat
|
|
11
|
+
|
|
12
|
+
Imported from `fluidcad/core`.
|
|
13
|
+
|
|
14
|
+
```ts
|
|
15
|
+
repeat("linear", axis | axes, options, ...objects)
|
|
16
|
+
repeat("circular", axis, options, ...objects)
|
|
17
|
+
repeat("mirror", plane, ...objects)
|
|
18
|
+
repeat("rotate", axis, angle?, ...objects) // angle defaults to 90°
|
|
19
|
+
repeat(matrix: Matrix4, ...objects)
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
`repeat()` re-runs the modeling feature itself at new positions. Pass the
|
|
23
|
+
result of an `extrude()`, `cut()`, `fillet()`, etc. as the trailing
|
|
24
|
+
argument — each repetition re-executes that operation, so the output is
|
|
25
|
+
**one solid with N copies of the feature**.
|
|
26
|
+
|
|
27
|
+
## Required options
|
|
28
|
+
|
|
29
|
+
- **`linear`** — `count` plus exactly one of `offset` (spacing between
|
|
30
|
+
instances) or `length` (total span, distributed evenly). For
|
|
31
|
+
multi-axis linear repeats, pass arrays.
|
|
32
|
+
- **`circular`** — `count` plus exactly one of `offset` (degrees between
|
|
33
|
+
instances) or `angle` (total sweep, distributed evenly).
|
|
34
|
+
|
|
35
|
+
Passing `count` alone is not enough — the runtime needs either the
|
|
36
|
+
spacing or the span.
|
|
37
|
+
|
|
38
|
+
## Examples
|
|
39
|
+
|
|
40
|
+
```fluid.js
|
|
41
|
+
import { circle, cut, extrude, rect, repeat, sketch } from "fluidcad/core";
|
|
42
|
+
|
|
43
|
+
// Cut one pocket, then repeat the cut across a 4×2 grid → one solid with 8 pockets
|
|
44
|
+
sketch("xy", () => rect(200, 100).centered());
|
|
45
|
+
extrude(20);
|
|
46
|
+
sketch("xy", () => circle(5));
|
|
47
|
+
const pocket = cut(10);
|
|
48
|
+
repeat("linear", ["x", "y"], { count: [4, 2], offset: [30, 30] }, pocket);
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
```js
|
|
52
|
+
// Mirror a boss across the front plane
|
|
53
|
+
const boss = extrude(15);
|
|
54
|
+
repeat("mirror", "front", boss);
|
|
55
|
+
|
|
56
|
+
// 6 circular copies evenly distributed around Z (full 360°)
|
|
57
|
+
const spoke = extrude(20);
|
|
58
|
+
repeat("circular", "z", { count: 6, angle: 360 }, spoke);
|
|
59
|
+
|
|
60
|
+
// Same idea, but spec the angular spacing directly
|
|
61
|
+
repeat("circular", "z", { count: 6, offset: 60 }, spoke);
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
## repeat() vs copy()
|
|
65
|
+
|
|
66
|
+
| You want… | Use |
|
|
67
|
+
|-----------|-----|
|
|
68
|
+
| Re-run a feature so it cuts/extrudes into the same solid at each position | `repeat()` |
|
|
69
|
+
| One solid with multiple pockets/bosses | `repeat()` with the cut/extrude result |
|
|
70
|
+
| Clone the whole finished shape at new positions (each copy independent) | `copy()` |
|
|
71
|
+
| Many separate solids of the same shape | `copy()` with `.new()` on the original |
|
|
72
|
+
| Mirror a feature across a plane | `repeat("mirror", plane, feature)` |
|
|
73
|
+
|
|
74
|
+
The key intuition: `copy()` duplicates a finished shape; `repeat()`
|
|
75
|
+
re-executes a feature. The latter respects auto-fusion semantics, so
|
|
76
|
+
overlapping copies merge rather than producing duplicate geometry.
|
|
77
|
+
|
|
78
|
+
See [[api/extrude]] / [[concepts/scene-graph]] for the underlying feature
|
|
79
|
+
model `repeat` re-applies.
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
---
|
|
2
|
+
id: api/revolve
|
|
3
|
+
title: revolve(axis, angle?)
|
|
4
|
+
summary: Sweeps the last sketch around an axis. Full 360 by default; supply an angle for partial revolutions. The sketch plane must contain the axis.
|
|
5
|
+
tags: [api, 3d, solid]
|
|
6
|
+
symbols: [revolve]
|
|
7
|
+
seeAlso: [api/sketch, api/sweep, api/extrude]
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
# revolve
|
|
11
|
+
|
|
12
|
+
Imported from `fluidcad/core`.
|
|
13
|
+
|
|
14
|
+
```ts
|
|
15
|
+
revolve(axis: AxisLike, target?: SceneObject) // full 360
|
|
16
|
+
revolve(axis: AxisLike, angle: number, target?) // partial revolution
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
Returns `Revolve` (extends `BooleanOperation`). Chain: `.symmetric()`,
|
|
20
|
+
`.thin()`, `.pick()`, plus the standard boolean scope methods.
|
|
21
|
+
|
|
22
|
+
The **sketch plane must contain the axis**: to revolve around `"z"`,
|
|
23
|
+
sketch on `"xz"` or `"yz"`.
|
|
24
|
+
|
|
25
|
+
## Example
|
|
26
|
+
|
|
27
|
+
```fluid.js
|
|
28
|
+
import { move, rect, revolve, sketch } from "fluidcad/core";
|
|
29
|
+
|
|
30
|
+
sketch("xz", () => {
|
|
31
|
+
move([20, 0]);
|
|
32
|
+
rect(10, 30);
|
|
33
|
+
});
|
|
34
|
+
revolve("z"); // ring
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
See [[api/sweep]] for path-driven solids and [[api/extrude]] for linear
|
|
38
|
+
extrusion.
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
---
|
|
2
|
+
id: api/rib
|
|
3
|
+
title: rib(thickness, spine?)
|
|
4
|
+
summary: Builds a rib from an open spine sketch. Extends in the sketch plane normal until it meets surrounding solids.
|
|
5
|
+
tags: [api, 3d, solid]
|
|
6
|
+
symbols: [rib]
|
|
7
|
+
seeAlso: [api/sketch, api/extrude]
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
# rib
|
|
11
|
+
|
|
12
|
+
Imported from `fluidcad/core`.
|
|
13
|
+
|
|
14
|
+
```ts
|
|
15
|
+
rib(thickness) // uses last sketch as spine
|
|
16
|
+
rib(thickness, spine: SceneObject)
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
Returns `Rib` (extends `BooleanOperation`). Sign of `thickness` chooses
|
|
20
|
+
direction: positive forward, negative backward. Chain methods:
|
|
21
|
+
|
|
22
|
+
- `.parallel()` — extrude parallel to the sketch plane instead of the
|
|
23
|
+
normal direction.
|
|
24
|
+
- `.extend()` — extend the rib ends so they blend with surrounding walls.
|
|
25
|
+
|
|
26
|
+
Plus the standard face/edge accessors (`startFaces`, `endFaces`,
|
|
27
|
+
`sideFaces`, etc.).
|
|
28
|
+
|
|
29
|
+
## Example
|
|
30
|
+
|
|
31
|
+
```fluid.js
|
|
32
|
+
import { extrude, line, rect, rib, sketch } from "fluidcad/core";
|
|
33
|
+
|
|
34
|
+
sketch("xy", () => rect(120, 80).centered());
|
|
35
|
+
extrude(40);
|
|
36
|
+
sketch("xz", () => line([-40, 5], [40, 5]));
|
|
37
|
+
rib(3).extend();
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
See [[api/extrude]] for the base solid the rib connects into.
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
---
|
|
2
|
+
id: api/rotate
|
|
3
|
+
title: rotate(axis, angle, ...targets?)
|
|
4
|
+
summary: Rotates one or more objects around an axis (3D) or in the sketch plane (2D). Degrees, not radians.
|
|
5
|
+
tags: [api, 3d, 2d, transform]
|
|
6
|
+
symbols: [rotate]
|
|
7
|
+
seeAlso: [api/translate, api/mirror]
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
# rotate
|
|
11
|
+
|
|
12
|
+
Imported from `fluidcad/core`.
|
|
13
|
+
|
|
14
|
+
```ts
|
|
15
|
+
// 2D — inside a sketch, around the plane's Z (i.e., the sketch normal)
|
|
16
|
+
rotate(angle, ...targets)
|
|
17
|
+
rotate(angle, copy: boolean, ...targets)
|
|
18
|
+
|
|
19
|
+
// 3D — around a world or custom axis
|
|
20
|
+
rotate(axis: AxisLike, angle, ...targets)
|
|
21
|
+
rotate(axis, angle, copy: boolean, ...targets)
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
Angles are degrees. `AxisLike` is `"x"` / `"y"` / `"z"`, a direction
|
|
25
|
+
vector, or an `{ point?, direction }` record. `copy: true` clones the
|
|
26
|
+
source rather than rotating it in place.
|
|
27
|
+
|
|
28
|
+
## Example
|
|
29
|
+
|
|
30
|
+
```fluid.js
|
|
31
|
+
import { cylinder, rotate } from "fluidcad/core";
|
|
32
|
+
|
|
33
|
+
const c = cylinder(8, 40);
|
|
34
|
+
rotate("x", 90, c); // lay the cylinder on its side
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
See [[api/translate]] for moves and [[api/mirror]] for reflections.
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
---
|
|
2
|
+
id: api/select
|
|
3
|
+
title: select(...filters)
|
|
4
|
+
summary: Runs filters across the entire scene and stores the result as the implicit "last selection." The next op that needs a selection picks it up automatically.
|
|
5
|
+
tags: [api, selection]
|
|
6
|
+
symbols: [select]
|
|
7
|
+
seeAlso: [api/face-filter, api/edge-filter, concepts/last-selection]
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
# select
|
|
11
|
+
|
|
12
|
+
Imported from `fluidcad/core`.
|
|
13
|
+
|
|
14
|
+
```ts
|
|
15
|
+
select(...filters: (FaceFilter | EdgeFilter)[])
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
Each filter contributes candidates; the final selection is the **union**
|
|
19
|
+
across all filter arguments (whereas chained calls within a single
|
|
20
|
+
filter — `.line()` then `.onPlane(...)` — are ANDed). The selection is
|
|
21
|
+
stored on the scene; the next op that takes a selection consumes it.
|
|
22
|
+
|
|
23
|
+
For accessor-driven selections off a specific feature (e.g., the top
|
|
24
|
+
faces of one extrude), use the direct accessor instead —
|
|
25
|
+
`e.endFaces(...filters)` — to avoid scanning the rest of the scene.
|
|
26
|
+
|
|
27
|
+
## Example
|
|
28
|
+
|
|
29
|
+
```fluid.js
|
|
30
|
+
import { extrude, fillet, rect, select, sketch } from "fluidcad/core";
|
|
31
|
+
import { edge } from "fluidcad/filters";
|
|
32
|
+
|
|
33
|
+
sketch("xy", () => rect(80, 60).centered());
|
|
34
|
+
const e = extrude(20);
|
|
35
|
+
select(edge().verticalTo("xy"));
|
|
36
|
+
fillet(2); // consumes the selection above
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
See [[api/face-filter]] and [[api/edge-filter]] for the per-filter
|
|
40
|
+
predicates, and [[concepts/last-selection]] for the implicit-consumption
|
|
41
|
+
contract.
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
---
|
|
2
|
+
id: api/shell
|
|
3
|
+
title: shell(thickness, ...openFaces?)
|
|
4
|
+
summary: Hollows a solid into a thin wall. Pass faces to remove (open the shell). Negative thickness shells inward; positive shells outward.
|
|
5
|
+
tags: [api, 3d, modifier]
|
|
6
|
+
symbols: [shell]
|
|
7
|
+
seeAlso: [api/extrude, api/fillet]
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
# shell
|
|
11
|
+
|
|
12
|
+
Imported from `fluidcad/core`.
|
|
13
|
+
|
|
14
|
+
```ts
|
|
15
|
+
shell(thickness?) // default thickness 2.5, walls inward (negative)
|
|
16
|
+
shell(thickness, ...selections) // remove these faces (open the shell)
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
Returns `Shell` with:
|
|
20
|
+
|
|
21
|
+
- `.internalFaces()`, `.internalEdges()` — the new inner wall geometry.
|
|
22
|
+
- `.join(type)` — corner join style: `"arc"` (default), `"intersection"`
|
|
23
|
+
(sharp), or `"tangent"`.
|
|
24
|
+
|
|
25
|
+
**Sign of thickness matters.** Negative thickness shells inward
|
|
26
|
+
(preserving the outer shape and hollowing out the interior). Positive
|
|
27
|
+
shells outward (preserving the inner shape and adding wall material).
|
|
28
|
+
|
|
29
|
+
## Example
|
|
30
|
+
|
|
31
|
+
```fluid.js
|
|
32
|
+
import { extrude, fillet, rect, shell, sketch } from "fluidcad/core";
|
|
33
|
+
|
|
34
|
+
sketch("xy", () => rect(80, 60).centered());
|
|
35
|
+
const e = extrude(40);
|
|
36
|
+
const s = shell(-2, e.endFaces()); // open-top container, 2mm walls
|
|
37
|
+
fillet(0.5, s.internalEdges());
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
See [[api/extrude]] for the base solid and [[api/fillet]] for refining
|
|
41
|
+
the new inner edges.
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
---
|
|
2
|
+
id: api/sketch
|
|
3
|
+
title: sketch(plane | face, sketcher)
|
|
4
|
+
summary: Opens a 2D sketching context on a plane or a face. The active sketch is the implicit input to extrude/cut/revolve/sweep/loft.
|
|
5
|
+
tags: [api, 2d, primitive]
|
|
6
|
+
symbols: [sketch]
|
|
7
|
+
seeAlso: [api/extrude, concepts/last-selection, concepts/scene-graph]
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
# sketch
|
|
11
|
+
|
|
12
|
+
Imported from `fluidcad/core`.
|
|
13
|
+
|
|
14
|
+
```ts
|
|
15
|
+
sketch(plane: PlaneLike, sketcher: () => T): SceneObject
|
|
16
|
+
sketch(face: SceneObject, sketcher: () => T): SceneObject
|
|
17
|
+
sketch(plane: Plane, sketcher: () => T): SceneObject
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
Opens a sketch context. The callback draws 2D geometry; whatever the callback
|
|
21
|
+
returns is attached as `.regions` on the resulting `SceneObject`, so named
|
|
22
|
+
references can be carried out:
|
|
23
|
+
|
|
24
|
+
```fluid.js
|
|
25
|
+
import { circle, sketch } from "fluidcad/core";
|
|
26
|
+
|
|
27
|
+
const s = sketch("xy", () => {
|
|
28
|
+
const outer = circle(60).reusable();
|
|
29
|
+
const inner = circle(20);
|
|
30
|
+
return { outer, inner };
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
// s.regions.outer → reference to the outer circle
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
## Implicit consumption
|
|
37
|
+
|
|
38
|
+
The sketch becomes the **last sketch**. The next 3D feature (`extrude`,
|
|
39
|
+
`cut`, `revolve`, `sweep`, `loft`, `rib`) consumes it automatically:
|
|
40
|
+
|
|
41
|
+
```fluid.js
|
|
42
|
+
import { extrude, rect, sketch } from "fluidcad/core";
|
|
43
|
+
|
|
44
|
+
sketch("xy", () => rect(100, 50).centered());
|
|
45
|
+
extrude(20); // consumes the sketch above
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
A consumed sketch is gone. To reuse a sketch across multiple operations,
|
|
49
|
+
mark it `.reusable()`:
|
|
50
|
+
|
|
51
|
+
```fluid.js
|
|
52
|
+
import { circle, extrude, sketch } from "fluidcad/core";
|
|
53
|
+
|
|
54
|
+
const profile = sketch("xy", () => circle(40)).reusable();
|
|
55
|
+
extrude(30, profile);
|
|
56
|
+
extrude(-10, profile); // still available
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
## Sketching on a face
|
|
60
|
+
|
|
61
|
+
Passing a face selection orients the sketch onto that face's plane. If the
|
|
62
|
+
selection resolves to multiple faces, only the **first** face is used as the
|
|
63
|
+
sketch plane:
|
|
64
|
+
|
|
65
|
+
```fluid.js
|
|
66
|
+
import { circle, cut, extrude, rect, sketch } from "fluidcad/core";
|
|
67
|
+
|
|
68
|
+
sketch("xy", () => rect(100, 60).centered());
|
|
69
|
+
const e = extrude(30);
|
|
70
|
+
sketch(e.endFaces(), () => circle(15));
|
|
71
|
+
cut(10); // 10mm-deep pocket on the top face
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
See [[concepts/coordinate-system]] for how sketch axes are derived from the
|
|
75
|
+
chosen plane, and [[concepts/last-selection]] for how implicit consumption
|
|
76
|
+
chains operations.
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
---
|
|
2
|
+
id: api/slot
|
|
3
|
+
title: slot(distance, radius)
|
|
4
|
+
summary: Stadium-shaped slot — a rectangle with semicircular end caps — defined by length and end-cap radius.
|
|
5
|
+
tags: [api, 2d, primitive]
|
|
6
|
+
symbols: [slot]
|
|
7
|
+
seeAlso: [api/rect, api/sketch]
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
# slot
|
|
11
|
+
|
|
12
|
+
Imported from `fluidcad/core`.
|
|
13
|
+
|
|
14
|
+
```ts
|
|
15
|
+
slot(distance, radius)
|
|
16
|
+
slot(start: Point2D, distance, radius)
|
|
17
|
+
slot(geometry, radius, deleteSource?) // wrap around an existing edge
|
|
18
|
+
slot(targetPlane, distance, radius)
|
|
19
|
+
slot(targetPlane, geometry, radius)
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
Returns `Slot` with `.centered(value?)` and `.rotate(angle)`.
|
|
23
|
+
|
|
24
|
+
## Example
|
|
25
|
+
|
|
26
|
+
```fluid.js
|
|
27
|
+
import { extrude, sketch, slot } from "fluidcad/core";
|
|
28
|
+
|
|
29
|
+
sketch("xy", () => slot(80, 10).centered());
|
|
30
|
+
extrude(8);
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
Reach for slot whenever you'd otherwise hand-compute the end-cap arc
|
|
34
|
+
positions of a straight pocket.
|
|
35
|
+
|
|
36
|
+
See [[api/rect]] for the sharp-cornered variant.
|