fluidcad 0.0.37 → 0.0.39

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.
Files changed (113) hide show
  1. package/lib/dist/core/2d/aline.d.ts +0 -8
  2. package/lib/dist/core/2d/aline.js +3 -22
  3. package/lib/dist/core/2d/arc.d.ts +1 -23
  4. package/lib/dist/core/2d/arc.js +11 -28
  5. package/lib/dist/core/2d/circle.d.ts +1 -8
  6. package/lib/dist/core/2d/circle.js +7 -24
  7. package/lib/dist/core/2d/ellipse.d.ts +1 -17
  8. package/lib/dist/core/2d/ellipse.js +7 -45
  9. package/lib/dist/core/2d/hline.d.ts +0 -7
  10. package/lib/dist/core/2d/hline.js +5 -27
  11. package/lib/dist/core/2d/intersect.d.ts +0 -7
  12. package/lib/dist/core/2d/intersect.js +0 -13
  13. package/lib/dist/core/2d/line.d.ts +1 -8
  14. package/lib/dist/core/2d/line.js +6 -24
  15. package/lib/dist/core/2d/offset.d.ts +1 -11
  16. package/lib/dist/core/2d/offset.js +0 -16
  17. package/lib/dist/core/2d/polygon.d.ts +1 -17
  18. package/lib/dist/core/2d/polygon.js +18 -37
  19. package/lib/dist/core/2d/project.d.ts +0 -7
  20. package/lib/dist/core/2d/project.js +0 -13
  21. package/lib/dist/core/2d/rect.d.ts +1 -9
  22. package/lib/dist/core/2d/rect.js +0 -19
  23. package/lib/dist/core/2d/slot.d.ts +0 -23
  24. package/lib/dist/core/2d/slot.js +18 -37
  25. package/lib/dist/core/2d/text.d.ts +0 -7
  26. package/lib/dist/core/2d/text.js +0 -14
  27. package/lib/dist/core/2d/vline.d.ts +0 -7
  28. package/lib/dist/core/2d/vline.js +5 -23
  29. package/lib/dist/core/fillet.js +7 -0
  30. package/lib/dist/core/index.d.ts +1 -1
  31. package/lib/dist/core/interfaces.d.ts +43 -0
  32. package/lib/dist/core/plane.d.ts +26 -6
  33. package/lib/dist/core/plane.js +21 -44
  34. package/lib/dist/features/2d/connect.d.ts +2 -0
  35. package/lib/dist/features/2d/connect.js +3 -0
  36. package/lib/dist/features/2d/intersect.js +4 -1
  37. package/lib/dist/features/2d/offset.js +2 -2
  38. package/lib/dist/features/frozen-geometry.d.ts +29 -0
  39. package/lib/dist/features/frozen-geometry.js +62 -0
  40. package/lib/dist/features/loft.d.ts +38 -1
  41. package/lib/dist/features/loft.js +133 -8
  42. package/lib/dist/features/plane-from-object.d.ts +16 -4
  43. package/lib/dist/features/plane-from-object.js +101 -8
  44. package/lib/dist/features/rib.js +11 -1
  45. package/lib/dist/features/shell.d.ts +1 -1
  46. package/lib/dist/features/shell.js +9 -0
  47. package/lib/dist/features/sweep.d.ts +11 -1
  48. package/lib/dist/features/sweep.js +43 -7
  49. package/lib/dist/helpers/clone-transform.js +62 -5
  50. package/lib/dist/helpers/scene-helpers.d.ts +12 -0
  51. package/lib/dist/helpers/scene-helpers.js +26 -0
  52. package/lib/dist/math/bspline-interpolation.d.ts +33 -6
  53. package/lib/dist/math/bspline-interpolation.js +187 -84
  54. package/lib/dist/oc/loft/constrained-loft.d.ts +32 -0
  55. package/lib/dist/oc/loft/constrained-loft.js +61 -0
  56. package/lib/dist/oc/loft/curve-data.d.ts +18 -0
  57. package/lib/dist/oc/loft/curve-data.js +54 -0
  58. package/lib/dist/oc/loft/curve-eval.d.ts +23 -0
  59. package/lib/dist/oc/loft/curve-eval.js +84 -0
  60. package/lib/dist/oc/loft/guided-loft.d.ts +89 -0
  61. package/lib/dist/oc/loft/guided-loft.js +368 -0
  62. package/lib/dist/oc/loft/section-compatibility.d.ts +131 -0
  63. package/lib/dist/oc/loft/section-compatibility.js +481 -0
  64. package/lib/dist/oc/loft/section-curve.d.ts +53 -0
  65. package/lib/dist/oc/loft/section-curve.js +264 -0
  66. package/lib/dist/oc/loft/skinning.d.ts +104 -0
  67. package/lib/dist/oc/loft/skinning.js +299 -0
  68. package/lib/dist/oc/loft-ops.d.ts +28 -1
  69. package/lib/dist/oc/loft-ops.js +31 -1
  70. package/lib/dist/oc/ncollection.d.ts +19 -0
  71. package/lib/dist/oc/ncollection.js +69 -0
  72. package/lib/dist/oc/rib-ops.js +5 -17
  73. package/lib/dist/oc/sweep-ops.d.ts +7 -16
  74. package/lib/dist/oc/sweep-ops.js +67 -99
  75. package/lib/dist/oc/thin-face-maker.d.ts +0 -19
  76. package/lib/dist/oc/thin-face-maker.js +3 -68
  77. package/lib/dist/oc/wire-extend-ops.d.ts +12 -0
  78. package/lib/dist/oc/wire-extend-ops.js +42 -0
  79. package/lib/dist/oc/wire-ops.d.ts +28 -2
  80. package/lib/dist/oc/wire-ops.js +88 -4
  81. package/lib/dist/oc/wrap-ops.js +8 -15
  82. package/lib/dist/tests/features/2d/circle.test.js +0 -10
  83. package/lib/dist/tests/features/2d/ellipse.test.js +0 -30
  84. package/lib/dist/tests/features/2d/line.test.js +0 -5
  85. package/lib/dist/tests/features/2d/offset.test.js +74 -11
  86. package/lib/dist/tests/features/2d/polygon.test.js +0 -16
  87. package/lib/dist/tests/features/2d/rect.test.js +0 -11
  88. package/lib/dist/tests/features/2d/slot.test.js +0 -8
  89. package/lib/dist/tests/features/fillet2d.test.js +37 -1
  90. package/lib/dist/tests/features/loft-conditions.test.d.ts +1 -0
  91. package/lib/dist/tests/features/loft-conditions.test.js +246 -0
  92. package/lib/dist/tests/features/loft-guides.test.d.ts +1 -0
  93. package/lib/dist/tests/features/loft-guides.test.js +276 -0
  94. package/lib/dist/tests/features/plane.test.js +95 -0
  95. package/lib/dist/tests/features/repeat-sweep-borrowed-path.test.d.ts +1 -0
  96. package/lib/dist/tests/features/repeat-sweep-borrowed-path.test.js +35 -0
  97. package/lib/dist/tests/features/rib.test.js +50 -0
  98. package/lib/dist/tests/features/shell.test.js +35 -1
  99. package/lib/dist/tests/features/sweep.test.js +127 -1
  100. package/lib/dist/tests/features/text.test.js +33 -14
  101. package/lib/dist/tests/math/bspline-interpolation.test.js +97 -1
  102. package/lib/dist/tsconfig.tsbuildinfo +1 -1
  103. package/llm-docs/api/index.json +1 -1
  104. package/llm-docs/api/types/loft.md +36 -1
  105. package/llm-docs/api/types/sweep.md +13 -1
  106. package/llm-docs/api/types/text.md +2 -2
  107. package/llm-docs/index.json +5 -5
  108. package/package.json +1 -1
  109. package/server/dist/fluidcad-server.d.ts +1 -1
  110. package/server/dist/fluidcad-server.js +11 -1
  111. package/server/dist/routes/params.js +1 -1
  112. package/ui/dist/assets/{index-no7mtr5s.js → index-D8zV21wB.js} +83 -83
  113. package/ui/dist/index.html +1 -1
