fluidcad 0.0.2
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/LICENSE.txt +504 -0
- package/README.md +175 -0
- package/bin/fluidcad.js +94 -0
- package/bin/watcher.js +55 -0
- package/lib/dist/common/edge.d.ts +14 -0
- package/lib/dist/common/edge.js +32 -0
- package/lib/dist/common/face.d.ts +31 -0
- package/lib/dist/common/face.js +83 -0
- package/lib/dist/common/materials.d.ts +7 -0
- package/lib/dist/common/materials.js +22 -0
- package/lib/dist/common/scene-object.d.ts +111 -0
- package/lib/dist/common/scene-object.js +380 -0
- package/lib/dist/common/shape-factory.d.ts +8 -0
- package/lib/dist/common/shape-factory.js +31 -0
- package/lib/dist/common/shape-type.d.ts +1 -0
- package/lib/dist/common/shape-type.js +1 -0
- package/lib/dist/common/shape.d.ts +43 -0
- package/lib/dist/common/shape.js +95 -0
- package/lib/dist/common/shapes.d.ts +6 -0
- package/lib/dist/common/shapes.js +6 -0
- package/lib/dist/common/solid-face.d.ts +9 -0
- package/lib/dist/common/solid-face.js +22 -0
- package/lib/dist/common/solid.d.ts +20 -0
- package/lib/dist/common/solid.js +68 -0
- package/lib/dist/common/vertex.d.ts +17 -0
- package/lib/dist/common/vertex.js +44 -0
- package/lib/dist/common/wire.d.ts +22 -0
- package/lib/dist/common/wire.js +97 -0
- package/lib/dist/constraints/constraint.d.ts +11 -0
- package/lib/dist/constraints/constraint.js +51 -0
- package/lib/dist/constraints/outside.d.ts +3 -0
- package/lib/dist/constraints/outside.js +4 -0
- package/lib/dist/core/2d/aline.d.ts +28 -0
- package/lib/dist/core/2d/aline.js +26 -0
- package/lib/dist/core/2d/arc.d.ts +77 -0
- package/lib/dist/core/2d/arc.js +49 -0
- package/lib/dist/core/2d/aslot.d.ts +12 -0
- package/lib/dist/core/2d/aslot.js +40 -0
- package/lib/dist/core/2d/bezier.d.ts +16 -0
- package/lib/dist/core/2d/bezier.js +15 -0
- package/lib/dist/core/2d/circle.d.ts +24 -0
- package/lib/dist/core/2d/circle.js +44 -0
- package/lib/dist/core/2d/connect.d.ts +11 -0
- package/lib/dist/core/2d/connect.js +10 -0
- package/lib/dist/core/2d/crect.d.ts +12 -0
- package/lib/dist/core/2d/crect.js +74 -0
- package/lib/dist/core/2d/face-driller.d.ts +8 -0
- package/lib/dist/core/2d/face-driller.js +70 -0
- package/lib/dist/core/2d/face-maker.d.ts +13 -0
- package/lib/dist/core/2d/face-maker.js +119 -0
- package/lib/dist/core/2d/face-maker2.d.ts +6 -0
- package/lib/dist/core/2d/face-maker2.js +54 -0
- package/lib/dist/core/2d/hline.d.ts +33 -0
- package/lib/dist/core/2d/hline.js +37 -0
- package/lib/dist/core/2d/hmove.d.ts +9 -0
- package/lib/dist/core/2d/hmove.js +11 -0
- package/lib/dist/core/2d/index.d.ts +22 -0
- package/lib/dist/core/2d/index.js +22 -0
- package/lib/dist/core/2d/line.d.ts +24 -0
- package/lib/dist/core/2d/line.js +40 -0
- package/lib/dist/core/2d/move.d.ts +13 -0
- package/lib/dist/core/2d/move.js +13 -0
- package/lib/dist/core/2d/offset.d.ts +21 -0
- package/lib/dist/core/2d/offset.js +24 -0
- package/lib/dist/core/2d/pmove.d.ts +11 -0
- package/lib/dist/core/2d/pmove.js +12 -0
- package/lib/dist/core/2d/polygon.d.ts +38 -0
- package/lib/dist/core/2d/polygon.js +63 -0
- package/lib/dist/core/2d/project.d.ts +17 -0
- package/lib/dist/core/2d/project.js +20 -0
- package/lib/dist/core/2d/rect.d.ts +27 -0
- package/lib/dist/core/2d/rect.js +58 -0
- package/lib/dist/core/2d/rmove.d.ts +17 -0
- package/lib/dist/core/2d/rmove.js +14 -0
- package/lib/dist/core/2d/slot.d.ts +49 -0
- package/lib/dist/core/2d/slot.js +65 -0
- package/lib/dist/core/2d/tarc.d.ts +46 -0
- package/lib/dist/core/2d/tarc.js +61 -0
- package/lib/dist/core/2d/tcircle.d.ts +15 -0
- package/lib/dist/core/2d/tcircle.js +24 -0
- package/lib/dist/core/2d/tline.d.ts +24 -0
- package/lib/dist/core/2d/tline.js +30 -0
- package/lib/dist/core/2d/vline.d.ts +33 -0
- package/lib/dist/core/2d/vline.js +37 -0
- package/lib/dist/core/2d/vmove.d.ts +9 -0
- package/lib/dist/core/2d/vmove.js +11 -0
- package/lib/dist/core/2d/wire.d.ts +11 -0
- package/lib/dist/core/2d/wire.js +29 -0
- package/lib/dist/core/axis.d.ts +41 -0
- package/lib/dist/core/axis.js +104 -0
- package/lib/dist/core/chamfer.d.ts +31 -0
- package/lib/dist/core/chamfer.js +32 -0
- package/lib/dist/core/color.d.ts +16 -0
- package/lib/dist/core/color.js +19 -0
- package/lib/dist/core/common.d.ts +12 -0
- package/lib/dist/core/common.js +36 -0
- package/lib/dist/core/copy.d.ts +58 -0
- package/lib/dist/core/copy.js +49 -0
- package/lib/dist/core/cut.d.ts +46 -0
- package/lib/dist/core/cut.js +53 -0
- package/lib/dist/core/cylinder.d.ts +11 -0
- package/lib/dist/core/cylinder.js +10 -0
- package/lib/dist/core/extrude.d.ts +36 -0
- package/lib/dist/core/extrude.js +55 -0
- package/lib/dist/core/fillet.d.ts +33 -0
- package/lib/dist/core/fillet.js +58 -0
- package/lib/dist/core/fuse.d.ts +14 -0
- package/lib/dist/core/fuse.js +36 -0
- package/lib/dist/core/index.d.ts +32 -0
- package/lib/dist/core/index.js +30 -0
- package/lib/dist/core/interfaces.d.ts +411 -0
- package/lib/dist/core/interfaces.js +1 -0
- package/lib/dist/core/load.d.ts +10 -0
- package/lib/dist/core/load.js +10 -0
- package/lib/dist/core/loft.d.ts +10 -0
- package/lib/dist/core/loft.js +21 -0
- package/lib/dist/core/mirror.d.ts +40 -0
- package/lib/dist/core/mirror.js +95 -0
- package/lib/dist/core/part.d.ts +7 -0
- package/lib/dist/core/part.js +29 -0
- package/lib/dist/core/plane.d.ts +56 -0
- package/lib/dist/core/plane.js +111 -0
- package/lib/dist/core/region.d.ts +13 -0
- package/lib/dist/core/region.js +18 -0
- package/lib/dist/core/remove.d.ts +10 -0
- package/lib/dist/core/remove.js +10 -0
- package/lib/dist/core/repeat.d.ts +41 -0
- package/lib/dist/core/repeat.js +146 -0
- package/lib/dist/core/revolve.d.ts +19 -0
- package/lib/dist/core/revolve.js +39 -0
- package/lib/dist/core/rotate.d.ts +34 -0
- package/lib/dist/core/rotate.js +48 -0
- package/lib/dist/core/select.d.ts +12 -0
- package/lib/dist/core/select.js +21 -0
- package/lib/dist/core/shell.d.ts +16 -0
- package/lib/dist/core/shell.js +28 -0
- package/lib/dist/core/sketch.d.ts +18 -0
- package/lib/dist/core/sketch.js +34 -0
- package/lib/dist/core/sphere.d.ts +16 -0
- package/lib/dist/core/sphere.js +11 -0
- package/lib/dist/core/split.d.ts +12 -0
- package/lib/dist/core/split.js +26 -0
- package/lib/dist/core/subtract.d.ts +11 -0
- package/lib/dist/core/subtract.js +10 -0
- package/lib/dist/core/sweep.d.ts +16 -0
- package/lib/dist/core/sweep.js +29 -0
- package/lib/dist/core/translate.d.ts +64 -0
- package/lib/dist/core/translate.js +39 -0
- package/lib/dist/core/trim.d.ts +13 -0
- package/lib/dist/core/trim.js +18 -0
- package/lib/dist/core/use.d.ts +5 -0
- package/lib/dist/core/use.js +22 -0
- package/lib/dist/features/2d/aline.d.ts +18 -0
- package/lib/dist/features/2d/aline.js +78 -0
- package/lib/dist/features/2d/amove.d.ts +14 -0
- package/lib/dist/features/2d/amove.js +33 -0
- package/lib/dist/features/2d/arc-from-center.d.ts +16 -0
- package/lib/dist/features/2d/arc-from-center.js +69 -0
- package/lib/dist/features/2d/arc-to-point.d.ts +17 -0
- package/lib/dist/features/2d/arc-to-point.js +95 -0
- package/lib/dist/features/2d/arc.d.ts +19 -0
- package/lib/dist/features/2d/arc.js +94 -0
- package/lib/dist/features/2d/bezier.d.ts +15 -0
- package/lib/dist/features/2d/bezier.js +77 -0
- package/lib/dist/features/2d/circle.d.ts +17 -0
- package/lib/dist/features/2d/circle.js +58 -0
- package/lib/dist/features/2d/connect.d.ts +12 -0
- package/lib/dist/features/2d/connect.js +105 -0
- package/lib/dist/features/2d/constraints/constraint.d.ts +11 -0
- package/lib/dist/features/2d/constraints/constraint.js +49 -0
- package/lib/dist/features/2d/constraints/geometry-qualifier.d.ts +6 -0
- package/lib/dist/features/2d/constraints/geometry-qualifier.js +13 -0
- package/lib/dist/features/2d/constraints/outside.d.ts +3 -0
- package/lib/dist/features/2d/constraints/outside.js +4 -0
- package/lib/dist/features/2d/constraints/qualified-geometry.d.ts +16 -0
- package/lib/dist/features/2d/constraints/qualified-geometry.js +36 -0
- package/lib/dist/features/2d/extrudable-base.d.ts +15 -0
- package/lib/dist/features/2d/extrudable-base.js +27 -0
- package/lib/dist/features/2d/geometry.d.ts +20 -0
- package/lib/dist/features/2d/geometry.js +77 -0
- package/lib/dist/features/2d/hline.d.ts +16 -0
- package/lib/dist/features/2d/hline.js +66 -0
- package/lib/dist/features/2d/hmove.d.ts +14 -0
- package/lib/dist/features/2d/hmove.js +37 -0
- package/lib/dist/features/2d/line.d.ts +15 -0
- package/lib/dist/features/2d/line.js +59 -0
- package/lib/dist/features/2d/move.d.ts +15 -0
- package/lib/dist/features/2d/move.js +36 -0
- package/lib/dist/features/2d/offset.d.ts +18 -0
- package/lib/dist/features/2d/offset.js +117 -0
- package/lib/dist/features/2d/pmove.d.ts +16 -0
- package/lib/dist/features/2d/pmove.js +40 -0
- package/lib/dist/features/2d/polygon.d.ts +25 -0
- package/lib/dist/features/2d/polygon.js +107 -0
- package/lib/dist/features/2d/projection.d.ts +15 -0
- package/lib/dist/features/2d/projection.js +94 -0
- package/lib/dist/features/2d/rect.d.ts +45 -0
- package/lib/dist/features/2d/rect.js +262 -0
- package/lib/dist/features/2d/rmove.d.ts +17 -0
- package/lib/dist/features/2d/rmove.js +39 -0
- package/lib/dist/features/2d/sketch.d.ts +34 -0
- package/lib/dist/features/2d/sketch.js +171 -0
- package/lib/dist/features/2d/slot-from-edge.d.ts +19 -0
- package/lib/dist/features/2d/slot-from-edge.js +66 -0
- package/lib/dist/features/2d/slot.d.ts +24 -0
- package/lib/dist/features/2d/slot.js +119 -0
- package/lib/dist/features/2d/tarc-constrained.d.ts +20 -0
- package/lib/dist/features/2d/tarc-constrained.js +64 -0
- package/lib/dist/features/2d/tarc-to-point-tangent.d.ts +15 -0
- package/lib/dist/features/2d/tarc-to-point-tangent.js +86 -0
- package/lib/dist/features/2d/tarc-to-point.d.ts +13 -0
- package/lib/dist/features/2d/tarc-to-point.js +86 -0
- package/lib/dist/features/2d/tarc-two-circles.d.ts +18 -0
- package/lib/dist/features/2d/tarc-two-circles.js +61 -0
- package/lib/dist/features/2d/tarc-with-tangent.d.ts +17 -0
- package/lib/dist/features/2d/tarc-with-tangent.js +71 -0
- package/lib/dist/features/2d/tarc.d.ts +13 -0
- package/lib/dist/features/2d/tarc.js +71 -0
- package/lib/dist/features/2d/tcircle-constrained.d.ts +14 -0
- package/lib/dist/features/2d/tcircle-constrained.js +37 -0
- package/lib/dist/features/2d/tcircle-three-tan.d.ts +13 -0
- package/lib/dist/features/2d/tcircle-three-tan.js +33 -0
- package/lib/dist/features/2d/tcircle-two-tan.d.ts +13 -0
- package/lib/dist/features/2d/tcircle-two-tan.js +33 -0
- package/lib/dist/features/2d/tline-constrained.d.ts +27 -0
- package/lib/dist/features/2d/tline-constrained.js +82 -0
- package/lib/dist/features/2d/tline.d.ts +12 -0
- package/lib/dist/features/2d/tline.js +49 -0
- package/lib/dist/features/2d/vline.d.ts +16 -0
- package/lib/dist/features/2d/vline.js +65 -0
- package/lib/dist/features/2d/vmove.d.ts +14 -0
- package/lib/dist/features/2d/vmove.js +37 -0
- package/lib/dist/features/2d/wire.d.ts +12 -0
- package/lib/dist/features/2d/wire.js +76 -0
- package/lib/dist/features/Extrude.d.ts +1 -0
- package/lib/dist/features/Extrude.js +1 -0
- package/lib/dist/features/axis-from-edge.d.ts +15 -0
- package/lib/dist/features/axis-from-edge.js +82 -0
- package/lib/dist/features/axis-mid.d.ts +16 -0
- package/lib/dist/features/axis-mid.js +59 -0
- package/lib/dist/features/axis-renderable-base.d.ts +8 -0
- package/lib/dist/features/axis-renderable-base.js +12 -0
- package/lib/dist/features/axis.d.ts +14 -0
- package/lib/dist/features/axis.js +43 -0
- package/lib/dist/features/chamfer.d.ts +20 -0
- package/lib/dist/features/chamfer.js +129 -0
- package/lib/dist/features/color.d.ts +11 -0
- package/lib/dist/features/color.js +93 -0
- package/lib/dist/features/common.d.ts +12 -0
- package/lib/dist/features/common.js +70 -0
- package/lib/dist/features/common2d.d.ts +15 -0
- package/lib/dist/features/common2d.js +96 -0
- package/lib/dist/features/copy-circular.d.ts +23 -0
- package/lib/dist/features/copy-circular.js +73 -0
- package/lib/dist/features/copy-circular2d.d.ts +15 -0
- package/lib/dist/features/copy-circular2d.js +84 -0
- package/lib/dist/features/copy-linear.d.ts +23 -0
- package/lib/dist/features/copy-linear.js +101 -0
- package/lib/dist/features/copy-linear2d.d.ts +15 -0
- package/lib/dist/features/copy-linear2d.js +108 -0
- package/lib/dist/features/cut-base.d.ts +49 -0
- package/lib/dist/features/cut-base.js +312 -0
- package/lib/dist/features/cut-symmetric.d.ts +23 -0
- package/lib/dist/features/cut-symmetric.js +119 -0
- package/lib/dist/features/cut-two-distances.d.ts +24 -0
- package/lib/dist/features/cut-two-distances.js +110 -0
- package/lib/dist/features/cut.d.ts +27 -0
- package/lib/dist/features/cut.js +101 -0
- package/lib/dist/features/cylinder.d.ts +13 -0
- package/lib/dist/features/cylinder.js +33 -0
- package/lib/dist/features/extrude-base.d.ts +56 -0
- package/lib/dist/features/extrude-base.js +331 -0
- package/lib/dist/features/extrude-options.d.ts +8 -0
- package/lib/dist/features/extrude-options.js +1 -0
- package/lib/dist/features/extrude-symmetric.d.ts +28 -0
- package/lib/dist/features/extrude-symmetric.js +177 -0
- package/lib/dist/features/extrude-to-face.d.ts +35 -0
- package/lib/dist/features/extrude-to-face.js +275 -0
- package/lib/dist/features/extrude-two-distances.d.ts +21 -0
- package/lib/dist/features/extrude-two-distances.js +116 -0
- package/lib/dist/features/extrude.d.ts +25 -0
- package/lib/dist/features/extrude.js +182 -0
- package/lib/dist/features/fillet.d.ts +24 -0
- package/lib/dist/features/fillet.js +125 -0
- package/lib/dist/features/fillet2d.d.ts +16 -0
- package/lib/dist/features/fillet2d.js +98 -0
- package/lib/dist/features/fuse.d.ts +10 -0
- package/lib/dist/features/fuse.js +63 -0
- package/lib/dist/features/fuse2d.d.ts +13 -0
- package/lib/dist/features/fuse2d.js +86 -0
- package/lib/dist/features/infinite-extrude.d.ts +10 -0
- package/lib/dist/features/infinite-extrude.js +44 -0
- package/lib/dist/features/lazy-scene-object.d.ts +16 -0
- package/lib/dist/features/lazy-scene-object.js +52 -0
- package/lib/dist/features/lazy-vertex.d.ts +19 -0
- package/lib/dist/features/lazy-vertex.js +62 -0
- package/lib/dist/features/load.d.ts +9 -0
- package/lib/dist/features/load.js +31 -0
- package/lib/dist/features/loft.d.ts +27 -0
- package/lib/dist/features/loft.js +273 -0
- package/lib/dist/features/mirror-feature.d.ts +15 -0
- package/lib/dist/features/mirror-feature.js +39 -0
- package/lib/dist/features/mirror-shape.d.ts +14 -0
- package/lib/dist/features/mirror-shape.js +86 -0
- package/lib/dist/features/mirror-shape2d.d.ts +18 -0
- package/lib/dist/features/mirror-shape2d.js +110 -0
- package/lib/dist/features/part.d.ts +12 -0
- package/lib/dist/features/part.js +36 -0
- package/lib/dist/features/plane-from-object.d.ts +29 -0
- package/lib/dist/features/plane-from-object.js +103 -0
- package/lib/dist/features/plane-mid.d.ts +18 -0
- package/lib/dist/features/plane-mid.js +54 -0
- package/lib/dist/features/plane-renderable-base.d.ts +9 -0
- package/lib/dist/features/plane-renderable-base.js +15 -0
- package/lib/dist/features/plane.d.ts +21 -0
- package/lib/dist/features/plane.js +64 -0
- package/lib/dist/features/region2d.d.ts +25 -0
- package/lib/dist/features/region2d.js +185 -0
- package/lib/dist/features/remove.d.ts +9 -0
- package/lib/dist/features/remove.js +33 -0
- package/lib/dist/features/repeat-circular.d.ts +23 -0
- package/lib/dist/features/repeat-circular.js +47 -0
- package/lib/dist/features/repeat-circular2d.d.ts +17 -0
- package/lib/dist/features/repeat-circular2d.js +90 -0
- package/lib/dist/features/repeat-linear.d.ts +23 -0
- package/lib/dist/features/repeat-linear.js +52 -0
- package/lib/dist/features/repeat-linear2d.d.ts +17 -0
- package/lib/dist/features/repeat-linear2d.js +114 -0
- package/lib/dist/features/revolve-options.d.ts +6 -0
- package/lib/dist/features/revolve-options.js +1 -0
- package/lib/dist/features/revolve.d.ts +23 -0
- package/lib/dist/features/revolve.js +150 -0
- package/lib/dist/features/rotate.d.ts +16 -0
- package/lib/dist/features/rotate.js +89 -0
- package/lib/dist/features/rotate2d.d.ts +15 -0
- package/lib/dist/features/rotate2d.js +83 -0
- package/lib/dist/features/select.d.ts +26 -0
- package/lib/dist/features/select.js +113 -0
- package/lib/dist/features/shell.d.ts +24 -0
- package/lib/dist/features/shell.js +214 -0
- package/lib/dist/features/simple-extruder.d.ts +22 -0
- package/lib/dist/features/simple-extruder.js +108 -0
- package/lib/dist/features/sphere.d.ts +13 -0
- package/lib/dist/features/sphere.js +33 -0
- package/lib/dist/features/split.d.ts +14 -0
- package/lib/dist/features/split.js +74 -0
- package/lib/dist/features/split2d.d.ts +13 -0
- package/lib/dist/features/split2d.js +69 -0
- package/lib/dist/features/state-scene-object.d.ts +15 -0
- package/lib/dist/features/state-scene-object.js +44 -0
- package/lib/dist/features/state-select.d.ts +21 -0
- package/lib/dist/features/state-select.js +73 -0
- package/lib/dist/features/static-scene-object.d.ts +10 -0
- package/lib/dist/features/static-scene-object.js +21 -0
- package/lib/dist/features/subtract.d.ts +13 -0
- package/lib/dist/features/subtract.js +56 -0
- package/lib/dist/features/sweep.d.ts +22 -0
- package/lib/dist/features/sweep.js +129 -0
- package/lib/dist/features/translate.d.ts +17 -0
- package/lib/dist/features/translate.js +76 -0
- package/lib/dist/features/translate2d.d.ts +16 -0
- package/lib/dist/features/translate2d.js +61 -0
- package/lib/dist/features/trim2d.d.ts +15 -0
- package/lib/dist/features/trim2d.js +154 -0
- package/lib/dist/filters/all-filter.d.ts +8 -0
- package/lib/dist/filters/all-filter.js +12 -0
- package/lib/dist/filters/edge/at-index.d.ts +21 -0
- package/lib/dist/filters/edge/at-index.js +82 -0
- package/lib/dist/filters/edge/circle-filter.d.ts +17 -0
- package/lib/dist/filters/edge/circle-filter.js +34 -0
- package/lib/dist/filters/edge/curve-filter.d.ts +17 -0
- package/lib/dist/filters/edge/curve-filter.js +34 -0
- package/lib/dist/filters/edge/edge-filter.d.ts +22 -0
- package/lib/dist/filters/edge/edge-filter.js +169 -0
- package/lib/dist/filters/edge/line-filter.d.ts +14 -0
- package/lib/dist/filters/edge/line-filter.js +27 -0
- package/lib/dist/filters/edge/on-plane.d.ts +20 -0
- package/lib/dist/filters/edge/on-plane.js +70 -0
- package/lib/dist/filters/edge/parallel.d.ts +18 -0
- package/lib/dist/filters/edge/parallel.js +41 -0
- package/lib/dist/filters/edge/vertical-plane.d.ts +18 -0
- package/lib/dist/filters/edge/vertical-plane.js +41 -0
- package/lib/dist/filters/face/at-index.d.ts +21 -0
- package/lib/dist/filters/face/at-index.js +89 -0
- package/lib/dist/filters/face/circle-filter.d.ts +17 -0
- package/lib/dist/filters/face/circle-filter.js +34 -0
- package/lib/dist/filters/face/cone-filter.d.ts +15 -0
- package/lib/dist/filters/face/cone-filter.js +30 -0
- package/lib/dist/filters/face/cylinder-curve.d.ts +17 -0
- package/lib/dist/filters/face/cylinder-curve.js +34 -0
- package/lib/dist/filters/face/cylinder.d.ts +17 -0
- package/lib/dist/filters/face/cylinder.js +34 -0
- package/lib/dist/filters/face/face-filter.d.ts +21 -0
- package/lib/dist/filters/face/face-filter.js +134 -0
- package/lib/dist/filters/face/on-plane.d.ts +18 -0
- package/lib/dist/filters/face/on-plane.js +41 -0
- package/lib/dist/filters/face/parallel.d.ts +18 -0
- package/lib/dist/filters/face/parallel.js +41 -0
- package/lib/dist/filters/filter-base.d.ts +8 -0
- package/lib/dist/filters/filter-base.js +2 -0
- package/lib/dist/filters/filter-builder-base.d.ts +10 -0
- package/lib/dist/filters/filter-builder-base.js +31 -0
- package/lib/dist/filters/filter.d.ts +8 -0
- package/lib/dist/filters/filter.js +33 -0
- package/lib/dist/filters/index.d.ts +4 -0
- package/lib/dist/filters/index.js +8 -0
- package/lib/dist/filters/near-point-filter.d.ts +11 -0
- package/lib/dist/filters/near-point-filter.js +33 -0
- package/lib/dist/helpers/clone-transform.d.ts +3 -0
- package/lib/dist/helpers/clone-transform.js +46 -0
- package/lib/dist/helpers/cut-helpers.d.ts +13 -0
- package/lib/dist/helpers/cut-helpers.js +79 -0
- package/lib/dist/helpers/math-helpers.d.ts +2 -0
- package/lib/dist/helpers/math-helpers.js +6 -0
- package/lib/dist/helpers/normalize.d.ts +12 -0
- package/lib/dist/helpers/normalize.js +118 -0
- package/lib/dist/helpers/resolve-filters.d.ts +6 -0
- package/lib/dist/helpers/resolve-filters.js +25 -0
- package/lib/dist/helpers/resolve.d.ts +8 -0
- package/lib/dist/helpers/resolve.js +45 -0
- package/lib/dist/helpers/scene-helpers.d.ts +17 -0
- package/lib/dist/helpers/scene-helpers.js +67 -0
- package/lib/dist/helpers/types.d.ts +27 -0
- package/lib/dist/helpers/types.js +1 -0
- package/lib/dist/index.d.ts +37 -0
- package/lib/dist/index.js +75 -0
- package/lib/dist/io/file-export.d.ts +30 -0
- package/lib/dist/io/file-export.js +45 -0
- package/lib/dist/io/file-import.d.ts +8 -0
- package/lib/dist/io/file-import.js +81 -0
- package/lib/dist/load.d.ts +1 -0
- package/lib/dist/load.js +1 -0
- package/lib/dist/math/axis.d.ts +72 -0
- package/lib/dist/math/axis.js +157 -0
- package/lib/dist/math/axis.test.d.ts +1 -0
- package/lib/dist/math/axis.test.js +287 -0
- package/lib/dist/math/convert.d.ts +2 -0
- package/lib/dist/math/convert.js +1 -0
- package/lib/dist/math/coordinate-system.d.ts +43 -0
- package/lib/dist/math/coordinate-system.js +140 -0
- package/lib/dist/math/coordinate-system.test.d.ts +1 -0
- package/lib/dist/math/coordinate-system.test.js +308 -0
- package/lib/dist/math/index.d.ts +8 -0
- package/lib/dist/math/index.js +8 -0
- package/lib/dist/math/matrix4.d.ts +53 -0
- package/lib/dist/math/matrix4.js +336 -0
- package/lib/dist/math/matrix4.test.d.ts +1 -0
- package/lib/dist/math/matrix4.test.js +357 -0
- package/lib/dist/math/plane.d.ts +60 -0
- package/lib/dist/math/plane.js +243 -0
- package/lib/dist/math/plane.test.d.ts +1 -0
- package/lib/dist/math/plane.test.js +398 -0
- package/lib/dist/math/point.d.ts +73 -0
- package/lib/dist/math/point.js +227 -0
- package/lib/dist/math/point.test.d.ts +1 -0
- package/lib/dist/math/point.test.js +385 -0
- package/lib/dist/math/quaternion.d.ts +37 -0
- package/lib/dist/math/quaternion.js +234 -0
- package/lib/dist/math/quaternion.test.d.ts +1 -0
- package/lib/dist/math/quaternion.test.js +278 -0
- package/lib/dist/math/vector3d.d.ts +43 -0
- package/lib/dist/math/vector3d.js +143 -0
- package/lib/dist/math/vector3d.test.d.ts +1 -0
- package/lib/dist/math/vector3d.test.js +276 -0
- package/lib/dist/oc/boolean-ops.d.ts +36 -0
- package/lib/dist/oc/boolean-ops.js +337 -0
- package/lib/dist/oc/constraint-resolver.d.ts +7 -0
- package/lib/dist/oc/constraint-resolver.js +31 -0
- package/lib/dist/oc/constraints/constraint-helpers.d.ts +33 -0
- package/lib/dist/oc/constraints/constraint-helpers.js +252 -0
- package/lib/dist/oc/constraints/constraint-solver-adaptor.d.ts +22 -0
- package/lib/dist/oc/constraints/constraint-solver-adaptor.js +62 -0
- package/lib/dist/oc/constraints/constraint-solver.d.ts +18 -0
- package/lib/dist/oc/constraints/constraint-solver.js +2 -0
- package/lib/dist/oc/constraints/create-solver.d.ts +2 -0
- package/lib/dist/oc/constraints/create-solver.js +6 -0
- package/lib/dist/oc/constraints/curve/curve-constraint-solver.d.ts +13 -0
- package/lib/dist/oc/constraints/curve/curve-constraint-solver.js +18 -0
- package/lib/dist/oc/constraints/curve/tangent-circle-solver.d.ts +16 -0
- package/lib/dist/oc/constraints/curve/tangent-circle-solver.js +112 -0
- package/lib/dist/oc/constraints/curve/tangent-line-solver.d.ts +19 -0
- package/lib/dist/oc/constraints/curve/tangent-line-solver.js +83 -0
- package/lib/dist/oc/constraints/curve-constraint-solver.d.ts +1 -0
- package/lib/dist/oc/constraints/curve-constraint-solver.js +2 -0
- package/lib/dist/oc/constraints/geometric/geometric-constraint-solver.d.ts +12 -0
- package/lib/dist/oc/constraints/geometric/geometric-constraint-solver.js +17 -0
- package/lib/dist/oc/constraints/geometric/tangent-circle-solver.d.ts +21 -0
- package/lib/dist/oc/constraints/geometric/tangent-circle-solver.js +220 -0
- package/lib/dist/oc/constraints/geometric/tangent-line-solver.d.ts +19 -0
- package/lib/dist/oc/constraints/geometric/tangent-line-solver.js +92 -0
- package/lib/dist/oc/constraints/geometric-constraint-solver.d.ts +1 -0
- package/lib/dist/oc/constraints/geometric-constraint-solver.js +5 -0
- package/lib/dist/oc/convert.d.ts +42 -0
- package/lib/dist/oc/convert.js +231 -0
- package/lib/dist/oc/edge-ops.d.ts +37 -0
- package/lib/dist/oc/edge-ops.js +306 -0
- package/lib/dist/oc/edge-props.d.ts +11 -0
- package/lib/dist/oc/edge-props.js +45 -0
- package/lib/dist/oc/edge-query.d.ts +44 -0
- package/lib/dist/oc/edge-query.js +235 -0
- package/lib/dist/oc/explorer.d.ts +34 -0
- package/lib/dist/oc/explorer.js +179 -0
- package/lib/dist/oc/extrude-ops.d.ts +22 -0
- package/lib/dist/oc/extrude-ops.js +149 -0
- package/lib/dist/oc/face-maker.d.ts +14 -0
- package/lib/dist/oc/face-maker.js +191 -0
- package/lib/dist/oc/face-maker2.d.ts +10 -0
- package/lib/dist/oc/face-maker2.js +139 -0
- package/lib/dist/oc/face-ops.d.ts +28 -0
- package/lib/dist/oc/face-ops.js +252 -0
- package/lib/dist/oc/face-props.d.ts +12 -0
- package/lib/dist/oc/face-props.js +81 -0
- package/lib/dist/oc/face-query.d.ts +35 -0
- package/lib/dist/oc/face-query.js +341 -0
- package/lib/dist/oc/fillet-ops.d.ts +13 -0
- package/lib/dist/oc/fillet-ops.js +153 -0
- package/lib/dist/oc/geometry.d.ts +22 -0
- package/lib/dist/oc/geometry.js +231 -0
- package/lib/dist/oc/hit-test.d.ts +11 -0
- package/lib/dist/oc/hit-test.js +85 -0
- package/lib/dist/oc/index.d.ts +24 -0
- package/lib/dist/oc/index.js +21 -0
- package/lib/dist/oc/init.d.ts +3 -0
- package/lib/dist/oc/init.js +17 -0
- package/lib/dist/oc/intersection.d.ts +10 -0
- package/lib/dist/oc/intersection.js +107 -0
- package/lib/dist/oc/io.d.ts +49 -0
- package/lib/dist/oc/io.js +417 -0
- package/lib/dist/oc/loft-ops.d.ts +5 -0
- package/lib/dist/oc/loft-ops.js +26 -0
- package/lib/dist/oc/measure.d.ts +21 -0
- package/lib/dist/oc/measure.js +256 -0
- package/lib/dist/oc/mesh.d.ts +15 -0
- package/lib/dist/oc/mesh.js +110 -0
- package/lib/dist/oc/primitives.d.ts +5 -0
- package/lib/dist/oc/primitives.js +19 -0
- package/lib/dist/oc/props.d.ts +13 -0
- package/lib/dist/oc/props.js +18 -0
- package/lib/dist/oc/shape-ops.d.ts +34 -0
- package/lib/dist/oc/shape-ops.js +208 -0
- package/lib/dist/oc/shell-ops.d.ts +5 -0
- package/lib/dist/oc/shell-ops.js +25 -0
- package/lib/dist/oc/sweep-ops.d.ts +12 -0
- package/lib/dist/oc/sweep-ops.js +39 -0
- package/lib/dist/oc/tangent-circle-solver.d.ts +17 -0
- package/lib/dist/oc/tangent-circle-solver.js +72 -0
- package/lib/dist/oc/tangent-line-solver.d.ts +17 -0
- package/lib/dist/oc/tangent-line-solver.js +83 -0
- package/lib/dist/oc/tangent-solver.d.ts +14 -0
- package/lib/dist/oc/tangent-solver.js +199 -0
- package/lib/dist/oc/vertex-ops.d.ts +11 -0
- package/lib/dist/oc/vertex-ops.js +39 -0
- package/lib/dist/oc/wire-ops.d.ts +21 -0
- package/lib/dist/oc/wire-ops.js +176 -0
- package/lib/dist/rendering/builder-context.d.ts +16 -0
- package/lib/dist/rendering/builder-context.js +63 -0
- package/lib/dist/rendering/mesh-builder.d.ts +5 -0
- package/lib/dist/rendering/mesh-builder.js +43 -0
- package/lib/dist/rendering/render-edge.d.ts +3 -0
- package/lib/dist/rendering/render-edge.js +4 -0
- package/lib/dist/rendering/render-face.d.ts +2 -0
- package/lib/dist/rendering/render-face.js +5 -0
- package/lib/dist/rendering/render-solid.d.ts +3 -0
- package/lib/dist/rendering/render-solid.js +61 -0
- package/lib/dist/rendering/render-wire.d.ts +6 -0
- package/lib/dist/rendering/render-wire.js +27 -0
- package/lib/dist/rendering/render.d.ts +3 -0
- package/lib/dist/rendering/render.js +183 -0
- package/lib/dist/rendering/scene-compare.d.ts +4 -0
- package/lib/dist/rendering/scene-compare.js +41 -0
- package/lib/dist/rendering/scene.d.ts +81 -0
- package/lib/dist/rendering/scene.js +206 -0
- package/lib/dist/scene-manager.d.ts +32 -0
- package/lib/dist/scene-manager.js +120 -0
- package/lib/dist/tests/extrude.test.d.ts +1 -0
- package/lib/dist/tests/extrude.test.js +48 -0
- package/lib/dist/tests/features/2d/arc.test.d.ts +1 -0
- package/lib/dist/tests/features/2d/arc.test.js +40 -0
- package/lib/dist/tests/features/2d/circle.test.d.ts +1 -0
- package/lib/dist/tests/features/2d/circle.test.js +64 -0
- package/lib/dist/tests/features/2d/constrained.test.d.ts +1 -0
- package/lib/dist/tests/features/2d/constrained.test.js +202 -0
- package/lib/dist/tests/features/2d/line.test.d.ts +1 -0
- package/lib/dist/tests/features/2d/line.test.js +86 -0
- package/lib/dist/tests/features/2d/move.test.d.ts +1 -0
- package/lib/dist/tests/features/2d/move.test.js +74 -0
- package/lib/dist/tests/features/2d/offset.test.d.ts +1 -0
- package/lib/dist/tests/features/2d/offset.test.js +111 -0
- package/lib/dist/tests/features/2d/pmove.test.d.ts +1 -0
- package/lib/dist/tests/features/2d/pmove.test.js +43 -0
- package/lib/dist/tests/features/2d/polygon.test.d.ts +1 -0
- package/lib/dist/tests/features/2d/polygon.test.js +150 -0
- package/lib/dist/tests/features/2d/project.test.d.ts +1 -0
- package/lib/dist/tests/features/2d/project.test.js +22 -0
- package/lib/dist/tests/features/2d/rect.test.d.ts +1 -0
- package/lib/dist/tests/features/2d/rect.test.js +66 -0
- package/lib/dist/tests/features/2d/rmove.test.d.ts +1 -0
- package/lib/dist/tests/features/2d/rmove.test.js +29 -0
- package/lib/dist/tests/features/2d/slot-from-edge.test.d.ts +1 -0
- package/lib/dist/tests/features/2d/slot-from-edge.test.js +35 -0
- package/lib/dist/tests/features/2d/slot.test.d.ts +1 -0
- package/lib/dist/tests/features/2d/slot.test.js +44 -0
- package/lib/dist/tests/features/2d/tarc.test.d.ts +1 -0
- package/lib/dist/tests/features/2d/tarc.test.js +237 -0
- package/lib/dist/tests/features/2d/tcircle.test.d.ts +1 -0
- package/lib/dist/tests/features/2d/tcircle.test.js +28 -0
- package/lib/dist/tests/features/2d/tline.test.d.ts +1 -0
- package/lib/dist/tests/features/2d/tline.test.js +34 -0
- package/lib/dist/tests/features/axis.test.d.ts +1 -0
- package/lib/dist/tests/features/axis.test.js +143 -0
- package/lib/dist/tests/features/chamfer.test.d.ts +1 -0
- package/lib/dist/tests/features/chamfer.test.js +159 -0
- package/lib/dist/tests/features/color.test.d.ts +1 -0
- package/lib/dist/tests/features/color.test.js +96 -0
- package/lib/dist/tests/features/common2d.test.d.ts +1 -0
- package/lib/dist/tests/features/common2d.test.js +113 -0
- package/lib/dist/tests/features/copy-circular-2d.test.d.ts +1 -0
- package/lib/dist/tests/features/copy-circular-2d.test.js +40 -0
- package/lib/dist/tests/features/copy-circular.test.d.ts +1 -0
- package/lib/dist/tests/features/copy-circular.test.js +44 -0
- package/lib/dist/tests/features/copy-linear-2d.test.d.ts +1 -0
- package/lib/dist/tests/features/copy-linear-2d.test.js +35 -0
- package/lib/dist/tests/features/copy-linear.test.d.ts +1 -0
- package/lib/dist/tests/features/copy-linear.test.js +95 -0
- package/lib/dist/tests/features/copy.test.d.ts +1 -0
- package/lib/dist/tests/features/copy.test.js +158 -0
- package/lib/dist/tests/features/cut-symmetric.test.d.ts +1 -0
- package/lib/dist/tests/features/cut-symmetric.test.js +120 -0
- package/lib/dist/tests/features/cut-two-distances.test.d.ts +1 -0
- package/lib/dist/tests/features/cut-two-distances.test.js +125 -0
- package/lib/dist/tests/features/cut.test.d.ts +1 -0
- package/lib/dist/tests/features/cut.test.js +311 -0
- package/lib/dist/tests/features/dispose.test.d.ts +1 -0
- package/lib/dist/tests/features/dispose.test.js +189 -0
- package/lib/dist/tests/features/extrude-symmetric.test.d.ts +1 -0
- package/lib/dist/tests/features/extrude-symmetric.test.js +240 -0
- package/lib/dist/tests/features/extrude-to-face.test.d.ts +1 -0
- package/lib/dist/tests/features/extrude-to-face.test.js +256 -0
- package/lib/dist/tests/features/extrude-two-distances.test.d.ts +1 -0
- package/lib/dist/tests/features/extrude-two-distances.test.js +264 -0
- package/lib/dist/tests/features/extrude.test.d.ts +1 -0
- package/lib/dist/tests/features/extrude.test.js +640 -0
- package/lib/dist/tests/features/fillet.test.d.ts +1 -0
- package/lib/dist/tests/features/fillet.test.js +163 -0
- package/lib/dist/tests/features/fillet2d.test.d.ts +1 -0
- package/lib/dist/tests/features/fillet2d.test.js +69 -0
- package/lib/dist/tests/features/fuse.test.d.ts +1 -0
- package/lib/dist/tests/features/fuse.test.js +122 -0
- package/lib/dist/tests/features/fuse2d.test.d.ts +1 -0
- package/lib/dist/tests/features/fuse2d.test.js +80 -0
- package/lib/dist/tests/features/loft.test.d.ts +1 -0
- package/lib/dist/tests/features/loft.test.js +283 -0
- package/lib/dist/tests/features/mirror.test.d.ts +1 -0
- package/lib/dist/tests/features/mirror.test.js +112 -0
- package/lib/dist/tests/features/mirror2d.test.d.ts +1 -0
- package/lib/dist/tests/features/mirror2d.test.js +75 -0
- package/lib/dist/tests/features/part-pick.test.d.ts +1 -0
- package/lib/dist/tests/features/part-pick.test.js +73 -0
- package/lib/dist/tests/features/part-repeat.test.d.ts +1 -0
- package/lib/dist/tests/features/part-repeat.test.js +109 -0
- package/lib/dist/tests/features/part.test.d.ts +1 -0
- package/lib/dist/tests/features/part.test.js +356 -0
- package/lib/dist/tests/features/plane.test.d.ts +1 -0
- package/lib/dist/tests/features/plane.test.js +154 -0
- package/lib/dist/tests/features/repeat-circular.test.d.ts +1 -0
- package/lib/dist/tests/features/repeat-circular.test.js +114 -0
- package/lib/dist/tests/features/repeat-linear.test.d.ts +1 -0
- package/lib/dist/tests/features/repeat-linear.test.js +138 -0
- package/lib/dist/tests/features/revolve.test.d.ts +1 -0
- package/lib/dist/tests/features/revolve.test.js +205 -0
- package/lib/dist/tests/features/rotate.test.d.ts +1 -0
- package/lib/dist/tests/features/rotate.test.js +133 -0
- package/lib/dist/tests/features/rotate2d.test.d.ts +1 -0
- package/lib/dist/tests/features/rotate2d.test.js +74 -0
- package/lib/dist/tests/features/select.test.d.ts +1 -0
- package/lib/dist/tests/features/select.test.js +337 -0
- package/lib/dist/tests/features/shell.test.d.ts +1 -0
- package/lib/dist/tests/features/shell.test.js +230 -0
- package/lib/dist/tests/features/subtract.test.d.ts +1 -0
- package/lib/dist/tests/features/subtract.test.js +103 -0
- package/lib/dist/tests/features/sweep.test.d.ts +1 -0
- package/lib/dist/tests/features/sweep.test.js +312 -0
- package/lib/dist/tests/features/translate.test.d.ts +1 -0
- package/lib/dist/tests/features/translate.test.js +117 -0
- package/lib/dist/tests/global-setup.d.ts +1 -0
- package/lib/dist/tests/global-setup.js +5 -0
- package/lib/dist/tests/math/axis.test.d.ts +1 -0
- package/lib/dist/tests/math/axis.test.js +287 -0
- package/lib/dist/tests/math/coordinate-system.test.d.ts +1 -0
- package/lib/dist/tests/math/coordinate-system.test.js +308 -0
- package/lib/dist/tests/math/matrix4.test.d.ts +1 -0
- package/lib/dist/tests/math/matrix4.test.js +357 -0
- package/lib/dist/tests/math/plane.test.d.ts +1 -0
- package/lib/dist/tests/math/plane.test.js +398 -0
- package/lib/dist/tests/math/point.test.d.ts +1 -0
- package/lib/dist/tests/math/point.test.js +385 -0
- package/lib/dist/tests/math/quaternion.test.d.ts +1 -0
- package/lib/dist/tests/math/quaternion.test.js +278 -0
- package/lib/dist/tests/math/vector3d.test.d.ts +1 -0
- package/lib/dist/tests/math/vector3d.test.js +276 -0
- package/lib/dist/tests/setup.d.ts +5 -0
- package/lib/dist/tests/setup.js +14 -0
- package/lib/dist/tests/utils.d.ts +12 -0
- package/lib/dist/tests/utils.js +36 -0
- package/lib/dist/tsconfig.tsbuildinfo +1 -0
- package/package.json +83 -0
- package/server/dist/fluidcad-server.d.ts +32 -0
- package/server/dist/fluidcad-server.js +150 -0
- package/server/dist/index.d.ts +1 -0
- package/server/dist/index.js +290 -0
- package/server/dist/routes/actions.d.ts +3 -0
- package/server/dist/routes/actions.js +100 -0
- package/server/dist/routes/export.d.ts +3 -0
- package/server/dist/routes/export.js +55 -0
- package/server/dist/routes/properties.d.ts +3 -0
- package/server/dist/routes/properties.js +46 -0
- package/server/dist/routes/screenshot.d.ts +2 -0
- package/server/dist/routes/screenshot.js +76 -0
- package/server/dist/vite-manager.d.ts +10 -0
- package/server/dist/vite-manager.js +64 -0
- package/server/dist/ws-protocol.d.ts +138 -0
- package/server/dist/ws-protocol.js +4 -0
- package/ui/dist/assets/index-DXW2yo2v.css +2 -0
- package/ui/dist/assets/index-qqJ_mWi7.js +4732 -0
- package/ui/dist/icons/aline.png +0 -0
- package/ui/dist/icons/arc.png +0 -0
- package/ui/dist/icons/aslot.png +0 -0
- package/ui/dist/icons/axis.png +0 -0
- package/ui/dist/icons/box.png +0 -0
- package/ui/dist/icons/chamfer.png +0 -0
- package/ui/dist/icons/circle.png +0 -0
- package/ui/dist/icons/color.png +0 -0
- package/ui/dist/icons/common.png +0 -0
- package/ui/dist/icons/cone.png +0 -0
- package/ui/dist/icons/connect.png +0 -0
- package/ui/dist/icons/copy-circular.png +0 -0
- package/ui/dist/icons/copy-circular2d.png +0 -0
- package/ui/dist/icons/copy-linear.png +0 -0
- package/ui/dist/icons/copy-linear2d.png +0 -0
- package/ui/dist/icons/cut.png +0 -0
- package/ui/dist/icons/cylinder.png +0 -0
- package/ui/dist/icons/edge.png +0 -0
- package/ui/dist/icons/extrude.png +0 -0
- package/ui/dist/icons/fillet.png +0 -0
- package/ui/dist/icons/fillet2d.png +0 -0
- package/ui/dist/icons/fuse.png +0 -0
- package/ui/dist/icons/hline.png +0 -0
- package/ui/dist/icons/hole.png +0 -0
- package/ui/dist/icons/line.png +0 -0
- package/ui/dist/icons/load.png +0 -0
- package/ui/dist/icons/mirror.png +0 -0
- package/ui/dist/icons/mirror2d.png +0 -0
- package/ui/dist/icons/move.png +0 -0
- package/ui/dist/icons/plane.png +0 -0
- package/ui/dist/icons/polygon.png +0 -0
- package/ui/dist/icons/rect.png +0 -0
- package/ui/dist/icons/revolve.png +0 -0
- package/ui/dist/icons/rotate.png +0 -0
- package/ui/dist/icons/rotate2d.png +0 -0
- package/ui/dist/icons/select.png +0 -0
- package/ui/dist/icons/shell.png +0 -0
- package/ui/dist/icons/sketch.png +0 -0
- package/ui/dist/icons/slot.png +0 -0
- package/ui/dist/icons/solid.png +0 -0
- package/ui/dist/icons/sphere.png +0 -0
- package/ui/dist/icons/subtract.png +0 -0
- package/ui/dist/icons/tarc.png +0 -0
- package/ui/dist/icons/tline.png +0 -0
- package/ui/dist/icons/translate.png +0 -0
- package/ui/dist/icons/vline.png +0 -0
- package/ui/dist/icons/wire.png +0 -0
- package/ui/dist/index.html +13 -0
- package/ui/dist/logo.png +0 -0
|
@@ -0,0 +1,337 @@
|
|
|
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 select from "../../core/select.js";
|
|
6
|
+
import cylinder from "../../core/cylinder.js";
|
|
7
|
+
import { circle, rect } from "../../core/2d/index.js";
|
|
8
|
+
import { face, edge } from "../../filters/index.js";
|
|
9
|
+
describe("select", () => {
|
|
10
|
+
setupOC();
|
|
11
|
+
describe("face filters", () => {
|
|
12
|
+
describe("onPlane / notOnPlane", () => {
|
|
13
|
+
it("should select faces on a specific plane", () => {
|
|
14
|
+
sketch("xy", () => {
|
|
15
|
+
rect(100, 50);
|
|
16
|
+
});
|
|
17
|
+
extrude(30);
|
|
18
|
+
const sel = select(face().onPlane("xy"));
|
|
19
|
+
render();
|
|
20
|
+
const shapes = sel.getShapes();
|
|
21
|
+
// Box has 1 face on XY (bottom)
|
|
22
|
+
expect(shapes).toHaveLength(1);
|
|
23
|
+
expect(shapes[0].getType()).toBe("face");
|
|
24
|
+
});
|
|
25
|
+
it("should select faces on an offset plane", () => {
|
|
26
|
+
sketch("xy", () => {
|
|
27
|
+
rect(100, 50);
|
|
28
|
+
});
|
|
29
|
+
extrude(30);
|
|
30
|
+
const sel = select(face().onPlane("xy", 30));
|
|
31
|
+
render();
|
|
32
|
+
const shapes = sel.getShapes();
|
|
33
|
+
expect(shapes).toHaveLength(1);
|
|
34
|
+
});
|
|
35
|
+
it("should select faces NOT on a plane", () => {
|
|
36
|
+
sketch("xy", () => {
|
|
37
|
+
rect(100, 50);
|
|
38
|
+
});
|
|
39
|
+
extrude(30);
|
|
40
|
+
const onXY = select(face().onPlane("xy"));
|
|
41
|
+
const notOnXY = select(face().notOnPlane("xy"));
|
|
42
|
+
render();
|
|
43
|
+
const onShapes = onXY.getShapes();
|
|
44
|
+
const notOnShapes = notOnXY.getShapes();
|
|
45
|
+
// Box has 1 face on XY (bottom), 5 not on XY (top + 4 sides)
|
|
46
|
+
expect(onShapes).toHaveLength(1);
|
|
47
|
+
expect(notOnShapes).toHaveLength(5);
|
|
48
|
+
// No overlap
|
|
49
|
+
for (const s of onShapes) {
|
|
50
|
+
expect(notOnShapes.some(ns => ns.isSame(s))).toBe(false);
|
|
51
|
+
}
|
|
52
|
+
});
|
|
53
|
+
});
|
|
54
|
+
describe("parallelTo / notParallelTo", () => {
|
|
55
|
+
it("should select faces parallel to a plane", () => {
|
|
56
|
+
sketch("xy", () => {
|
|
57
|
+
rect(100, 50);
|
|
58
|
+
});
|
|
59
|
+
extrude(30);
|
|
60
|
+
// Top and bottom faces are parallel to XY
|
|
61
|
+
const sel = select(face().parallelTo("xy"));
|
|
62
|
+
render();
|
|
63
|
+
const shapes = sel.getShapes();
|
|
64
|
+
expect(shapes).toHaveLength(2);
|
|
65
|
+
});
|
|
66
|
+
it("should select faces not parallel to a plane", () => {
|
|
67
|
+
sketch("xy", () => {
|
|
68
|
+
rect(100, 50);
|
|
69
|
+
});
|
|
70
|
+
extrude(30);
|
|
71
|
+
// 4 side faces are not parallel to XY
|
|
72
|
+
const sel = select(face().notParallelTo("xy"));
|
|
73
|
+
render();
|
|
74
|
+
const shapes = sel.getShapes();
|
|
75
|
+
expect(shapes).toHaveLength(4);
|
|
76
|
+
});
|
|
77
|
+
});
|
|
78
|
+
describe("circle / notCircle", () => {
|
|
79
|
+
it("should select circular faces", () => {
|
|
80
|
+
cylinder(30, 50);
|
|
81
|
+
const sel = select(face().circle());
|
|
82
|
+
render();
|
|
83
|
+
// Cylinder has 2 circular faces (top and bottom)
|
|
84
|
+
const shapes = sel.getShapes();
|
|
85
|
+
expect(shapes).toHaveLength(2);
|
|
86
|
+
});
|
|
87
|
+
it("should select circular faces with specific diameter", () => {
|
|
88
|
+
cylinder(30, 50);
|
|
89
|
+
const sel = select(face().circle(60));
|
|
90
|
+
render();
|
|
91
|
+
const shapes = sel.getShapes();
|
|
92
|
+
expect(shapes).toHaveLength(2);
|
|
93
|
+
});
|
|
94
|
+
it("should not match circles with wrong diameter", () => {
|
|
95
|
+
cylinder(30, 50);
|
|
96
|
+
const sel = select(face().circle(1998));
|
|
97
|
+
render();
|
|
98
|
+
expect(sel.getShapes()).toHaveLength(0);
|
|
99
|
+
});
|
|
100
|
+
it("should select non-circular faces", () => {
|
|
101
|
+
cylinder(30, 50);
|
|
102
|
+
const sel = select(face().notCircle());
|
|
103
|
+
render();
|
|
104
|
+
// The cylindrical side face is not circular
|
|
105
|
+
const shapes = sel.getShapes();
|
|
106
|
+
expect(shapes).toHaveLength(1);
|
|
107
|
+
});
|
|
108
|
+
});
|
|
109
|
+
describe("cylinder / notCylinder", () => {
|
|
110
|
+
it("should select cylindrical faces", () => {
|
|
111
|
+
cylinder(30, 50);
|
|
112
|
+
const sel = select(face().cylinder());
|
|
113
|
+
render();
|
|
114
|
+
const shapes = sel.getShapes();
|
|
115
|
+
expect(shapes).toHaveLength(1);
|
|
116
|
+
});
|
|
117
|
+
it("should select cylindrical faces with specific diameter", () => {
|
|
118
|
+
cylinder(30, 50);
|
|
119
|
+
const sel = select(face().cylinder(60));
|
|
120
|
+
render();
|
|
121
|
+
expect(sel.getShapes()).toHaveLength(1);
|
|
122
|
+
});
|
|
123
|
+
it("should select non-cylindrical faces", () => {
|
|
124
|
+
cylinder(30, 50);
|
|
125
|
+
const sel = select(face().notCylinder());
|
|
126
|
+
render();
|
|
127
|
+
// Top and bottom circular faces are not cylindrical surfaces
|
|
128
|
+
const shapes = sel.getShapes();
|
|
129
|
+
expect(shapes).toHaveLength(2);
|
|
130
|
+
});
|
|
131
|
+
});
|
|
132
|
+
describe("cone / notCone", () => {
|
|
133
|
+
it("should select conical faces from a drafted extrusion", () => {
|
|
134
|
+
sketch("xy", () => {
|
|
135
|
+
circle(60);
|
|
136
|
+
});
|
|
137
|
+
extrude(50).draft(10);
|
|
138
|
+
const sel = select(face().cone());
|
|
139
|
+
render();
|
|
140
|
+
// Drafted cylinder has 1 conical side face
|
|
141
|
+
const shapes = sel.getShapes();
|
|
142
|
+
expect(shapes).toHaveLength(1);
|
|
143
|
+
});
|
|
144
|
+
it("should select non-conical faces", () => {
|
|
145
|
+
sketch("xy", () => {
|
|
146
|
+
circle(60);
|
|
147
|
+
});
|
|
148
|
+
extrude(50).draft(10);
|
|
149
|
+
const sel = select(face().notCone());
|
|
150
|
+
render();
|
|
151
|
+
// 2 non-conical faces (top and bottom circles)
|
|
152
|
+
const shapes = sel.getShapes();
|
|
153
|
+
expect(shapes).toHaveLength(2);
|
|
154
|
+
});
|
|
155
|
+
});
|
|
156
|
+
});
|
|
157
|
+
describe("edge filters", () => {
|
|
158
|
+
describe("onPlane / notOnPlane", () => {
|
|
159
|
+
it("should select edges on a specific plane", () => {
|
|
160
|
+
sketch("xy", () => {
|
|
161
|
+
rect(100, 50);
|
|
162
|
+
});
|
|
163
|
+
extrude(30);
|
|
164
|
+
const sel = select(edge().onPlane("xy"));
|
|
165
|
+
render();
|
|
166
|
+
const shapes = sel.getShapes();
|
|
167
|
+
expect(shapes).toHaveLength(4);
|
|
168
|
+
for (const s of shapes) {
|
|
169
|
+
expect(s.getType()).toBe("edge");
|
|
170
|
+
}
|
|
171
|
+
});
|
|
172
|
+
it("should select edges on an offset plane", () => {
|
|
173
|
+
sketch("xy", () => {
|
|
174
|
+
rect(100, 50);
|
|
175
|
+
});
|
|
176
|
+
extrude(30);
|
|
177
|
+
const sel = select(edge().onPlane("xy", 30));
|
|
178
|
+
render();
|
|
179
|
+
expect(sel.getShapes()).toHaveLength(4);
|
|
180
|
+
});
|
|
181
|
+
it("should select edges NOT on a plane", () => {
|
|
182
|
+
sketch("xy", () => {
|
|
183
|
+
rect(100, 50);
|
|
184
|
+
});
|
|
185
|
+
extrude(30);
|
|
186
|
+
// Box has 12 edges total, 4 on xy, 4 on xy+30, 4 vertical
|
|
187
|
+
const sel = select(edge().notOnPlane("xy"));
|
|
188
|
+
render();
|
|
189
|
+
expect(sel.getShapes()).toHaveLength(8);
|
|
190
|
+
});
|
|
191
|
+
});
|
|
192
|
+
describe("parallelTo / notParallelTo", () => {
|
|
193
|
+
it("should select edges parallel to a plane", () => {
|
|
194
|
+
sketch("xy", () => {
|
|
195
|
+
rect(100, 50);
|
|
196
|
+
});
|
|
197
|
+
extrude(30);
|
|
198
|
+
// Edges parallel to XY = all horizontal edges (top + bottom = 8)
|
|
199
|
+
const sel = select(edge().parallelTo("xy"));
|
|
200
|
+
render();
|
|
201
|
+
expect(sel.getShapes()).toHaveLength(8);
|
|
202
|
+
});
|
|
203
|
+
it("should select edges not parallel to a plane", () => {
|
|
204
|
+
sketch("xy", () => {
|
|
205
|
+
rect(100, 50);
|
|
206
|
+
});
|
|
207
|
+
extrude(30);
|
|
208
|
+
// 4 vertical edges are not parallel to XY
|
|
209
|
+
const sel = select(edge().notParallelTo("xy"));
|
|
210
|
+
render();
|
|
211
|
+
expect(sel.getShapes()).toHaveLength(4);
|
|
212
|
+
});
|
|
213
|
+
});
|
|
214
|
+
describe("verticalTo / notVerticalTo", () => {
|
|
215
|
+
it("should select edges vertical to a plane", () => {
|
|
216
|
+
sketch("xy", () => {
|
|
217
|
+
rect(100, 50);
|
|
218
|
+
});
|
|
219
|
+
extrude(30);
|
|
220
|
+
// Vertical edges aligned with XY normal (Z direction) = 4
|
|
221
|
+
const sel = select(edge().verticalTo("xy"));
|
|
222
|
+
render();
|
|
223
|
+
expect(sel.getShapes()).toHaveLength(4);
|
|
224
|
+
});
|
|
225
|
+
it("should select edges not vertical to a plane", () => {
|
|
226
|
+
sketch("xy", () => {
|
|
227
|
+
rect(100, 50);
|
|
228
|
+
});
|
|
229
|
+
extrude(30);
|
|
230
|
+
// 8 horizontal edges
|
|
231
|
+
const sel = select(edge().notVerticalTo("xy"));
|
|
232
|
+
render();
|
|
233
|
+
expect(sel.getShapes()).toHaveLength(8);
|
|
234
|
+
});
|
|
235
|
+
});
|
|
236
|
+
describe("line / notLine", () => {
|
|
237
|
+
it("should select straight edges", () => {
|
|
238
|
+
sketch("xy", () => {
|
|
239
|
+
rect(100, 50);
|
|
240
|
+
});
|
|
241
|
+
extrude(30);
|
|
242
|
+
const sel = select(edge().line());
|
|
243
|
+
render();
|
|
244
|
+
// All 12 edges of a box are lines
|
|
245
|
+
expect(sel.getShapes()).toHaveLength(12);
|
|
246
|
+
});
|
|
247
|
+
it("should select non-line edges from a cylinder", () => {
|
|
248
|
+
cylinder(30, 50);
|
|
249
|
+
const sel = select(edge().notLine());
|
|
250
|
+
render();
|
|
251
|
+
// Cylinder has 2 circular edges (top and bottom)
|
|
252
|
+
expect(sel.getShapes()).toHaveLength(2);
|
|
253
|
+
});
|
|
254
|
+
});
|
|
255
|
+
describe("circle / notCircle", () => {
|
|
256
|
+
it("should select circular edges", () => {
|
|
257
|
+
cylinder(30, 50);
|
|
258
|
+
const sel = select(edge().circle());
|
|
259
|
+
render();
|
|
260
|
+
expect(sel.getShapes()).toHaveLength(2);
|
|
261
|
+
});
|
|
262
|
+
it("should select circular edges with specific diameter", () => {
|
|
263
|
+
cylinder(30, 50);
|
|
264
|
+
const sel = select(edge().circle(60));
|
|
265
|
+
render();
|
|
266
|
+
expect(sel.getShapes()).toHaveLength(2);
|
|
267
|
+
});
|
|
268
|
+
});
|
|
269
|
+
});
|
|
270
|
+
describe("AND logic (chained filters)", () => {
|
|
271
|
+
it("should match faces satisfying all chained filters", () => {
|
|
272
|
+
sketch("xy", () => {
|
|
273
|
+
rect(100, 50);
|
|
274
|
+
});
|
|
275
|
+
extrude(30);
|
|
276
|
+
// Parallel to XY AND on plane at z=30 → just the top face
|
|
277
|
+
const sel = select(face().parallelTo("xy").onPlane("xy", 30));
|
|
278
|
+
render();
|
|
279
|
+
expect(sel.getShapes()).toHaveLength(1);
|
|
280
|
+
});
|
|
281
|
+
it("should return empty when AND conditions are contradictory", () => {
|
|
282
|
+
cylinder(30, 50);
|
|
283
|
+
// circle AND cylinder is impossible (different surface types)
|
|
284
|
+
const sel = select(face().circle().cylinder());
|
|
285
|
+
render();
|
|
286
|
+
expect(sel.getShapes()).toHaveLength(0);
|
|
287
|
+
});
|
|
288
|
+
it("should chain edge filters with AND logic", () => {
|
|
289
|
+
sketch("xy", () => {
|
|
290
|
+
rect(100, 50);
|
|
291
|
+
});
|
|
292
|
+
extrude(30);
|
|
293
|
+
// Lines on the bottom face (z=0)
|
|
294
|
+
const sel = select(edge().line().onPlane("xy"));
|
|
295
|
+
render();
|
|
296
|
+
expect(sel.getShapes()).toHaveLength(4);
|
|
297
|
+
});
|
|
298
|
+
});
|
|
299
|
+
describe("OR logic (multiple builders)", () => {
|
|
300
|
+
it("should match faces satisfying any builder", () => {
|
|
301
|
+
cylinder(30, 50);
|
|
302
|
+
// Circle faces OR cylindrical faces → all 3 faces
|
|
303
|
+
const sel = select(face().circle(), face().cylinder());
|
|
304
|
+
render();
|
|
305
|
+
expect(sel.getShapes()).toHaveLength(3);
|
|
306
|
+
});
|
|
307
|
+
it("should deduplicate results across builders", () => {
|
|
308
|
+
cylinder(30, 50);
|
|
309
|
+
// Both builders match the same circular faces
|
|
310
|
+
const sel = select(face().circle(), face().circle());
|
|
311
|
+
render();
|
|
312
|
+
// Should still return 2, not 4
|
|
313
|
+
expect(sel.getShapes()).toHaveLength(2);
|
|
314
|
+
});
|
|
315
|
+
it("should combine edge filters with OR logic", () => {
|
|
316
|
+
sketch("xy", () => {
|
|
317
|
+
rect(100, 50);
|
|
318
|
+
});
|
|
319
|
+
extrude(30);
|
|
320
|
+
// Edges on bottom OR edges on top
|
|
321
|
+
const sel = select(edge().onPlane("xy"), edge().onPlane("xy", 30));
|
|
322
|
+
render();
|
|
323
|
+
expect(sel.getShapes()).toHaveLength(8);
|
|
324
|
+
});
|
|
325
|
+
it("should combine AND within OR", () => {
|
|
326
|
+
sketch("xy", () => {
|
|
327
|
+
rect(100, 50);
|
|
328
|
+
});
|
|
329
|
+
extrude(30);
|
|
330
|
+
// (parallel to XY AND on z=0) OR (vertical edges)
|
|
331
|
+
const sel = select(face().parallelTo("xy").onPlane("xy"), face().notParallelTo("xy"));
|
|
332
|
+
render();
|
|
333
|
+
// 1 bottom face + 4 side faces = 5
|
|
334
|
+
expect(sel.getShapes()).toHaveLength(5);
|
|
335
|
+
});
|
|
336
|
+
});
|
|
337
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,230 @@
|
|
|
1
|
+
import { describe, it, expect } from "vitest";
|
|
2
|
+
import { setupOC, render, addToScene } from "../setup.js";
|
|
3
|
+
import sketch from "../../core/sketch.js";
|
|
4
|
+
import extrude from "../../core/extrude.js";
|
|
5
|
+
import shell from "../../core/shell.js";
|
|
6
|
+
import select from "../../core/select.js";
|
|
7
|
+
import cylinder from "../../core/cylinder.js";
|
|
8
|
+
import { rect } from "../../core/2d/index.js";
|
|
9
|
+
import { countShapes } from "../utils.js";
|
|
10
|
+
import { ShapeProps } from "../../oc/props.js";
|
|
11
|
+
import { face } from "../../filters/index.js";
|
|
12
|
+
describe("shell", () => {
|
|
13
|
+
setupOC();
|
|
14
|
+
describe("basic shell", () => {
|
|
15
|
+
it("should hollow out a box by removing the top face", () => {
|
|
16
|
+
sketch("xy", () => {
|
|
17
|
+
rect(100, 100);
|
|
18
|
+
});
|
|
19
|
+
const e = extrude(50);
|
|
20
|
+
select(face().onPlane("xy", 50));
|
|
21
|
+
shell(5);
|
|
22
|
+
const scene = render();
|
|
23
|
+
expect(countShapes(scene)).toBe(1);
|
|
24
|
+
const solid = scene.getAllSceneObjects()
|
|
25
|
+
.flatMap(o => o.getShapes())
|
|
26
|
+
.find(s => s.getType() === "solid");
|
|
27
|
+
// Shelled box has more faces than a solid box (inner walls)
|
|
28
|
+
expect(solid.getFaces().length).toBeGreaterThan(6);
|
|
29
|
+
});
|
|
30
|
+
it("should reduce volume compared to the original solid", () => {
|
|
31
|
+
sketch("xy", () => {
|
|
32
|
+
rect(100, 100);
|
|
33
|
+
});
|
|
34
|
+
extrude(50);
|
|
35
|
+
select(face().onPlane("xy", 50));
|
|
36
|
+
shell(5);
|
|
37
|
+
const scene = render();
|
|
38
|
+
const solid = scene.getAllSceneObjects()
|
|
39
|
+
.flatMap(o => o.getShapes())
|
|
40
|
+
.find(s => s.getType() === "solid");
|
|
41
|
+
const props = ShapeProps.getProperties(solid.getShape());
|
|
42
|
+
// Hollow box volume should be less than solid box (100*100*50 = 500000)
|
|
43
|
+
expect(props.volumeMm3).toBeLessThan(500000);
|
|
44
|
+
expect(props.volumeMm3).toBeGreaterThan(0);
|
|
45
|
+
});
|
|
46
|
+
});
|
|
47
|
+
describe("shell with explicit selection", () => {
|
|
48
|
+
it("should shell using an explicit face selection", () => {
|
|
49
|
+
sketch("xy", () => {
|
|
50
|
+
rect(100, 100);
|
|
51
|
+
});
|
|
52
|
+
extrude(50);
|
|
53
|
+
const sel = select(face().onPlane("xy", 50));
|
|
54
|
+
shell(3, sel);
|
|
55
|
+
const scene = render();
|
|
56
|
+
expect(countShapes(scene)).toBe(1);
|
|
57
|
+
const solid = scene.getAllSceneObjects()
|
|
58
|
+
.flatMap(o => o.getShapes())
|
|
59
|
+
.find(s => s.getType() === "solid");
|
|
60
|
+
expect(solid.getFaces().length).toBeGreaterThan(6);
|
|
61
|
+
});
|
|
62
|
+
});
|
|
63
|
+
describe("shell thickness", () => {
|
|
64
|
+
it("should use default thickness of 2.5", () => {
|
|
65
|
+
sketch("xy", () => {
|
|
66
|
+
rect(100, 100);
|
|
67
|
+
});
|
|
68
|
+
extrude(50);
|
|
69
|
+
select(face().onPlane("xy", 50));
|
|
70
|
+
shell();
|
|
71
|
+
const scene = render();
|
|
72
|
+
expect(countShapes(scene)).toBe(1);
|
|
73
|
+
const solid = scene.getAllSceneObjects()
|
|
74
|
+
.flatMap(o => o.getShapes())
|
|
75
|
+
.find(s => s.getType() === "solid");
|
|
76
|
+
expect(solid.getFaces().length).toBeGreaterThan(6);
|
|
77
|
+
});
|
|
78
|
+
it("should produce thinner walls with smaller thickness", () => {
|
|
79
|
+
sketch("xy", () => {
|
|
80
|
+
rect(100, 100);
|
|
81
|
+
});
|
|
82
|
+
extrude(50);
|
|
83
|
+
select(face().onPlane("xy", 50));
|
|
84
|
+
shell(2);
|
|
85
|
+
render();
|
|
86
|
+
const solid2 = [...render().getAllSceneObjects()]
|
|
87
|
+
.flatMap(o => o.getShapes())
|
|
88
|
+
.find(s => s.getType() === "solid");
|
|
89
|
+
// Re-run with a thicker shell to compare
|
|
90
|
+
// (we can't easily compare two shells in one test due to scene reset,
|
|
91
|
+
// so just verify it produces a valid shelled solid)
|
|
92
|
+
expect(solid2).toBeDefined();
|
|
93
|
+
});
|
|
94
|
+
});
|
|
95
|
+
describe("shell on cylinder", () => {
|
|
96
|
+
it("should hollow out a cylinder", () => {
|
|
97
|
+
cylinder(50, 80);
|
|
98
|
+
select(face().onPlane("xy", 80));
|
|
99
|
+
shell(5);
|
|
100
|
+
const scene = render();
|
|
101
|
+
expect(countShapes(scene)).toBe(1);
|
|
102
|
+
const solid = scene.getAllSceneObjects()
|
|
103
|
+
.flatMap(o => o.getShapes())
|
|
104
|
+
.find(s => s.getType() === "solid");
|
|
105
|
+
// Hollow cylinder has more faces than a solid cylinder (3)
|
|
106
|
+
expect(solid.getFaces().length).toBeGreaterThan(3);
|
|
107
|
+
});
|
|
108
|
+
});
|
|
109
|
+
describe("shell removes selection shapes", () => {
|
|
110
|
+
it("should remove the face selection after shelling", () => {
|
|
111
|
+
sketch("xy", () => {
|
|
112
|
+
rect(100, 100);
|
|
113
|
+
});
|
|
114
|
+
extrude(50);
|
|
115
|
+
const sel = select(face().onPlane("xy", 50));
|
|
116
|
+
shell(5, sel);
|
|
117
|
+
render();
|
|
118
|
+
expect(sel.getShapes()).toHaveLength(0);
|
|
119
|
+
});
|
|
120
|
+
});
|
|
121
|
+
describe("internalFaces", () => {
|
|
122
|
+
it("should expose internal faces of a shelled box", () => {
|
|
123
|
+
sketch("xy", () => {
|
|
124
|
+
rect(100, 100);
|
|
125
|
+
});
|
|
126
|
+
extrude(50);
|
|
127
|
+
select(face().onPlane("xy", 50));
|
|
128
|
+
const s = shell(5);
|
|
129
|
+
const inf = s.internalFaces();
|
|
130
|
+
addToScene(inf);
|
|
131
|
+
render();
|
|
132
|
+
const faces = inf.getShapes();
|
|
133
|
+
expect(faces.length).toBeGreaterThan(0);
|
|
134
|
+
for (const f of faces) {
|
|
135
|
+
expect(f.getType()).toBe("face");
|
|
136
|
+
}
|
|
137
|
+
});
|
|
138
|
+
it("should expose internal faces of a shelled cylinder", () => {
|
|
139
|
+
cylinder(50, 80);
|
|
140
|
+
select(face().onPlane("xy", 80));
|
|
141
|
+
const s = shell(5);
|
|
142
|
+
const inf = s.internalFaces();
|
|
143
|
+
addToScene(inf);
|
|
144
|
+
render();
|
|
145
|
+
const faces = inf.getShapes();
|
|
146
|
+
expect(faces.length).toBeGreaterThan(0);
|
|
147
|
+
});
|
|
148
|
+
it("should filter internal faces by index", () => {
|
|
149
|
+
sketch("xy", () => {
|
|
150
|
+
rect(100, 100);
|
|
151
|
+
});
|
|
152
|
+
extrude(50);
|
|
153
|
+
select(face().onPlane("xy", 50));
|
|
154
|
+
const s = shell(5);
|
|
155
|
+
const allFaces = s.internalFaces();
|
|
156
|
+
const first = s.internalFaces(0);
|
|
157
|
+
addToScene(allFaces);
|
|
158
|
+
addToScene(first);
|
|
159
|
+
render();
|
|
160
|
+
const allShapes = allFaces.getShapes();
|
|
161
|
+
expect(allShapes.length).toBeGreaterThan(0);
|
|
162
|
+
expect(first.getShapes()).toHaveLength(1);
|
|
163
|
+
expect(first.getShapes()[0].isSame(allShapes[0])).toBe(true);
|
|
164
|
+
});
|
|
165
|
+
});
|
|
166
|
+
describe("internalEdges", () => {
|
|
167
|
+
it("should expose internal edges of a shelled box", () => {
|
|
168
|
+
sketch("xy", () => {
|
|
169
|
+
rect(100, 100);
|
|
170
|
+
});
|
|
171
|
+
extrude(50);
|
|
172
|
+
select(face().onPlane("xy", 50));
|
|
173
|
+
const s = shell(5);
|
|
174
|
+
const ine = s.internalEdges();
|
|
175
|
+
addToScene(ine);
|
|
176
|
+
render();
|
|
177
|
+
const edges = ine.getShapes();
|
|
178
|
+
expect(edges.length).toBeGreaterThan(0);
|
|
179
|
+
for (const e of edges) {
|
|
180
|
+
expect(e.getType()).toBe("edge");
|
|
181
|
+
}
|
|
182
|
+
});
|
|
183
|
+
it("should filter internal edges by index", () => {
|
|
184
|
+
sketch("xy", () => {
|
|
185
|
+
rect(100, 100);
|
|
186
|
+
});
|
|
187
|
+
extrude(50);
|
|
188
|
+
select(face().onPlane("xy", 50));
|
|
189
|
+
const s = shell(5);
|
|
190
|
+
const allEdges = s.internalEdges();
|
|
191
|
+
const first = s.internalEdges(0);
|
|
192
|
+
addToScene(allEdges);
|
|
193
|
+
addToScene(first);
|
|
194
|
+
render();
|
|
195
|
+
const allShapes = allEdges.getShapes();
|
|
196
|
+
expect(allShapes.length).toBeGreaterThan(0);
|
|
197
|
+
expect(first.getShapes()).toHaveLength(1);
|
|
198
|
+
expect(first.getShapes()[0].isSame(allShapes[0])).toBe(true);
|
|
199
|
+
});
|
|
200
|
+
});
|
|
201
|
+
describe("shell with multiple selections", () => {
|
|
202
|
+
it("should shell a box by removing two faces", () => {
|
|
203
|
+
sketch("xy", () => {
|
|
204
|
+
rect(100, 100);
|
|
205
|
+
});
|
|
206
|
+
extrude(50);
|
|
207
|
+
const sel1 = select(face().onPlane("xy", 50));
|
|
208
|
+
const sel2 = select(face().onPlane("xy", 0));
|
|
209
|
+
shell(5, sel1, sel2);
|
|
210
|
+
const scene = render();
|
|
211
|
+
expect(countShapes(scene)).toBe(1);
|
|
212
|
+
const solid = scene.getAllSceneObjects()
|
|
213
|
+
.flatMap(o => o.getShapes())
|
|
214
|
+
.find(s => s.getType() === "solid");
|
|
215
|
+
expect(solid.getFaces().length).toBeGreaterThan(6);
|
|
216
|
+
});
|
|
217
|
+
it("should remove all selection shapes after shelling with multiple selections", () => {
|
|
218
|
+
sketch("xy", () => {
|
|
219
|
+
rect(100, 100);
|
|
220
|
+
});
|
|
221
|
+
extrude(50);
|
|
222
|
+
const sel1 = select(face().onPlane("xy", 50));
|
|
223
|
+
const sel2 = select(face().onPlane("xy", 0));
|
|
224
|
+
shell(5, sel1, sel2);
|
|
225
|
+
render();
|
|
226
|
+
expect(sel1.getShapes()).toHaveLength(0);
|
|
227
|
+
expect(sel2.getShapes()).toHaveLength(0);
|
|
228
|
+
});
|
|
229
|
+
});
|
|
230
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,103 @@
|
|
|
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 subtract from "../../core/subtract.js";
|
|
6
|
+
import cylinder from "../../core/cylinder.js";
|
|
7
|
+
import { move, rect } from "../../core/2d/index.js";
|
|
8
|
+
import { countShapes } from "../utils.js";
|
|
9
|
+
import { ShapeOps } from "../../oc/shape-ops.js";
|
|
10
|
+
describe("subtract", () => {
|
|
11
|
+
setupOC();
|
|
12
|
+
describe("basic subtraction", () => {
|
|
13
|
+
it("should subtract one solid from another", () => {
|
|
14
|
+
sketch("xy", () => {
|
|
15
|
+
rect(100, 100);
|
|
16
|
+
});
|
|
17
|
+
const box = extrude(50).new();
|
|
18
|
+
const cyl = cylinder(20, 50);
|
|
19
|
+
const s = subtract(box, cyl);
|
|
20
|
+
render();
|
|
21
|
+
const shapes = s.getShapes();
|
|
22
|
+
expect(shapes).toHaveLength(1);
|
|
23
|
+
expect(shapes[0].getType()).toBe("solid");
|
|
24
|
+
// Subtracted solid should have more faces than a simple box
|
|
25
|
+
const solid = shapes[0];
|
|
26
|
+
expect(solid.getFaces().length).toBeGreaterThan(6);
|
|
27
|
+
});
|
|
28
|
+
it("should remove original shapes from both operands", () => {
|
|
29
|
+
sketch("xy", () => {
|
|
30
|
+
rect(100, 100);
|
|
31
|
+
});
|
|
32
|
+
const box = extrude(50).new();
|
|
33
|
+
const cyl = cylinder(20, 50);
|
|
34
|
+
subtract(box, cyl);
|
|
35
|
+
render();
|
|
36
|
+
expect(box.getShapes()).toHaveLength(0);
|
|
37
|
+
expect(cyl.getShapes()).toHaveLength(0);
|
|
38
|
+
});
|
|
39
|
+
it("should produce a single solid in the scene", () => {
|
|
40
|
+
sketch("xy", () => {
|
|
41
|
+
rect(100, 100);
|
|
42
|
+
});
|
|
43
|
+
const box = extrude(50).new();
|
|
44
|
+
const cyl = cylinder(20, 50);
|
|
45
|
+
subtract(box, cyl);
|
|
46
|
+
const scene = render();
|
|
47
|
+
expect(countShapes(scene)).toBe(1);
|
|
48
|
+
});
|
|
49
|
+
});
|
|
50
|
+
describe("subtraction geometry", () => {
|
|
51
|
+
it("should preserve outer dimensions of the stock", () => {
|
|
52
|
+
sketch("xy", () => {
|
|
53
|
+
rect(100, 100);
|
|
54
|
+
});
|
|
55
|
+
const box = extrude(50).new();
|
|
56
|
+
const cyl = cylinder(20, 50);
|
|
57
|
+
const s = subtract(box, cyl);
|
|
58
|
+
render();
|
|
59
|
+
const bbox = ShapeOps.getBoundingBox(s.getShapes()[0]);
|
|
60
|
+
expect(bbox.minX).toBeCloseTo(0, 0);
|
|
61
|
+
expect(bbox.maxX).toBeCloseTo(100, 0);
|
|
62
|
+
expect(bbox.minY).toBeCloseTo(0, 0);
|
|
63
|
+
expect(bbox.maxY).toBeCloseTo(100, 0);
|
|
64
|
+
expect(bbox.maxZ).toBeCloseTo(50, 0);
|
|
65
|
+
});
|
|
66
|
+
it("should subtract a smaller box from a larger box", () => {
|
|
67
|
+
sketch("xy", () => {
|
|
68
|
+
rect(100, 100);
|
|
69
|
+
});
|
|
70
|
+
const bigBox = extrude(50).new();
|
|
71
|
+
sketch("xy", () => {
|
|
72
|
+
move([25, 25]);
|
|
73
|
+
rect(50, 50);
|
|
74
|
+
});
|
|
75
|
+
const smallBox = extrude(50).new();
|
|
76
|
+
const s = subtract(bigBox, smallBox);
|
|
77
|
+
render();
|
|
78
|
+
const shapes = s.getShapes();
|
|
79
|
+
expect(shapes).toHaveLength(1);
|
|
80
|
+
// U-shaped result should have more than 6 faces
|
|
81
|
+
const solid = shapes[0];
|
|
82
|
+
expect(solid.getFaces().length).toBeGreaterThan(6);
|
|
83
|
+
});
|
|
84
|
+
it("should handle non-intersecting solids", () => {
|
|
85
|
+
sketch("xy", () => {
|
|
86
|
+
rect(50, 50);
|
|
87
|
+
});
|
|
88
|
+
const box = extrude(30).new();
|
|
89
|
+
sketch("xy", () => {
|
|
90
|
+
move([200, 200]);
|
|
91
|
+
rect(50, 50);
|
|
92
|
+
});
|
|
93
|
+
const farBox = extrude(30).new();
|
|
94
|
+
const s = subtract(box, farBox);
|
|
95
|
+
render();
|
|
96
|
+
// Stock should remain unchanged as a simple box
|
|
97
|
+
const shapes = s.getShapes();
|
|
98
|
+
expect(shapes).toHaveLength(1);
|
|
99
|
+
const solid = shapes[0];
|
|
100
|
+
expect(solid.getFaces()).toHaveLength(6);
|
|
101
|
+
});
|
|
102
|
+
});
|
|
103
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|