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,9 @@
|
|
|
1
|
+
# llm-docs coverage allowlist
|
|
2
|
+
#
|
|
3
|
+
# Each non-blank, non-comment line names a public symbol from
|
|
4
|
+
# website/scripts/api-doc-config.ts that is intentionally undocumented in
|
|
5
|
+
# llm-docs/. Append a "# reason" comment per entry so reviewers can see why an
|
|
6
|
+
# opt-out exists.
|
|
7
|
+
#
|
|
8
|
+
# Empty by default — once the Phase 11 migration drained every slice the
|
|
9
|
+
# allowlist is no longer needed for normal coverage.
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
---
|
|
2
|
+
id: api/arc
|
|
3
|
+
title: arc(end) / arc(radius, startAngle, endAngle)
|
|
4
|
+
summary: Circular arc. Point form runs from the cursor (or explicit start) to `end`; angle form sweeps an angular range. Angles are relative to the current tangent and in degrees.
|
|
5
|
+
tags: [api, 2d, primitive, curve]
|
|
6
|
+
symbols: [arc]
|
|
7
|
+
seeAlso: [api/circle, api/bezier, api/line]
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
# arc
|
|
11
|
+
|
|
12
|
+
Imported from `fluidcad/core`.
|
|
13
|
+
|
|
14
|
+
```ts
|
|
15
|
+
arc(endPoint: Point2D) // from cursor through implicit center
|
|
16
|
+
arc(startPoint, endPoint)
|
|
17
|
+
arc(radius, startAngle?, endAngle?) // angle form (defaults 0..180)
|
|
18
|
+
arc(targetPlane, endPoint)
|
|
19
|
+
arc(targetPlane, startPoint, endPoint)
|
|
20
|
+
arc(targetPlane, radius, startAngle, endAngle)
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## Point form — `ArcPoints`
|
|
24
|
+
|
|
25
|
+
- `.radius(value)` — bulge radius. Positive bulges CCW; negative bulges CW.
|
|
26
|
+
- `.center(point)` — fix the center explicitly (mutually exclusive with `.radius()`).
|
|
27
|
+
|
|
28
|
+
## Angle form — `ArcAngles`
|
|
29
|
+
|
|
30
|
+
- `.centered()` — center the sweep around the start angle.
|
|
31
|
+
- Angles are degrees, relative to the **current tangent**.
|
|
32
|
+
|
|
33
|
+
## Example
|
|
34
|
+
|
|
35
|
+
```fluid.js
|
|
36
|
+
import { arc, extrude, line, sketch } from "fluidcad/core";
|
|
37
|
+
|
|
38
|
+
sketch("xy", () => {
|
|
39
|
+
line([0, 0], [60, 0]);
|
|
40
|
+
arc([100, 40]).radius(50); // bulge from cursor to (100,40)
|
|
41
|
+
line([100, 60]);
|
|
42
|
+
line([0, 60]);
|
|
43
|
+
line([0, 0]);
|
|
44
|
+
});
|
|
45
|
+
extrude(5);
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
See [[api/circle]] for full circles and [[api/bezier]] for free curves.
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
---
|
|
2
|
+
id: api/axis
|
|
3
|
+
title: axis(reference, options?)
|
|
4
|
+
summary: Builds a reference axis from a world axis name, an edge, or the midaxis between two axes. Used by revolve, repeat, and 3D rotations.
|
|
5
|
+
tags: [api, reference, geometry]
|
|
6
|
+
symbols: [axis]
|
|
7
|
+
seeAlso: [api/plane, api/local, api/revolve, api/rotate]
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
# axis
|
|
11
|
+
|
|
12
|
+
Imported from `fluidcad/core`.
|
|
13
|
+
|
|
14
|
+
```ts
|
|
15
|
+
axis(axis: AxisLike)
|
|
16
|
+
axis(axis: AxisLike, options: AxisTransformOptions)
|
|
17
|
+
axis(source: SceneObject) // from an edge
|
|
18
|
+
axis(source: SceneObject, options)
|
|
19
|
+
axis(axis: Axis, options)
|
|
20
|
+
axis(a1: AxisLike, a2: AxisLike, options?) // midaxis
|
|
21
|
+
axis(a1: Axis, a2: Axis, options?)
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
`AxisLike` is `"x"` / `"y"` / `"z"`, a direction vector, or an
|
|
25
|
+
`{ point?, direction }` record. `AxisTransformOptions` includes
|
|
26
|
+
`offsetX`, `offsetY`, `offsetZ`, `flip`, etc.
|
|
27
|
+
|
|
28
|
+
## Example
|
|
29
|
+
|
|
30
|
+
```fluid.js
|
|
31
|
+
import { axis, move, rect, revolve, sketch } from "fluidcad/core";
|
|
32
|
+
|
|
33
|
+
sketch("xz", () => {
|
|
34
|
+
move([20, 0]);
|
|
35
|
+
rect(10, 30);
|
|
36
|
+
});
|
|
37
|
+
const raised = axis("z", { offsetX: 50 }); // Z axis shifted +50 along X
|
|
38
|
+
revolve(raised);
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
See [[api/plane]] for planar references and [[api/local]] for sketch-
|
|
42
|
+
local axes.
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
---
|
|
2
|
+
id: api/bezier
|
|
3
|
+
title: bezier(...points)
|
|
4
|
+
summary: Free-form bezier curve. The last point is the endpoint; preceding points are control points (degree = args − 1).
|
|
5
|
+
tags: [api, 2d, primitive, curve]
|
|
6
|
+
symbols: [bezier]
|
|
7
|
+
seeAlso: [api/arc, api/line]
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
# bezier
|
|
11
|
+
|
|
12
|
+
Imported from `fluidcad/core`.
|
|
13
|
+
|
|
14
|
+
```ts
|
|
15
|
+
bezier(...points: Point2D[])
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
The last argument is the endpoint; preceding arguments are control points.
|
|
19
|
+
|
|
20
|
+
| Args | Degree | Shape |
|
|
21
|
+
|------|----------|--------------------|
|
|
22
|
+
| 1 | 1 (line) | straight segment |
|
|
23
|
+
| 2 | 2 | quadratic bezier |
|
|
24
|
+
| 3 | 3 | cubic bezier |
|
|
25
|
+
|
|
26
|
+
The curve starts from the current cursor and ends at the final argument;
|
|
27
|
+
intermediate arguments are control handles that shape the curve.
|
|
28
|
+
|
|
29
|
+
## Example
|
|
30
|
+
|
|
31
|
+
```fluid.js
|
|
32
|
+
import { bezier, extrude, line, sketch } from "fluidcad/core";
|
|
33
|
+
|
|
34
|
+
sketch("xy", () => {
|
|
35
|
+
line([0, 0], [0, 40]);
|
|
36
|
+
bezier([20, 80], [80, 80], [100, 40]); // cubic bezier
|
|
37
|
+
line([0, 0]);
|
|
38
|
+
});
|
|
39
|
+
extrude(4);
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
See [[api/arc]] for circular curves with exact radii.
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
---
|
|
2
|
+
id: api/booleans
|
|
3
|
+
title: fuse / subtract / common
|
|
4
|
+
summary: Explicit 3D boolean operations. Most of the time auto-fusion does the right thing — reach for these when you need exact control.
|
|
5
|
+
tags: [api, 3d, boolean]
|
|
6
|
+
symbols: [fuse, subtract, common]
|
|
7
|
+
seeAlso: [api/extrude, api/cut, concepts/scene-graph]
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
# fuse / subtract / common
|
|
11
|
+
|
|
12
|
+
Imported from `fluidcad/core`.
|
|
13
|
+
|
|
14
|
+
```ts
|
|
15
|
+
fuse()
|
|
16
|
+
fuse(...objects) // union of objects
|
|
17
|
+
subtract(object1, object2) // object1 − object2
|
|
18
|
+
common()
|
|
19
|
+
common(...objects) // intersection
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
The no-argument forms operate on the implicit last objects in scope; the
|
|
23
|
+
explicit forms operate on the arguments you pass. Most modeling work can
|
|
24
|
+
rely on auto-fusion (touching solids merge automatically and `.remove()`
|
|
25
|
+
chained on `extrude` already covers subtraction). Reach for these when:
|
|
26
|
+
|
|
27
|
+
- You need to fuse non-touching solids deliberately.
|
|
28
|
+
- An op didn't auto-fuse the way you wanted and you want to be explicit.
|
|
29
|
+
- You want an explicit intersection rather than a per-feature `.scope()`.
|
|
30
|
+
|
|
31
|
+
## Example
|
|
32
|
+
|
|
33
|
+
```fluid.js
|
|
34
|
+
import { circle, extrude, rect, sketch, subtract } from "fluidcad/core";
|
|
35
|
+
|
|
36
|
+
sketch("xy", () => rect(60, 60).centered());
|
|
37
|
+
const a = extrude(20).new();
|
|
38
|
+
sketch("xy", () => circle(35));
|
|
39
|
+
const b = extrude(20).new();
|
|
40
|
+
subtract(a, b);
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
See [[api/extrude]] for chained boolean scope (`.add()`, `.remove()`,
|
|
44
|
+
`.new()`, `.scope()`) and [[api/cut]] for the subtractive extrude.
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
---
|
|
2
|
+
id: api/chamfer
|
|
3
|
+
title: chamfer(distance, ...edges?)
|
|
4
|
+
summary: Flat angled break on a 3D edge. Symmetric, asymmetric (d1 × d2), or distance + angle forms.
|
|
5
|
+
tags: [api, 3d, modifier, edges]
|
|
6
|
+
symbols: [chamfer]
|
|
7
|
+
seeAlso: [api/fillet, api/extrude]
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
# chamfer
|
|
11
|
+
|
|
12
|
+
Imported from `fluidcad/core`.
|
|
13
|
+
|
|
14
|
+
```ts
|
|
15
|
+
chamfer(distance?) // default 1, uses last selection
|
|
16
|
+
chamfer(distance, ...sceneObjects)
|
|
17
|
+
chamfer(d1, d2, isAngle?) // asymmetric or distance + angle
|
|
18
|
+
chamfer(d1, d2, isAngle, ...sceneObjects)
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
Returns a `SceneObject`. Operates on the last selection when no edges
|
|
22
|
+
are passed, just like [[api/fillet]].
|
|
23
|
+
|
|
24
|
+
## When to reach for chamfer vs fillet
|
|
25
|
+
|
|
26
|
+
Chamfers are cheaper computationally and faster to spec from a drawing —
|
|
27
|
+
prefer them for manufacturing edge breaks. Save fillets for visually
|
|
28
|
+
styled rounds or stress-relief features.
|
|
29
|
+
|
|
30
|
+
## Example
|
|
31
|
+
|
|
32
|
+
```fluid.js
|
|
33
|
+
import { chamfer, extrude, rect, sketch } from "fluidcad/core";
|
|
34
|
+
|
|
35
|
+
sketch("xy", () => rect(60, 40).centered());
|
|
36
|
+
const e = extrude(20);
|
|
37
|
+
chamfer(2, e.endEdges());
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
See [[api/fillet]] for the rounded counterpart.
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
---
|
|
2
|
+
id: api/circle
|
|
3
|
+
title: circle(diameter?)
|
|
4
|
+
summary: Draws a circle on the active sketch plane. The numeric argument is the diameter, not the radius.
|
|
5
|
+
tags: [api, 2d, primitive]
|
|
6
|
+
symbols: [circle]
|
|
7
|
+
seeAlso: [api/sketch, api/ellipse, api/arc]
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
# circle
|
|
11
|
+
|
|
12
|
+
Imported from `fluidcad/core`.
|
|
13
|
+
|
|
14
|
+
```ts
|
|
15
|
+
circle(diameter?) // at cursor, default diameter 40
|
|
16
|
+
circle(center: Point2D, diameter?)
|
|
17
|
+
circle(targetPlane, diameter)
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
Returns `ExtrudableGeometry`. The argument is the **diameter** — not the
|
|
21
|
+
radius. With no `center`, the circle is drawn at the current cursor.
|
|
22
|
+
|
|
23
|
+
## Example
|
|
24
|
+
|
|
25
|
+
```fluid.js
|
|
26
|
+
import { circle, extrude, sketch } from "fluidcad/core";
|
|
27
|
+
|
|
28
|
+
sketch("xy", () => {
|
|
29
|
+
circle(50); // at the origin/cursor
|
|
30
|
+
circle([60, 0], 20); // smaller circle offset to the right
|
|
31
|
+
});
|
|
32
|
+
extrude(10);
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
See [[api/ellipse]] for asymmetric diameters and [[api/arc]] for partial
|
|
36
|
+
circles.
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
---
|
|
2
|
+
id: api/color
|
|
3
|
+
title: color(value, selection?)
|
|
4
|
+
summary: Paints a face, edge, or solid. Accepts CSS color strings (named, hex, rgb). Without a target, paints the last selection.
|
|
5
|
+
tags: [api, utility, appearance]
|
|
6
|
+
symbols: [color]
|
|
7
|
+
seeAlso: [api/select, api/face-filter]
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
# color
|
|
11
|
+
|
|
12
|
+
Imported from `fluidcad/core`.
|
|
13
|
+
|
|
14
|
+
```ts
|
|
15
|
+
color(value: string) // CSS color, applies to last selection
|
|
16
|
+
color(value: string, selection: SceneObject)
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
Accepts named CSS colors (`"red"`), hex (`"#3498db"`), or `rgb(...)`.
|
|
20
|
+
With no explicit target, paints the last selection — pair with
|
|
21
|
+
`select(...)` or a direct accessor like `e.endFaces()`.
|
|
22
|
+
|
|
23
|
+
## Example
|
|
24
|
+
|
|
25
|
+
```fluid.js
|
|
26
|
+
import { color, extrude, rect, sketch } from "fluidcad/core";
|
|
27
|
+
|
|
28
|
+
sketch("xy", () => rect(80, 60).centered());
|
|
29
|
+
const e = extrude(20);
|
|
30
|
+
color("#3498db", e.endFaces());
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
See [[api/select]] for the implicit-selection model that `color` plugs
|
|
34
|
+
into.
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
---
|
|
2
|
+
id: api/connect
|
|
3
|
+
title: connect(mode?)
|
|
4
|
+
summary: Bridges the open ends of the current sketch's edges into one closed wire. Pass `"arc"` to bridge with tangent arcs instead of straight segments.
|
|
5
|
+
tags: [api, 2d, primitive]
|
|
6
|
+
symbols: [connect]
|
|
7
|
+
seeAlso: [api/line, api/arc, api/sketch]
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
# connect
|
|
11
|
+
|
|
12
|
+
Imported from `fluidcad/core`.
|
|
13
|
+
|
|
14
|
+
```ts
|
|
15
|
+
connect(mode?: "line" | "arc")
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
Sweeps all previously drawn edges in the active sketch and stitches them
|
|
19
|
+
into a closed wire, inserting bridge segments (or tangent arcs in `"arc"`
|
|
20
|
+
mode) between consecutive endpoints — including the final closing bridge
|
|
21
|
+
back to the first edge.
|
|
22
|
+
|
|
23
|
+
Use `connect` for sketches built from a few discrete curves (e.g., an
|
|
24
|
+
open arc) that need to be closed into an extrudable face. For outlines
|
|
25
|
+
already built from contiguous `line` / `hLine` / `vLine` segments,
|
|
26
|
+
explicit closing segments are clearer than `connect`.
|
|
27
|
+
|
|
28
|
+
## Example
|
|
29
|
+
|
|
30
|
+
```fluid.js
|
|
31
|
+
import { arc, connect, extrude, sketch } from "fluidcad/core";
|
|
32
|
+
|
|
33
|
+
sketch("xy", () => {
|
|
34
|
+
arc(30); // half-circle starting at the cursor
|
|
35
|
+
connect(); // close it into a half-disc face
|
|
36
|
+
});
|
|
37
|
+
extrude(5);
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
See [[api/arc]] for the curve being closed and [[api/line]] for the
|
|
41
|
+
explicit closing-segment alternative.
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
---
|
|
2
|
+
id: api/constraint-qualifiers
|
|
3
|
+
title: outside / enclosed / enclosing / unqualified
|
|
4
|
+
summary: Wrap a geometry to disambiguate which solution a constrained primitive (tLine/tArc/tCircle) should pick.
|
|
5
|
+
tags: [api, 2d, constrained, selection]
|
|
6
|
+
symbols: [outside, enclosed, enclosing, unqualified]
|
|
7
|
+
seeAlso: [api/tline, api/tarc, api/tcircle]
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
# Constraint qualifiers
|
|
11
|
+
|
|
12
|
+
Imported from `fluidcad/constraints`.
|
|
13
|
+
|
|
14
|
+
```ts
|
|
15
|
+
outside(obj)
|
|
16
|
+
enclosing(obj)
|
|
17
|
+
enclosed(obj)
|
|
18
|
+
unqualified(obj)
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
Constrained primitives like `tLine`, `tArc`, and `tCircle` can produce
|
|
22
|
+
multiple valid solutions (e.g., the 4 internal/external tangents between
|
|
23
|
+
two circles, or up to 8 tangent circles). These qualifiers wrap a
|
|
24
|
+
candidate geometry to narrow which solution is selected.
|
|
25
|
+
|
|
26
|
+
- `outside(obj)` — the result must be external to `obj` (no shared
|
|
27
|
+
interior).
|
|
28
|
+
- `enclosing(obj)` — the result wraps around `obj`.
|
|
29
|
+
- `enclosed(obj)` — the result sits inside `obj`.
|
|
30
|
+
- `unqualified(obj)` — clears any prior qualification on `obj`.
|
|
31
|
+
|
|
32
|
+
Importable from `fluidcad/constraints`.
|
|
33
|
+
|
|
34
|
+
## Example
|
|
35
|
+
|
|
36
|
+
```fluid.js
|
|
37
|
+
import { outside } from "fluidcad/constraints";
|
|
38
|
+
|
|
39
|
+
sketch("xy", () => {
|
|
40
|
+
const c1 = circle([0, 0], 40).reusable();
|
|
41
|
+
const c2 = circle([100, 0], 40).reusable();
|
|
42
|
+
tLine(outside(c1), outside(c2)); // the external tangent between c1 and c2
|
|
43
|
+
});
|
|
44
|
+
extrude(2);
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
See [[api/tline]], [[api/tarc]], and [[api/tcircle]] for the primitives
|
|
48
|
+
these qualifiers disambiguate.
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
---
|
|
2
|
+
id: api/copy
|
|
3
|
+
title: copy(kind, axis | plane, options, ...objects)
|
|
4
|
+
summary: Duplicates a finished shape at multiple positions. Each copy is independent of the original. Use `repeat()` when you instead want the modeling feature itself re-applied.
|
|
5
|
+
tags: [api, transform, pattern]
|
|
6
|
+
symbols: [copy]
|
|
7
|
+
seeAlso: [api/repeat, api/translate, api/mirror]
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
# copy
|
|
11
|
+
|
|
12
|
+
Imported from `fluidcad/core`.
|
|
13
|
+
|
|
14
|
+
```ts
|
|
15
|
+
// Linear
|
|
16
|
+
copy("linear", axis: AxisLike, options, ...objects)
|
|
17
|
+
copy("linear", axes: AxisLike[], options, ...objects)
|
|
18
|
+
|
|
19
|
+
// Circular
|
|
20
|
+
copy("circular", axis: AxisLike, options, ...objects) // 3D
|
|
21
|
+
copy("circular", center: Point2D, options, ...objects) // inside a sketch
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
## Linear options (`LinearCopyOptions` / `LinearRepeatOptions`)
|
|
25
|
+
|
|
26
|
+
**Required:** `count` plus exactly one of `offset` or `length`.
|
|
27
|
+
|
|
28
|
+
- `count: number | number[]` — instances per axis (including original).
|
|
29
|
+
- `offset: number | number[]` — spacing between instances. Mutually
|
|
30
|
+
exclusive with `length`.
|
|
31
|
+
- `length: number | number[]` — total span; instances are evenly
|
|
32
|
+
distributed. Mutually exclusive with `offset`.
|
|
33
|
+
- `centered: boolean` — center the pattern around the original.
|
|
34
|
+
- `skip: number[][]` — index tuples to skip (per-axis).
|
|
35
|
+
|
|
36
|
+
## Circular options (`CircularCopyOptions` / `CircularRepeatOptions`)
|
|
37
|
+
|
|
38
|
+
**Required:** `count` plus exactly one of `offset` or `angle`.
|
|
39
|
+
|
|
40
|
+
- `count: number` — instances (including original).
|
|
41
|
+
- `angle: number` — total sweep in degrees; instances are evenly
|
|
42
|
+
distributed. Mutually exclusive with `offset`.
|
|
43
|
+
- `offset: number` — angular spacing in degrees between instances.
|
|
44
|
+
Mutually exclusive with `angle`.
|
|
45
|
+
- `centered: boolean` — center the pattern around the original.
|
|
46
|
+
- `skip: number[]` — indices to skip.
|
|
47
|
+
|
|
48
|
+
`copy()` snapshots the finished shape — copies don't share the
|
|
49
|
+
modeling history of the source. For feature-aware patterns (where each
|
|
50
|
+
position re-runs the original op) use [[api/repeat]].
|
|
51
|
+
|
|
52
|
+
## Example
|
|
53
|
+
|
|
54
|
+
```fluid.js
|
|
55
|
+
import { circle, copy, extrude, sketch } from "fluidcad/core";
|
|
56
|
+
|
|
57
|
+
sketch("xy", () => circle(8));
|
|
58
|
+
const pin = extrude(20).new();
|
|
59
|
+
copy("linear", "x", { count: 4, offset: 25 }, pin);
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
See [[api/repeat]] for the feature-replay alternative and
|
|
63
|
+
[[api/translate]] for the single-instance case.
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
---
|
|
2
|
+
id: api/cursor-lines
|
|
3
|
+
title: hLine / vLine / aLine
|
|
4
|
+
summary: Axis-aligned and angle-relative line segments that start from the current cursor — the idiomatic substitute for hand-computed endpoint coordinates.
|
|
5
|
+
tags: [api, 2d, cursor, primitive]
|
|
6
|
+
symbols: [hLine, vLine, aLine]
|
|
7
|
+
seeAlso: [api/line, api/cursor-move, api/sketch]
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
# hLine / vLine / aLine
|
|
11
|
+
|
|
12
|
+
Imported from `fluidcad/core`.
|
|
13
|
+
|
|
14
|
+
```ts
|
|
15
|
+
hLine(distance)
|
|
16
|
+
hLine(target: SceneObject) // ends at the nearest intersection with target
|
|
17
|
+
hLine(start, distance)
|
|
18
|
+
hLine(targetPlane, distance)
|
|
19
|
+
|
|
20
|
+
vLine(distance | target | start+distance | targetPlane+distance)
|
|
21
|
+
|
|
22
|
+
aLine(angle, length) // angle in degrees, length along that angle
|
|
23
|
+
aLine(angle, target)
|
|
24
|
+
aLine(targetPlane, angle, length)
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
All three return cursor-aware geometries (`HLine`, `VLine`, `ALine`),
|
|
28
|
+
each with `.centered(value?)` to center the line on the cursor instead
|
|
29
|
+
of starting from it.
|
|
30
|
+
|
|
31
|
+
Prefer these over `line([x + d, y])`-style absolute coordinates: the
|
|
32
|
+
intent ("a 40-unit horizontal segment") stays legible, and `target`
|
|
33
|
+
forms let the solver find the intersection for you.
|
|
34
|
+
|
|
35
|
+
## Example
|
|
36
|
+
|
|
37
|
+
```fluid.js
|
|
38
|
+
import { extrude, hLine, sketch, vLine } from "fluidcad/core";
|
|
39
|
+
|
|
40
|
+
sketch("xy", () => {
|
|
41
|
+
hLine(60); // → (60, 0)
|
|
42
|
+
vLine(40); // → (60, 40)
|
|
43
|
+
hLine(-60); // → (0, 40)
|
|
44
|
+
vLine(-40); // → (0, 0) closes the wire
|
|
45
|
+
});
|
|
46
|
+
extrude(5);
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
See [[api/cursor-move]] for moving the cursor without drawing, and
|
|
50
|
+
[[api/line]] for explicit-endpoint segments.
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
---
|
|
2
|
+
id: api/cursor-move
|
|
3
|
+
title: move / hMove / vMove / rMove / pMove / center / back
|
|
4
|
+
summary: Cursor positioning primitives. They move the active sketch's cursor (and tangent, for rMove) without drawing geometry.
|
|
5
|
+
tags: [api, 2d, cursor]
|
|
6
|
+
symbols: [move, hMove, vMove, rMove, pMove, center]
|
|
7
|
+
seeAlso: [api/cursor-lines, api/sketch]
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
# Cursor movement
|
|
11
|
+
|
|
12
|
+
Imported from `fluidcad/core`.
|
|
13
|
+
|
|
14
|
+
```ts
|
|
15
|
+
move() // jump back to the sketch plane origin
|
|
16
|
+
move(to: Point2D) // absolute move
|
|
17
|
+
|
|
18
|
+
hMove(distance)
|
|
19
|
+
hMove(target: SceneObject) // move horizontally until hitting target
|
|
20
|
+
|
|
21
|
+
vMove(distance)
|
|
22
|
+
vMove(target)
|
|
23
|
+
|
|
24
|
+
rMove(angle) // rotate the tangent by `angle` (degrees)
|
|
25
|
+
rMove(angle, pivot: Point2D)
|
|
26
|
+
|
|
27
|
+
pMove(radius, angle) // polar move relative to current tangent
|
|
28
|
+
pMove(target, angle)
|
|
29
|
+
|
|
30
|
+
center() // jump to plane origin (alias for move() with no args)
|
|
31
|
+
|
|
32
|
+
back() // revert one cursor change
|
|
33
|
+
back(count) // revert `count` cursor changes
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
These never produce edges — they reposition the cursor (and, for
|
|
37
|
+
`rMove`, the tangent) so the next drawing call lands where you want.
|
|
38
|
+
Reach for them instead of computing absolute coordinates by hand.
|
|
39
|
+
|
|
40
|
+
## Example
|
|
41
|
+
|
|
42
|
+
```fluid.js
|
|
43
|
+
import { extrude, hLine, sketch, vLine, vMove } from "fluidcad/core";
|
|
44
|
+
|
|
45
|
+
sketch("xy", () => {
|
|
46
|
+
// Two L-shaped pieces sharing a sketch — vMove repositions without drawing.
|
|
47
|
+
hLine(40);
|
|
48
|
+
vLine(10);
|
|
49
|
+
hLine(-40);
|
|
50
|
+
vLine(-10);
|
|
51
|
+
|
|
52
|
+
vMove(30); // jump up — no edge drawn
|
|
53
|
+
hLine(20);
|
|
54
|
+
vLine(10);
|
|
55
|
+
hLine(-20);
|
|
56
|
+
vLine(-10);
|
|
57
|
+
});
|
|
58
|
+
extrude(4);
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
See [[api/cursor-lines]] for the drawing counterparts.
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
---
|
|
2
|
+
id: api/cut
|
|
3
|
+
title: cut(distance?, target?)
|
|
4
|
+
summary: Subtractive extrude. Same calling conventions as extrude, but always removes material. Positive distance cuts opposite the sketch normal (into the solid); negative cuts along it. No-arg form goes through all.
|
|
5
|
+
tags: [api, 3d, solid]
|
|
6
|
+
symbols: [cut]
|
|
7
|
+
seeAlso: [api/extrude, api/sketch, concepts/last-selection]
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
# cut
|
|
11
|
+
|
|
12
|
+
Imported from `fluidcad/core`.
|
|
13
|
+
|
|
14
|
+
```ts
|
|
15
|
+
cut() // through-all using the last sketch
|
|
16
|
+
cut(target: SceneObject)
|
|
17
|
+
cut(distance, target?)
|
|
18
|
+
cut(distance1, distance2, target?)
|
|
19
|
+
cut(face: SceneObject) // cut up to a face
|
|
20
|
+
cut("first-face")
|
|
21
|
+
cut("last-face")
|
|
22
|
+
cut(face, target)
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
Returns `Cut`. Always subtractive — equivalent to `extrude(...).remove()`.
|
|
26
|
+
Same chain set as `extrude` except no `.add()` / `.new()`: `.symmetric()`,
|
|
27
|
+
`.draft()`, `.endOffset()`, `.thin()`, `.pick()`, `.scope()`, plus
|
|
28
|
+
`.startEdges()`, `.endEdges()`, `.internalEdges()`, `.internalFaces()`.
|
|
29
|
+
|
|
30
|
+
## Direction convention
|
|
31
|
+
|
|
32
|
+
`cut` is the mirror of `extrude` — it goes *into* the material, not
|
|
33
|
+
out of it:
|
|
34
|
+
|
|
35
|
+
- **Positive `distance`** cuts in the **opposite direction of the
|
|
36
|
+
sketch normal** (into the solid the sketch sits on). This is the
|
|
37
|
+
normal pocket case.
|
|
38
|
+
- **Negative `distance`** cuts **along the sketch normal** (out of the
|
|
39
|
+
same side the sketch faces).
|
|
40
|
+
- **`cut()` with no args** is **through-all**, again opposite the sketch
|
|
41
|
+
normal.
|
|
42
|
+
|
|
43
|
+
## Example
|
|
44
|
+
|
|
45
|
+
```fluid.js
|
|
46
|
+
import { circle, cut, extrude, rect, sketch } from "fluidcad/core";
|
|
47
|
+
|
|
48
|
+
sketch("xy", () => rect(120, 80).centered());
|
|
49
|
+
const block = extrude(30);
|
|
50
|
+
sketch(block.endFaces(), () => circle(20));
|
|
51
|
+
cut(10); // 10mm-deep blind pocket
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
See [[api/extrude]] for the additive counterpart and
|
|
55
|
+
[[concepts/last-selection]] for the implicit-sketch consumption model.
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
---
|
|
2
|
+
id: api/draft
|
|
3
|
+
title: draft(angle, ...faces?)
|
|
4
|
+
summary: Applies a draft angle to selected faces — pulls them outward (positive) or inward (negative) along a reference direction.
|
|
5
|
+
tags: [api, 3d, modifier]
|
|
6
|
+
symbols: [draft]
|
|
7
|
+
seeAlso: [api/extrude, api/shell]
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
# draft
|
|
11
|
+
|
|
12
|
+
Imported from `fluidcad/core`.
|
|
13
|
+
|
|
14
|
+
```ts
|
|
15
|
+
draft(angle) // uses last selection
|
|
16
|
+
draft(angle, ...selections)
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
Returns `Draft`. Tilts the selected faces by `angle` degrees. Use it for
|
|
20
|
+
mold-release surfaces or any side wall that needs a taper distinct from
|
|
21
|
+
its base extrusion.
|
|
22
|
+
|
|
23
|
+
For draft applied during the pull itself, reach for
|
|
24
|
+
`extrude(d).draft(angle)` — the inline form is usually less plumbing.
|
|
25
|
+
|
|
26
|
+
## Example
|
|
27
|
+
|
|
28
|
+
```fluid.js
|
|
29
|
+
import { draft, extrude, rect, sketch } from "fluidcad/core";
|
|
30
|
+
|
|
31
|
+
sketch("xy", () => rect(80, 50).centered());
|
|
32
|
+
const e = extrude(30);
|
|
33
|
+
draft(5, e.sideFaces());
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
See [[api/extrude]] for inline draft and [[api/shell]] for hollowing.
|