@@ -1,4 +1,3 @@
1
- import { PlaneLike } from "../../math/plane.js";
2
1
  import { IALine, ISceneObject } from "../interfaces.js";
3
2
  import { type NumberParam } from "../param.js";
4
3
  interface ALineFunction {
@@ -17,13 +16,6 @@ interface ALineFunction {
17
16
  * @param target - The geometry to intersect with
18
17
  */
19
18
  (angle: NumberParam, target: ISceneObject): IALine;
20
- /**
21
- * Draws a line at the given angle on a specific plane.
22
- * @param targetPlane - The plane to draw on
23
- * @param angle - The angle in degrees
24
- * @param length - The line length
25
- */
26
- (targetPlane: PlaneLike | ISceneObject, angle: NumberParam, length: NumberParam): IALine;
27
19
  }
28
20
  declare const _default: ALineFunction;
29
21
  export default _default;
@@ -1,34 +1,15 @@
1
1
  import { AngledLine } from "../../features/2d/aline.js";
2
2
  import { registerBuilder } from "../../index.js";
3
- import { isPlaneLike } from "../../math/plane.js";
4
3
  import { SceneObject } from "../../common/scene-object.js";
5
- import { resolvePlane } from "../../helpers/resolve.js";
6
4
  import { resolveParam } from "../param.js";
7
5
  function build(context) {
8
6
  return function line() {
9
- let planeObj = null;
10
- let argOffset = 0;
11
- const inSketch = context.getActiveSketch() !== null;
12
- if (arguments.length > 0) {
13
- const firstArg = arguments[0];
14
- if (isPlaneLike(firstArg)) {
15
- if (inSketch) {
16
- throw new Error("aLine(plane, ...) cannot be used inside a sketch. Use aLine(...) instead.");
17
- }
18
- planeObj = resolvePlane(firstArg, context);
19
- argOffset = 1;
20
- }
21
- else if (!inSketch && firstArg instanceof SceneObject) {
22
- planeObj = resolvePlane(firstArg, context);
23
- argOffset = 1;
24
- }
25
- }
26
- const angle = resolveParam(arguments[argOffset]);
27
- const second = arguments[argOffset + 1];
7
+ const angle = resolveParam(arguments[0]);
8
+ const second = arguments[1];
28
9
  const lengthOrTarget = second instanceof SceneObject
29
10
  ? second
30
11
  : resolveParam(second);
31
- const aline = new AngledLine(angle, lengthOrTarget, planeObj);
12
+ const aline = new AngledLine(angle, lengthOrTarget, null);
32
13
  context.addSceneObject(aline);
33
14
  return aline;
34
15
  };
@@ -1,6 +1,5 @@
1
1
  import { Point2DLike } from "../../math/point.js";
2
- import { PlaneLike } from "../../math/plane.js";
3
- import { IArcPoints, IArcAngles, ISceneObject } from "../interfaces.js";
2
+ import { IArcPoints, IArcAngles } from "../interfaces.js";
4
3
  import { type NumberParam } from "../param.js";
5
4
  interface ArcFunction {
6
5
  /**
@@ -27,27 +26,6 @@ interface ArcFunction {
27
26
  * @param endAngle - The end angle in degrees, relative to the current tangent (defaults to 180)
28
27
  */
29
28
  (radius: NumberParam, startAngle?: NumberParam, endAngle?: NumberParam): IArcAngles;
30
- /**
31
- * Draws an arc to an end point on a specific plane.
32
- * @param targetPlane - The plane to draw on
33
- * @param endPoint - The end point of the arc
34
- */
35
- (targetPlane: PlaneLike | ISceneObject, endPoint: Point2DLike): IArcPoints;
36
- /**
37
- * Draws an arc between two points on a specific plane.
38
- * @param targetPlane - The plane to draw on
39
- * @param startPoint - The start point of the arc
40
- * @param endPoint - The end point of the arc
41
- */
42
- (targetPlane: PlaneLike | ISceneObject, startPoint: Point2DLike, endPoint: Point2DLike): IArcPoints;
43
- /**
44
- * Draws an arc by radius and angle range on a specific plane.
45
- * @param targetPlane - The plane to draw on
46
- * @param radius - The arc radius
47
- * @param startAngle - The start angle in degrees
48
- * @param endAngle - The end angle in degrees
49
- */
50
- (targetPlane: PlaneLike | ISceneObject, radius: NumberParam, startAngle: NumberParam, endAngle: NumberParam): IArcAngles;
51
29
  }
52
30
  declare const _default: ArcFunction;
53
31
  export default _default;
@@ -2,46 +2,29 @@ import { isPoint2DLike } from "../../math/point.js";
2
2
  import { Arc } from "../../features/2d/arc.js";
3
3
  import { normalizePoint2D } from "../../helpers/normalize.js";
4
4
  import { registerBuilder } from "../../index.js";
5
- import { isPlaneLike } from "../../math/plane.js";
6
- import { SceneObject } from "../../common/scene-object.js";
7
- import { resolvePlane } from "../../helpers/resolve.js";
8
5
  import { resolveParam } from "../param.js";
9
6
  function build(context) {
10
7
  return function arc() {
11
- let planeObj = null;
12
- let argOffset = 0;
13
- // Detect plane as first argument (only valid outside a sketch)
14
- if (arguments.length > 0) {
15
- const firstArg = arguments[0];
16
- if (isPlaneLike(firstArg) || (firstArg instanceof SceneObject && !isPoint2DLike(firstArg))) {
17
- if (context.getActiveSketch() !== null) {
18
- throw new Error("arc(plane, ...) cannot be used inside a sketch. Use arc(...) instead.");
19
- }
20
- planeObj = resolvePlane(firstArg, context);
21
- argOffset = 1;
22
- }
23
- }
24
- const argCount = arguments.length - argOffset;
25
8
  // (startPoint, endPoint) — two Point2DLike args, default center = current position
26
- if (argCount >= 2 && isPoint2DLike(arguments[argOffset]) && isPoint2DLike(arguments[argOffset + 1])) {
27
- const start = normalizePoint2D(arguments[argOffset]);
28
- const end = normalizePoint2D(arguments[argOffset + 1]);
29
- const arcObj = Arc.twoPoints(start, end, planeObj);
9
+ if (arguments.length >= 2 && isPoint2DLike(arguments[0]) && isPoint2DLike(arguments[1])) {
10
+ const start = normalizePoint2D(arguments[0]);
11
+ const end = normalizePoint2D(arguments[1]);
12
+ const arcObj = Arc.twoPoints(start, end);
30
13
  context.addSceneObject(arcObj);
31
14
  return arcObj;
32
15
  }
33
16
  // (endPoint) — single Point2DLike arg
34
- if (isPoint2DLike(arguments[argOffset])) {
35
- const end = normalizePoint2D(arguments[argOffset]);
36
- const arcObj = Arc.toPoint(end, planeObj);
17
+ if (isPoint2DLike(arguments[0])) {
18
+ const end = normalizePoint2D(arguments[0]);
19
+ const arcObj = Arc.toPoint(end);
37
20
  context.addSceneObject(arcObj);
38
21
  return arcObj;
39
22
  }
40
23
  // (radius, startAngle?, endAngle?) — all numeric args
41
- const radius = resolveParam(arguments[argOffset]) || 100;
42
- const startAngle = resolveParam(arguments[argOffset + 1]) || 0;
43
- const endAngle = argCount >= 3 ? resolveParam(arguments[argOffset + 2]) : 180;
44
- const arcObj = Arc.fromAngles(radius, startAngle, endAngle, planeObj);
24
+ const radius = resolveParam(arguments[0]) || 100;
25
+ const startAngle = resolveParam(arguments[1]) || 0;
26
+ const endAngle = arguments.length >= 3 ? resolveParam(arguments[2]) : 180;
27
+ const arcObj = Arc.fromAngles(radius, startAngle, endAngle);
45
28
  context.addSceneObject(arcObj);
46
29
  return arcObj;
47
30
  };
@@ -1,6 +1,5 @@
1
1
  import { Point2DLike } from "../../math/point.js";
2
- import { PlaneLike } from "../../math/plane.js";
3
- import { IExtrudableGeometry, ISceneObject } from "../interfaces.js";
2
+ import { IExtrudableGeometry } from "../interfaces.js";
4
3
  import { type NumberParam } from "../param.js";
5
4
  interface CircleFunction {
6
5
  /**
@@ -14,12 +13,6 @@ interface CircleFunction {
14
13
  * @param diameter - The circle diameter (defaults to 40)
15
14
  */
16
15
  (diameter?: NumberParam): IExtrudableGeometry;
17
- /**
18
- * Draws a circle with a given diameter on a specific plane.
19
- * @param targetPlane - The plane to draw on
20
- * @param diameter - The circle diameter
21
- */
22
- (targetPlane: PlaneLike | ISceneObject, diameter: NumberParam): IExtrudableGeometry;
23
16
  }
24
17
  declare const _default: CircleFunction;
25
18
  export default _default;
@@ -1,45 +1,28 @@
1
- import { isPoint2DLike } from "../../math/point.js";
2
1
  import { Circle } from "../../features/2d/circle.js";
3
2
  import { Move } from "../../features/2d/move.js";
4
3
  import { normalizePoint2D } from "../../helpers/normalize.js";
5
4
  import { registerBuilder } from "../../index.js";
6
- import { isPlaneLike } from "../../math/plane.js";
7
- import { SceneObject } from "../../common/scene-object.js";
8
- import { resolvePlane } from "../../helpers/resolve.js";
9
5
  import { resolveParam } from "../param.js";
10
6
  function build(context) {
11
7
  return function circle() {
12
8
  let diameter;
13
9
  let center;
14
10
  let circle;
15
- let planeObj = null;
16
- let argOffset = 0;
17
- // Detect plane as first argument (only valid outside a sketch)
18
- if (arguments.length > 0) {
19
- const firstArg = arguments[0];
20
- if (isPlaneLike(firstArg) || (firstArg instanceof SceneObject && !isPoint2DLike(firstArg))) {
21
- if (context.getActiveSketch() !== null) {
22
- throw new Error("circle(plane, ...) cannot be used inside a sketch. Use circle(...) instead.");
23
- }
24
- planeObj = resolvePlane(firstArg, context);
25
- argOffset = 1;
26
- }
27
- }
28
- const argCount = arguments.length - argOffset;
11
+ const argCount = arguments.length;
29
12
  if (argCount === 0) {
30
13
  diameter = 40;
31
- circle = new Circle(diameter, null, planeObj);
14
+ circle = new Circle(diameter, null, null);
32
15
  context.addSceneObject(circle);
33
16
  }
34
17
  else if (argCount === 1) {
35
- diameter = resolveParam(arguments[argOffset]) || 40;
36
- circle = new Circle(diameter, null, planeObj);
18
+ diameter = resolveParam(arguments[0]) || 40;
19
+ circle = new Circle(diameter, null, null);
37
20
  context.addSceneObject(circle);
38
21
  }
39
22
  else {
40
- center = normalizePoint2D(arguments[argOffset]);
41
- diameter = resolveParam(arguments[argOffset + 1]) || 40;
42
- circle = new Circle(diameter, null, planeObj);
23
+ center = normalizePoint2D(arguments[0]);
24
+ diameter = resolveParam(arguments[1]) || 40;
25
+ circle = new Circle(diameter, null, null);
43
26
  const move = new Move(center);
44
27
  context.addSceneObjects([move, circle]);
45
28
  }
@@ -1,6 +1,5 @@
1
1
  import { Point2DLike } from "../../math/point.js";
2
- import { PlaneLike } from "../../math/plane.js";
3
- import { IExtrudableGeometry, ISceneObject } from "../interfaces.js";
2
+ import { IExtrudableGeometry } from "../interfaces.js";
4
3
  import { type NumberParam } from "../param.js";
5
4
  interface EllipseFunction {
6
5
  /**
@@ -16,21 +15,6 @@ interface EllipseFunction {
16
15
  * @param ry - Semi-radius along the plane's Y axis
17
16
  */
18
17
  (center: Point2DLike, rx: NumberParam, ry: NumberParam): IExtrudableGeometry;
19
- /**
20
- * Draws an ellipse on a specific plane.
21
- * @param targetPlane - The plane to draw on
22
- * @param rx - Semi-radius along the plane's X axis
23
- * @param ry - Semi-radius along the plane's Y axis
24
- */
25
- (targetPlane: PlaneLike | ISceneObject, rx: NumberParam, ry: NumberParam): IExtrudableGeometry;
26
- /**
27
- * Draws an ellipse at a given center on a specific plane.
28
- * @param targetPlane - The plane to draw on
29
- * @param center - The center point in plane-local coordinates
30
- * @param rx - Semi-radius along the plane's X axis
31
- * @param ry - Semi-radius along the plane's Y axis
32
- */
33
- (targetPlane: PlaneLike | ISceneObject, center: Point2DLike, rx: NumberParam, ry: NumberParam): IExtrudableGeometry;
34
18
  }
35
19
  declare const _default: EllipseFunction;
36
20
  export default _default;
@@ -1,60 +1,22 @@
1
- import { Point2D, isPoint2DLike } from "../../math/point.js";
2
- import { LazyVertex } from "../../features/lazy-vertex.js";
3
1
  import { Ellipse } from "../../features/2d/ellipse.js";
4
2
  import { Move } from "../../features/2d/move.js";
5
3
  import { normalizePoint2D } from "../../helpers/normalize.js";
6
4
  import { registerBuilder } from "../../index.js";
7
- import { isPlaneLike } from "../../math/plane.js";
8
- import { SceneObject } from "../../common/scene-object.js";
9
- import { resolvePlane } from "../../helpers/resolve.js";
10
5
  import { resolveParam } from "../param.js";
11
- function toPoint2D(p) {
12
- if (p instanceof Point2D) {
13
- return p;
14
- }
15
- if (p instanceof LazyVertex) {
16
- return p.asPoint2D();
17
- }
18
- if (Array.isArray(p)) {
19
- return new Point2D(p[0], p[1]);
20
- }
21
- return new Point2D(p.x, p.y);
22
- }
23
6
  function build(context) {
24
7
  return function ellipse() {
25
- let planeObj = null;
26
- let argOffset = 0;
27
- if (arguments.length > 0) {
28
- const firstArg = arguments[0];
29
- if (isPlaneLike(firstArg) || (firstArg instanceof SceneObject && !isPoint2DLike(firstArg))) {
30
- if (context.getActiveSketch() !== null) {
31
- throw new Error("ellipse(plane, ...) cannot be used inside a sketch. Use ellipse(...) instead.");
32
- }
33
- planeObj = resolvePlane(firstArg, context);
34
- argOffset = 1;
35
- }
36
- }
37
- const argCount = arguments.length - argOffset;
8
+ const argCount = arguments.length;
38
9
  if (argCount === 2) {
39
- const rx = resolveParam(arguments[argOffset]);
40
- const ry = resolveParam(arguments[argOffset + 1]);
41
- const e = new Ellipse(rx, ry, planeObj);
10
+ const rx = resolveParam(arguments[0]);
11
+ const ry = resolveParam(arguments[1]);
12
+ const e = new Ellipse(rx, ry, null);
42
13
  context.addSceneObject(e);
43
14
  return e;
44
15
  }
45
16
  if (argCount === 3) {
46
- const centerArg = arguments[argOffset];
47
- const rx = resolveParam(arguments[argOffset + 1]);
48
- const ry = resolveParam(arguments[argOffset + 2]);
49
- if (planeObj) {
50
- // Standalone (plane, center, rx, ry): center is plane-local. Move
51
- // can't run outside a sketch, so resolve the center eagerly into the
52
- // Ellipse via centerOverride.
53
- const center = toPoint2D(centerArg);
54
- const e = new Ellipse(rx, ry, planeObj, center);
55
- context.addSceneObject(e);
56
- return e;
57
- }
17
+ const centerArg = arguments[0];
18
+ const rx = resolveParam(arguments[1]);
19
+ const ry = resolveParam(arguments[2]);
58
20
  const center = normalizePoint2D(centerArg);
59
21
  const e = new Ellipse(rx, ry, null);
60
22
  context.addSceneObjects([new Move(center), e]);
@@ -1,5 +1,4 @@
1
1
  import { Point2DLike } from "../../math/point.js";
2
- import { PlaneLike } from "../../math/plane.js";
3
2
  import { IHLine, ISceneObject } from "../interfaces.js";
4
3
  import { type NumberParam } from "../param.js";
5
4
  interface HLineFunction {
@@ -30,12 +29,6 @@ interface HLineFunction {
30
29
  * @param target - The geometry to intersect with
31
30
  */
32
31
  (start: Point2DLike, target: ISceneObject): IHLine;
33
- /**
34
- * Draws a horizontal line on a specific plane.
35
- * @param targetPlane - The plane to draw on
36
- * @param distance - The line length
37
- */
38
- (targetPlane: PlaneLike | ISceneObject, distance: NumberParam): IHLine;
39
32
  }
40
33
  declare const _default: HLineFunction;
41
34
  export default _default;
@@ -3,53 +3,31 @@ import { Move } from "../../features/2d/move.js";
3
3
  import { HorizontalLine } from "../../features/2d/hline.js";
4
4
  import { normalizePoint2D } from "../../helpers/normalize.js";
5
5
  import { registerBuilder } from "../../index.js";
6
- import { isPlaneLike } from "../../math/plane.js";
7
6
  import { SceneObject } from "../../common/scene-object.js";
8
- import { resolvePlane } from "../../helpers/resolve.js";
9
7
  import { isNumberParam, resolveParam } from "../param.js";
10
8
  function build(context) {
11
9
  return function line() {
12
- let planeObj = null;
13
- let argOffset = 0;
14
10
  const inSketch = context.getActiveSketch() !== null;
15
- // Detect plane as first argument (only valid outside a sketch).
16
- // Inside a sketch, a SceneObject in the first position is a target geometry,
17
- // and a true PlaneLike is an error since drawing on another plane mid-sketch
18
- // is not supported.
19
- if (arguments.length > 0) {
20
- const firstArg = arguments[0];
21
- if (isPlaneLike(firstArg)) {
22
- if (inSketch) {
23
- throw new Error("hLine(plane, ...) cannot be used inside a sketch. Use hLine(...) instead.");
24
- }
25
- planeObj = resolvePlane(firstArg, context);
26
- argOffset = 1;
27
- }
28
- else if (!inSketch && firstArg instanceof SceneObject && !isPoint2DLike(firstArg)) {
29
- planeObj = resolvePlane(firstArg, context);
30
- argOffset = 1;
31
- }
32
- }
33
- if (argOffset === 0 && inSketch && arguments[0] instanceof SceneObject && !isPoint2DLike(arguments[0])) {
11
+ if (inSketch && arguments[0] instanceof SceneObject && !isPoint2DLike(arguments[0])) {
34
12
  // hLine(target)
35
13
  const hline = new HorizontalLine(arguments[0], null);
36
14
  context.addSceneObject(hline);
37
15
  return hline;
38
16
  }
39
- if (argOffset === 0 && !isNumberParam(arguments[0])) {
17
+ if (!isNumberParam(arguments[0])) {
40
18
  // hLine(start, distance) or hLine(start, target)
41
19
  const start = normalizePoint2D(arguments[0]);
42
20
  const second = arguments[1];
43
21
  const distanceOrTarget = second instanceof SceneObject
44
22
  ? second
45
23
  : resolveParam(second);
46
- const hline = new HorizontalLine(distanceOrTarget, planeObj);
24
+ const hline = new HorizontalLine(distanceOrTarget, null);
47
25
  hline.setHasExplicitStart();
48
26
  context.addSceneObjects([new Move(start), hline]);
49
27
  return hline;
50
28
  }
51
- const distance = resolveParam(arguments[argOffset]);
52
- const hline = new HorizontalLine(distance, planeObj);
29
+ const distance = resolveParam(arguments[0]);
30
+ const hline = new HorizontalLine(distance, null);
53
31
  context.addSceneObject(hline);
54
32
  return hline;
55
33
  };
@@ -1,4 +1,3 @@
1
- import { PlaneLike } from "../../math/plane.js";
2
1
  import { IExtrudableGeometry, ISceneObject } from "../interfaces.js";
3
2
  interface IntersectFunction {
4
3
  /**
@@ -6,12 +5,6 @@ interface IntersectFunction {
6
5
  * @param sourceObjects - The 3D objects to intersect
7
6
  */
8
7
  (...sourceObjects: ISceneObject[]): IExtrudableGeometry;
9
- /**
10
- * Intersects 3D objects with a target plane, producing cross-section edges.
11
- * @param targetPlane - The plane to intersect with
12
- * @param sourceObjects - The 3D objects to intersect
13
- */
14
- (targetPlane: PlaneLike | ISceneObject, sourceObjects: ISceneObject[]): IExtrudableGeometry;
15
8
  }
16
9
  declare const _default: IntersectFunction;
17
10
  export default _default;
@@ -1,20 +1,7 @@
1
1
  import { Intersect } from "../../features/2d/intersect.js";
2
- import { resolvePlane } from "../../helpers/resolve.js";
3
2
  import { registerBuilder } from "../../index.js";
4
3
  function build(context) {
5
4
  return function intersect(...args) {
6
- // Plane-first mode: intersect(plane, sources[])
7
- if (args.length === 2 && Array.isArray(args[1])) {
8
- if (context.getActiveSketch() !== null) {
9
- throw new Error("intersect(plane, sources[]) cannot be used inside a sketch. Use intersect(...sources) instead.");
10
- }
11
- const planeObj = resolvePlane(args[0], context);
12
- const sourceObjects = args[1];
13
- context.addSceneObjects(sourceObjects);
14
- const result = new Intersect(sourceObjects, planeObj);
15
- context.addSceneObject(result);
16
- return result;
17
- }
18
5
  const result = new Intersect(args);
19
6
  context.addSceneObjects(args);
20
7
  context.addSceneObject(result);
@@ -1,6 +1,5 @@
1
1
  import { Point2DLike } from "../../math/point.js";
2
- import { PlaneLike } from "../../math/plane.js";
3
- import { IGeometry, ISceneObject } from "../interfaces.js";
2
+ import { IGeometry } from "../interfaces.js";
4
3
  interface LineFunction {
5
4
  /**
6
5
  * Draws a line from the current position to the given point.
@@ -13,12 +12,6 @@ interface LineFunction {
13
12
  * @param end - The end point
14
13
  */
15
14
  (start: Point2DLike, end: Point2DLike): IGeometry;
16
- /**
17
- * Draws a line to the given point on a specific plane.
18
- * @param targetPlane - The plane to draw on
19
- * @param end - The end point
20
- */
21
- (targetPlane: PlaneLike | ISceneObject, end: Point2DLike): IGeometry;
22
15
  }
23
16
  declare const _default: LineFunction;
24
17
  export default _default;
@@ -1,38 +1,20 @@
1
- import { isPoint2DLike } from "../../math/point.js";
2
1
  import { LineTo } from "../../features/2d/line.js";
3
2
  import { Move } from "../../features/2d/move.js";
4
3
  import { normalizePoint2D } from "../../helpers/normalize.js";
5
4
  import { registerBuilder } from "../../index.js";
6
- import { isPlaneLike } from "../../math/plane.js";
7
- import { SceneObject } from "../../common/scene-object.js";
8
- import { resolvePlane } from "../../helpers/resolve.js";
9
5
  function build(context) {
10
6
  return function line() {
11
7
  let line;
12
- let planeObj = null;
13
- let argOffset = 0;
14
- // Detect plane as first argument (only valid outside a sketch)
15
- // Point2DLike is not plane-like so no conflict
16
- if (arguments.length > 0) {
17
- const firstArg = arguments[0];
18
- if (isPlaneLike(firstArg) || (firstArg instanceof SceneObject && !isPoint2DLike(firstArg))) {
19
- if (context.getActiveSketch() !== null) {
20
- throw new Error("line(plane, ...) cannot be used inside a sketch. Use line(...) instead.");
21
- }
22
- planeObj = resolvePlane(firstArg, context);
23
- argOffset = 1;
24
- }
25
- }
26
- const argCount = arguments.length - argOffset;
8
+ const argCount = arguments.length;
27
9
  if (argCount === 1) {
28
- const vertex = normalizePoint2D(arguments[argOffset]);
29
- line = new LineTo(vertex, planeObj);
10
+ const vertex = normalizePoint2D(arguments[0]);
11
+ line = new LineTo(vertex, null);
30
12
  context.addSceneObject(line);
31
13
  }
32
14
  else if (argCount === 2) {
33
- const start = normalizePoint2D(arguments[argOffset]);
34
- const end = normalizePoint2D(arguments[argOffset + 1]);
35
- line = new LineTo(end, planeObj);
15
+ const start = normalizePoint2D(arguments[0]);
16
+ const end = normalizePoint2D(arguments[1]);
17
+ line = new LineTo(end, null);
36
18
  line.setHasExplicitStart();
37
19
  context.addSceneObjects([new Move(start), line]);
38
20
  }
@@ -1,6 +1,4 @@
1
- import { PlaneLike } from "../../math/plane.js";
2
- import { IOffset, ISceneObject } from "../interfaces.js";
3
- import { Extrudable } from "../../helpers/types.js";
1
+ import { IOffset } from "../interfaces.js";
4
2
  import { type NumberParam, type BooleanParam } from "../param.js";
5
3
  interface OffsetFunction {
6
4
  /**
@@ -9,14 +7,6 @@ interface OffsetFunction {
9
7
  * @param removeOriginal - Whether to remove the original geometry
10
8
  */
11
9
  (distance?: NumberParam, removeOriginal?: BooleanParam): IOffset;
12
- /**
13
- * Offsets source geometries onto a target plane.
14
- * @param targetPlane - The plane to offset onto
15
- * @param distance - The offset distance
16
- * @param removeOriginal - Whether to remove the original geometry
17
- * @param sourceGeometries - The geometries to offset
18
- */
19
- (targetPlane: PlaneLike | ISceneObject, distance: NumberParam, removeOriginal: BooleanParam, ...sourceGeometries: Extrudable[]): IOffset;
20
10
  }
21
11
  declare const _default: OffsetFunction;
22
12
  export default _default;
@@ -1,24 +1,8 @@
1
1
  import { Offset } from "../../features/2d/offset.js";
2
2
  import { registerBuilder } from "../../index.js";
3
- import { resolvePlane } from "../../helpers/resolve.js";
4
3
  import { isNumberParam, isBooleanParam, resolveParam } from "../param.js";
5
4
  function build(context) {
6
5
  return function offset(...args) {
7
- // Plane-first mode: offset(plane, distance, removeOriginal, ...sourceGeometries)
8
- // Detected when first arg is not a number/undefined.
9
- if (args.length > 0 && args[0] !== undefined && !isNumberParam(args[0]) && !isBooleanParam(args[0])) {
10
- if (context.getActiveSketch() !== null) {
11
- throw new Error("offset(plane, ...) cannot be used inside a sketch. Use offset(...) instead.");
12
- }
13
- const planeObj = resolvePlane(args[0], context);
14
- const distance = resolveParam(args[1]) ?? 1;
15
- const removeOriginal = resolveParam(args[2]) ?? false;
16
- const sourceObjects = args.slice(3);
17
- const off = new Offset(distance, removeOriginal, sourceObjects, planeObj);
18
- context.addSceneObject(off);
19
- return off;
20
- }
21
- // In-sketch mode: offset(distance, removeOriginal)
22
6
  const distance = isNumberParam(args[0]) ? resolveParam(args[0]) : 1;
23
7
  const removeOriginal = isBooleanParam(args[1]) ? resolveParam(args[1]) : false;
24
8
  const off = new Offset(distance, removeOriginal);
@@ -1,7 +1,6 @@
1
1
  import { Point2DLike } from "../../math/point.js";
2
2
  import { PolygonMode } from "../../features/2d/polygon.js";
3
- import { PlaneLike } from "../../math/plane.js";
4
- import { IPolygon, ISceneObject } from "../interfaces.js";
3
+ import { IPolygon } from "../interfaces.js";
5
4
  import { type NumberParam } from "../param.js";
6
5
  interface PolygonFunction {
7
6
  /**
@@ -19,21 +18,6 @@ interface PolygonFunction {
19
18
  * @param mode - `'inscribed'` or `'circumscribed'` (defaults to `'inscribed'`)
20
19
  */
21
20
  (center: Point2DLike, numberOfSides: NumberParam, diameter: NumberParam, mode?: PolygonMode): IPolygon;
22
- /**
23
- * Draws a regular polygon on a specific plane.
24
- * @param targetPlane - The plane to draw on
25
- * @param numberOfSides - The number of sides
26
- * @param diameter - The circumscribed or inscribed diameter
27
- */
28
- (targetPlane: PlaneLike | ISceneObject, numberOfSides: NumberParam, diameter: NumberParam): IPolygon;
29
- /**
30
- * Draws a regular polygon with a given mode on a specific plane.
31
- * @param targetPlane - The plane to draw on
32
- * @param numberOfSides - The number of sides
33
- * @param diameter - The circumscribed or inscribed diameter
34
- * @param mode - `'inscribed'` or `'circumscribed'`
35
- */
36
- (targetPlane: PlaneLike | ISceneObject, numberOfSides: NumberParam, diameter: NumberParam, mode: PolygonMode): IPolygon;
37
21
  }
38
22
  declare const _default: PolygonFunction;
39
23
  export default _default;