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,129 @@
|
|
|
1
|
+
import { describe, it, expect } from "vitest";
|
|
2
|
+
import { setupOC, render } from "../setup.js";
|
|
3
|
+
import sketch from "../../core/sketch.js";
|
|
4
|
+
import extrude from "../../core/extrude.js";
|
|
5
|
+
import fillet from "../../core/fillet.js";
|
|
6
|
+
import select from "../../core/select.js";
|
|
7
|
+
import { rect } from "../../core/2d/index.js";
|
|
8
|
+
import { face, edge } from "../../filters/index.js";
|
|
9
|
+
function box() {
|
|
10
|
+
sketch("xy", () => {
|
|
11
|
+
rect(100, 50);
|
|
12
|
+
});
|
|
13
|
+
extrude(30);
|
|
14
|
+
}
|
|
15
|
+
describe("positional filter selectors (.first / .last / .at)", () => {
|
|
16
|
+
setupOC();
|
|
17
|
+
it("singleton match: first/last/at(0) all return the same face", () => {
|
|
18
|
+
box();
|
|
19
|
+
const first = select(face().onPlane("xy", 30).first());
|
|
20
|
+
const last = select(face().onPlane("xy", 30).last());
|
|
21
|
+
const at0 = select(face().onPlane("xy", 30).at(0));
|
|
22
|
+
const at1 = select(face().onPlane("xy", 30).at(1));
|
|
23
|
+
render();
|
|
24
|
+
const firstFaces = first.getShapes();
|
|
25
|
+
const lastFaces = last.getShapes();
|
|
26
|
+
const at0Faces = at0.getShapes();
|
|
27
|
+
const at1Faces = at1.getShapes();
|
|
28
|
+
expect(firstFaces).toHaveLength(1);
|
|
29
|
+
expect(lastFaces).toHaveLength(1);
|
|
30
|
+
expect(at0Faces).toHaveLength(1);
|
|
31
|
+
expect(at1Faces).toHaveLength(0);
|
|
32
|
+
});
|
|
33
|
+
it("multiple matches: first, last and at(i) pick distinct positions", () => {
|
|
34
|
+
box();
|
|
35
|
+
const all = select(face().notOnPlane("xy", 30).notOnPlane("xy"));
|
|
36
|
+
const first = select(face().notOnPlane("xy", 30).notOnPlane("xy").first());
|
|
37
|
+
const last = select(face().notOnPlane("xy", 30).notOnPlane("xy").last());
|
|
38
|
+
const at0 = select(face().notOnPlane("xy", 30).notOnPlane("xy").at(0));
|
|
39
|
+
const at2 = select(face().notOnPlane("xy", 30).notOnPlane("xy").at(2));
|
|
40
|
+
const at4 = select(face().notOnPlane("xy", 30).notOnPlane("xy").at(4));
|
|
41
|
+
render();
|
|
42
|
+
const allFaces = all.getShapes();
|
|
43
|
+
expect(allFaces).toHaveLength(4);
|
|
44
|
+
const firstFace = first.getShapes()[0];
|
|
45
|
+
const lastFace = last.getShapes()[0];
|
|
46
|
+
const at0Face = at0.getShapes()[0];
|
|
47
|
+
const at2Face = at2.getShapes()[0];
|
|
48
|
+
expect(first.getShapes()).toHaveLength(1);
|
|
49
|
+
expect(last.getShapes()).toHaveLength(1);
|
|
50
|
+
expect(at0.getShapes()).toHaveLength(1);
|
|
51
|
+
expect(at2.getShapes()).toHaveLength(1);
|
|
52
|
+
expect(at4.getShapes()).toHaveLength(0);
|
|
53
|
+
expect(at0Face).toBe(firstFace);
|
|
54
|
+
expect(at2Face).not.toBe(at0Face);
|
|
55
|
+
expect(lastFace).not.toBe(firstFace);
|
|
56
|
+
});
|
|
57
|
+
it("edge selectors: at(i), first, last match expected positions", () => {
|
|
58
|
+
box();
|
|
59
|
+
const all = select(edge().onPlane("xy"));
|
|
60
|
+
const at0 = select(edge().onPlane("xy").at(0));
|
|
61
|
+
const at3 = select(edge().onPlane("xy").at(3));
|
|
62
|
+
const at4 = select(edge().onPlane("xy").at(4));
|
|
63
|
+
const first = select(edge().onPlane("xy").first());
|
|
64
|
+
const last = select(edge().onPlane("xy").last());
|
|
65
|
+
render();
|
|
66
|
+
expect(all.getShapes()).toHaveLength(4);
|
|
67
|
+
expect(at0.getShapes()).toHaveLength(1);
|
|
68
|
+
expect(at3.getShapes()).toHaveLength(1);
|
|
69
|
+
expect(at4.getShapes()).toHaveLength(0);
|
|
70
|
+
const at0Edge = at0.getShapes()[0];
|
|
71
|
+
const at3Edge = at3.getShapes()[0];
|
|
72
|
+
const firstEdge = first.getShapes()[0];
|
|
73
|
+
const lastEdge = last.getShapes()[0];
|
|
74
|
+
expect(firstEdge).toBe(at0Edge);
|
|
75
|
+
expect(lastEdge).toBe(at3Edge);
|
|
76
|
+
});
|
|
77
|
+
it("two builders in one select: each evaluates its own selector", () => {
|
|
78
|
+
box();
|
|
79
|
+
const sel = select(face().onPlane("xy").first(), face().onPlane("xy", 30).first());
|
|
80
|
+
render();
|
|
81
|
+
expect(sel.getShapes()).toHaveLength(2);
|
|
82
|
+
});
|
|
83
|
+
it("withTangents() composes after selection", () => {
|
|
84
|
+
sketch("xy", () => {
|
|
85
|
+
rect(100, 50);
|
|
86
|
+
});
|
|
87
|
+
extrude(30);
|
|
88
|
+
select(edge().verticalTo("xy"));
|
|
89
|
+
fillet(5);
|
|
90
|
+
const sel = select(face().planar().first().withTangents());
|
|
91
|
+
render();
|
|
92
|
+
expect(sel.getShapes().length).toBeGreaterThanOrEqual(1);
|
|
93
|
+
});
|
|
94
|
+
it("last call wins when multiple selectors are chained", () => {
|
|
95
|
+
box();
|
|
96
|
+
const firstThenLast = select(face().notOnPlane("xy", 30).notOnPlane("xy").first().last());
|
|
97
|
+
const lastOnly = select(face().notOnPlane("xy", 30).notOnPlane("xy").last());
|
|
98
|
+
render();
|
|
99
|
+
const a = firstThenLast.getShapes()[0];
|
|
100
|
+
const b = lastOnly.getShapes()[0];
|
|
101
|
+
expect(firstThenLast.getShapes()).toHaveLength(1);
|
|
102
|
+
expect(a).toBe(b);
|
|
103
|
+
});
|
|
104
|
+
it("at(-1) throws", () => {
|
|
105
|
+
expect(() => face().at(-1)).toThrow();
|
|
106
|
+
expect(() => edge().at(-1)).toThrow();
|
|
107
|
+
expect(() => face().at(1.5)).toThrow();
|
|
108
|
+
});
|
|
109
|
+
it("equals() distinguishes builders by selector", () => {
|
|
110
|
+
const a = face().onPlane("xy").first();
|
|
111
|
+
const b = face().onPlane("xy").last();
|
|
112
|
+
const c = face().onPlane("xy").first();
|
|
113
|
+
const d = face().onPlane("xy").at(0);
|
|
114
|
+
const e = face().onPlane("xy").at(1);
|
|
115
|
+
const noSel = face().onPlane("xy");
|
|
116
|
+
expect(a.equals(c)).toBe(true);
|
|
117
|
+
expect(a.equals(b)).toBe(false);
|
|
118
|
+
expect(a.equals(noSel)).toBe(false);
|
|
119
|
+
expect(d.equals(e)).toBe(false);
|
|
120
|
+
expect(d.equals(face().onPlane("xy").at(0))).toBe(true);
|
|
121
|
+
});
|
|
122
|
+
it("getIndexSelector returns the configured selector", () => {
|
|
123
|
+
expect(face().getIndexSelector()).toBeUndefined();
|
|
124
|
+
expect(face().first().getIndexSelector()).toEqual({ type: "first" });
|
|
125
|
+
expect(face().last().getIndexSelector()).toEqual({ type: "last" });
|
|
126
|
+
expect(face().at(2).getIndexSelector()).toEqual({ type: "at", index: 2 });
|
|
127
|
+
expect(face().first().last().getIndexSelector()).toEqual({ type: "last" });
|
|
128
|
+
});
|
|
129
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { describe, it, expect } from "vitest";
|
|
2
|
+
import { setupOC, render } from "../setup.js";
|
|
3
|
+
import sketch from "../../core/sketch.js";
|
|
4
|
+
import extrude from "../../core/extrude.js";
|
|
5
|
+
import axis from "../../core/axis.js";
|
|
6
|
+
import repeat from "../../core/repeat.js";
|
|
7
|
+
import sweep from "../../core/sweep.js";
|
|
8
|
+
import cut from "../../core/cut.js";
|
|
9
|
+
import { rect, circle, vLine, tArc, tLine, slot, move, hMove } from "../../core/2d/index.js";
|
|
10
|
+
import copy from "../../core/copy.js";
|
|
11
|
+
import { countShapes } from "../utils.js";
|
|
12
|
+
// Regression: a circular repeat whose axis is an AxisFromEdge derived from
|
|
13
|
+
// a sketch line, whose targets are cuts on sketch-region slots. Exercises:
|
|
14
|
+
// - LazyMatrix.rotation with an unbuilt AxisObjectBase source
|
|
15
|
+
// - Extrude.getSourceDependencies pulling the containing Sketch into the
|
|
16
|
+
// clone set so Sketch.build's clone-mode path carries shapes for cloned
|
|
17
|
+
// geometry primitives (Slot here) that would otherwise lose their
|
|
18
|
+
// Sketch parent context after clone.
|
|
19
|
+
describe("repeat circular with axis-from-sketch-line and cut-of-slot targets", () => {
|
|
20
|
+
setupOC();
|
|
21
|
+
it("renders without errors and produces the expected cut instances", () => {
|
|
22
|
+
const spine = sketch("front", () => {
|
|
23
|
+
vLine(1.5);
|
|
24
|
+
tArc(-4, 45);
|
|
25
|
+
const topSegment = tLine(1.5);
|
|
26
|
+
return { topSegment };
|
|
27
|
+
}).reusable();
|
|
28
|
+
const profile = sketch("top", () => {
|
|
29
|
+
const innerPipe = circle(1.5);
|
|
30
|
+
const outerPipe = circle(2);
|
|
31
|
+
return { innerPipe, outerPipe };
|
|
32
|
+
});
|
|
33
|
+
const pipe = sweep(spine, profile.regions.outerPipe);
|
|
34
|
+
sketch("top", () => {
|
|
35
|
+
rect(3.5).centered().radius(0.5);
|
|
36
|
+
move([-2.5 / 2, -2.5 / 2]);
|
|
37
|
+
const c = circle(0.5);
|
|
38
|
+
copy("circular", [0, 0], { count: 4, angle: 360 }, c);
|
|
39
|
+
});
|
|
40
|
+
extrude(0.375);
|
|
41
|
+
sketch(pipe.endFaces(), () => {
|
|
42
|
+
circle(4);
|
|
43
|
+
});
|
|
44
|
+
const upperFlange = extrude(-0.625);
|
|
45
|
+
sweep(spine, profile.regions.innerPipe).remove();
|
|
46
|
+
const slots = sketch(upperFlange.endFaces(), () => {
|
|
47
|
+
hMove(3.25 / 2);
|
|
48
|
+
const outerSlot = slot(1, 0.75 / 2);
|
|
49
|
+
const innerSlot = slot(1, 0.45 / 2);
|
|
50
|
+
return { outerSlot, innerSlot };
|
|
51
|
+
});
|
|
52
|
+
const s1 = cut(slots.regions.innerSlot);
|
|
53
|
+
const s2 = cut(0.25, slots.regions.outerSlot);
|
|
54
|
+
const a = axis(spine.regions.topSegment);
|
|
55
|
+
repeat("circular", a, { count: 4, angle: 360 }, s1, s2);
|
|
56
|
+
const scene = render();
|
|
57
|
+
expect(countShapes(scene)).toBeGreaterThan(0);
|
|
58
|
+
expect(scene.getAllSceneObjects().some(o => o.getError())).toBe(false);
|
|
59
|
+
});
|
|
60
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|