fluidcad 0.0.25 → 0.0.26
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/lib/dist/common/scene-object.d.ts +4 -14
- package/lib/dist/common/scene-object.js +10 -127
- package/lib/dist/common/transformable-primitive.d.ts +16 -0
- package/lib/dist/common/transformable-primitive.js +116 -0
- package/lib/dist/core/chamfer.d.ts +5 -5
- package/lib/dist/core/color.d.ts +3 -3
- package/lib/dist/core/fillet.d.ts +6 -6
- package/lib/dist/core/index.d.ts +1 -1
- package/lib/dist/core/interfaces.d.ts +32 -24
- package/lib/dist/core/load.d.ts +2 -2
- package/lib/dist/core/mirror.d.ts +7 -7
- package/lib/dist/core/mirror.js +42 -57
- package/lib/dist/core/plane.d.ts +5 -7
- package/lib/dist/core/remove.d.ts +2 -2
- package/lib/dist/core/rotate.d.ts +5 -5
- package/lib/dist/core/subtract.d.ts +2 -2
- package/lib/dist/core/translate.d.ts +9 -9
- package/lib/dist/features/2d/slot.d.ts +3 -0
- package/lib/dist/features/2d/slot.js +28 -7
- package/lib/dist/features/cylinder.d.ts +2 -2
- package/lib/dist/features/cylinder.js +2 -2
- package/lib/dist/features/plane-from-object.d.ts +1 -1
- package/lib/dist/features/plane-from-object.js +11 -6
- package/lib/dist/features/plane-mid.d.ts +1 -1
- package/lib/dist/features/plane.d.ts +1 -1
- package/lib/dist/features/select.d.ts +1 -1
- package/lib/dist/features/select.js +1 -1
- package/lib/dist/features/sphere.d.ts +2 -2
- package/lib/dist/features/sphere.js +2 -2
- package/lib/dist/math/index.d.ts +1 -1
- package/lib/dist/math/plane.d.ts +1 -2
- package/lib/dist/math/plane.js +20 -19
- package/lib/dist/tests/features/cut-two-distances.test.js +1 -1
- package/lib/dist/tests/features/cut.test.js +1 -1
- package/lib/dist/tests/features/primitive-chain.test.js +45 -0
- package/lib/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/ui/dist/assets/{index-D2eOzshJ.js → index-BeLxRMCv.js} +1 -1
- package/ui/dist/index.html +1 -1
- package/lib/dist/tests/features/scene-object-chain.test.js +0 -64
- /package/lib/dist/tests/features/{scene-object-chain.test.d.ts → primitive-chain.test.d.ts} +0 -0
|
@@ -3,9 +3,6 @@ import { Matrix4 } from "../math/matrix4.js";
|
|
|
3
3
|
import { ISceneObject } from "../core/interfaces.js";
|
|
4
4
|
import { FusionScope, OperationMode } from "../features/extrude-options.js";
|
|
5
5
|
import { ShapeType } from "./shape-type.js";
|
|
6
|
-
import type { AxisLike } from "../math/axis.js";
|
|
7
|
-
import type { PlaneLike } from "../math/plane.js";
|
|
8
|
-
import type { PointLike } from "../math/point.js";
|
|
9
6
|
export type SourceLocation = {
|
|
10
7
|
filePath: string;
|
|
11
8
|
line: number;
|
|
@@ -61,15 +58,7 @@ export declare abstract class SceneObject implements Comparable<SceneObject>, Se
|
|
|
61
58
|
abstract getType(): string;
|
|
62
59
|
abstract build(context?: BuildSceneObjectContext): void;
|
|
63
60
|
getAppliedTransform(): Matrix4 | null;
|
|
64
|
-
|
|
65
|
-
translate(x: number): this;
|
|
66
|
-
translate(x: number, y: number): this;
|
|
67
|
-
translate(x: number, y: number, z: number): this;
|
|
68
|
-
translate(p: PointLike): this;
|
|
69
|
-
rotate(angle: number): this;
|
|
70
|
-
rotate(axis: AxisLike, angle: number): this;
|
|
71
|
-
mirror(plane: PlaneLike): this;
|
|
72
|
-
mirror(axis: AxisLike): this;
|
|
61
|
+
protected composeAppliedTransform(matrix: Matrix4): void;
|
|
73
62
|
compareTo(other: SceneObject): boolean;
|
|
74
63
|
getDependencies(): SceneObject[];
|
|
75
64
|
createCopy(remap: Map<SceneObject, SceneObject>): SceneObject;
|
|
@@ -118,9 +107,10 @@ export declare abstract class SceneObject implements Comparable<SceneObject>, Se
|
|
|
118
107
|
getOperationMode(): OperationMode;
|
|
119
108
|
isSymmetric(): boolean;
|
|
120
109
|
resolveFusionScope(sceneObjects: SceneObject[]): SceneObject[];
|
|
121
|
-
add(
|
|
110
|
+
add(): this;
|
|
122
111
|
new(): this;
|
|
123
|
-
remove(
|
|
112
|
+
remove(): this;
|
|
113
|
+
scope(...objects: ISceneObject[]): this;
|
|
124
114
|
symmetric(): this;
|
|
125
115
|
/**
|
|
126
116
|
* Called after all objects have been built. Override to perform
|
|
@@ -1,8 +1,4 @@
|
|
|
1
1
|
import { randomUUID } from "crypto";
|
|
2
|
-
import { Matrix4 } from "../math/matrix4.js";
|
|
3
|
-
import { Point } from "../math/point.js";
|
|
4
|
-
import { Vector3d } from "../math/vector3d.js";
|
|
5
|
-
import { rad } from "../helpers/math-helpers.js";
|
|
6
2
|
export class SceneObject {
|
|
7
3
|
state;
|
|
8
4
|
children = [];
|
|
@@ -97,55 +93,10 @@ export class SceneObject {
|
|
|
97
93
|
getAppliedTransform() {
|
|
98
94
|
return this._appliedTransform;
|
|
99
95
|
}
|
|
100
|
-
|
|
96
|
+
composeAppliedTransform(matrix) {
|
|
101
97
|
this._appliedTransform = this._appliedTransform
|
|
102
98
|
? matrix.multiply(this._appliedTransform)
|
|
103
99
|
: matrix;
|
|
104
|
-
return this;
|
|
105
|
-
}
|
|
106
|
-
translate(a, b, c) {
|
|
107
|
-
let x, y, z;
|
|
108
|
-
if (typeof a === 'number') {
|
|
109
|
-
x = a;
|
|
110
|
-
y = b ?? 0;
|
|
111
|
-
z = c ?? 0;
|
|
112
|
-
}
|
|
113
|
-
else if (Array.isArray(a)) {
|
|
114
|
-
x = a[0] ?? 0;
|
|
115
|
-
y = a[1] ?? 0;
|
|
116
|
-
z = a[2] ?? 0;
|
|
117
|
-
}
|
|
118
|
-
else {
|
|
119
|
-
x = a.x;
|
|
120
|
-
y = a.y;
|
|
121
|
-
z = a.z;
|
|
122
|
-
}
|
|
123
|
-
return this.transform(Matrix4.fromTranslation(x, y, z));
|
|
124
|
-
}
|
|
125
|
-
rotate(a, b) {
|
|
126
|
-
let origin;
|
|
127
|
-
let direction;
|
|
128
|
-
let angleDeg;
|
|
129
|
-
if (typeof a === 'number') {
|
|
130
|
-
origin = new Point(0, 0, 0);
|
|
131
|
-
direction = Vector3d.unitZ();
|
|
132
|
-
angleDeg = a;
|
|
133
|
-
}
|
|
134
|
-
else {
|
|
135
|
-
const resolved = resolveAxisLike(a);
|
|
136
|
-
origin = resolved.origin;
|
|
137
|
-
direction = resolved.direction;
|
|
138
|
-
angleDeg = b;
|
|
139
|
-
}
|
|
140
|
-
return this.transform(Matrix4.fromRotationAroundAxis(origin, direction, rad(angleDeg)));
|
|
141
|
-
}
|
|
142
|
-
mirror(arg) {
|
|
143
|
-
if (isAxisLikeArg(arg)) {
|
|
144
|
-
const axis = resolveAxisLike(arg);
|
|
145
|
-
return this.transform(Matrix4.mirrorAxis(axis.origin, axis.direction));
|
|
146
|
-
}
|
|
147
|
-
const plane = resolvePlaneLike(arg);
|
|
148
|
-
return this.transform(Matrix4.mirrorPlane(plane.normal, plane.origin));
|
|
149
100
|
}
|
|
150
101
|
compareTo(other) {
|
|
151
102
|
const match = this._guide === other._guide && this._reusable === other._reusable;
|
|
@@ -419,17 +370,9 @@ export class SceneObject {
|
|
|
419
370
|
}
|
|
420
371
|
return sceneObjects;
|
|
421
372
|
}
|
|
422
|
-
add(
|
|
373
|
+
add() {
|
|
423
374
|
this._operationMode = 'add';
|
|
424
|
-
|
|
425
|
-
this._fusionScope = 'all';
|
|
426
|
-
}
|
|
427
|
-
else if (objects.length === 1) {
|
|
428
|
-
this._fusionScope = objects[0];
|
|
429
|
-
}
|
|
430
|
-
else {
|
|
431
|
-
this._fusionScope = objects;
|
|
432
|
-
}
|
|
375
|
+
this._fusionScope = 'all';
|
|
433
376
|
return this;
|
|
434
377
|
}
|
|
435
378
|
new() {
|
|
@@ -437,15 +380,16 @@ export class SceneObject {
|
|
|
437
380
|
this._fusionScope = 'none';
|
|
438
381
|
return this;
|
|
439
382
|
}
|
|
440
|
-
remove(
|
|
383
|
+
remove() {
|
|
441
384
|
this._operationMode = 'remove';
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
385
|
+
this._fusionScope = 'all';
|
|
386
|
+
return this;
|
|
387
|
+
}
|
|
388
|
+
scope(...objects) {
|
|
389
|
+
if (objects.length === 1) {
|
|
446
390
|
this._fusionScope = objects[0];
|
|
447
391
|
}
|
|
448
|
-
else {
|
|
392
|
+
else if (objects.length > 1) {
|
|
449
393
|
this._fusionScope = objects;
|
|
450
394
|
}
|
|
451
395
|
return this;
|
|
@@ -463,64 +407,3 @@ export class SceneObject {
|
|
|
463
407
|
return `${this.getOrder()}-${this.getUniqueType()}-${suffix}`;
|
|
464
408
|
}
|
|
465
409
|
}
|
|
466
|
-
function isAxisLikeArg(arg) {
|
|
467
|
-
if (arg === 'x' || arg === 'y' || arg === 'z') {
|
|
468
|
-
return true;
|
|
469
|
-
}
|
|
470
|
-
if (arg && typeof arg === 'object') {
|
|
471
|
-
if (typeof arg.getAxis === 'function') {
|
|
472
|
-
return true;
|
|
473
|
-
}
|
|
474
|
-
if (arg.origin && arg.direction) {
|
|
475
|
-
return true;
|
|
476
|
-
}
|
|
477
|
-
}
|
|
478
|
-
return false;
|
|
479
|
-
}
|
|
480
|
-
function resolveAxisLike(arg) {
|
|
481
|
-
if (arg === 'x') {
|
|
482
|
-
return { origin: new Point(0, 0, 0), direction: Vector3d.unitX() };
|
|
483
|
-
}
|
|
484
|
-
if (arg === 'y') {
|
|
485
|
-
return { origin: new Point(0, 0, 0), direction: Vector3d.unitY() };
|
|
486
|
-
}
|
|
487
|
-
if (arg === 'z') {
|
|
488
|
-
return { origin: new Point(0, 0, 0), direction: Vector3d.unitZ() };
|
|
489
|
-
}
|
|
490
|
-
const a = arg;
|
|
491
|
-
if (typeof a.getAxis === 'function') {
|
|
492
|
-
const axis = a.getAxis();
|
|
493
|
-
return { origin: axis.origin, direction: axis.direction };
|
|
494
|
-
}
|
|
495
|
-
return { origin: a.origin, direction: a.direction };
|
|
496
|
-
}
|
|
497
|
-
function resolvePlaneLike(arg) {
|
|
498
|
-
if (typeof arg === 'string') {
|
|
499
|
-
switch (arg) {
|
|
500
|
-
case 'xy':
|
|
501
|
-
case 'top':
|
|
502
|
-
return { origin: new Point(0, 0, 0), normal: Vector3d.unitZ() };
|
|
503
|
-
case '-xy':
|
|
504
|
-
case 'bottom':
|
|
505
|
-
return { origin: new Point(0, 0, 0), normal: Vector3d.unitZ().multiply(-1) };
|
|
506
|
-
case 'xz':
|
|
507
|
-
case 'front':
|
|
508
|
-
return { origin: new Point(0, 0, 0), normal: Vector3d.unitY().multiply(-1) };
|
|
509
|
-
case '-xz':
|
|
510
|
-
case 'back':
|
|
511
|
-
return { origin: new Point(0, 0, 0), normal: Vector3d.unitY() };
|
|
512
|
-
case 'yz':
|
|
513
|
-
case 'right':
|
|
514
|
-
return { origin: new Point(0, 0, 0), normal: Vector3d.unitX() };
|
|
515
|
-
case '-yz':
|
|
516
|
-
case 'left':
|
|
517
|
-
return { origin: new Point(0, 0, 0), normal: Vector3d.unitX().multiply(-1) };
|
|
518
|
-
}
|
|
519
|
-
}
|
|
520
|
-
const p = arg;
|
|
521
|
-
if (typeof p.getPlane === 'function') {
|
|
522
|
-
const plane = p.getPlane();
|
|
523
|
-
return { origin: plane.origin, normal: plane.normal };
|
|
524
|
-
}
|
|
525
|
-
return { origin: p.origin, normal: p.normal };
|
|
526
|
-
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { SceneObject } from "./scene-object.js";
|
|
2
|
+
import { Matrix4 } from "../math/matrix4.js";
|
|
3
|
+
import type { AxisLike } from "../math/axis.js";
|
|
4
|
+
import type { PlaneLike } from "../math/plane.js";
|
|
5
|
+
import type { PointLike } from "../math/point.js";
|
|
6
|
+
export declare abstract class TransformablePrimitive extends SceneObject {
|
|
7
|
+
transform(matrix: Matrix4): this;
|
|
8
|
+
translate(x: number): this;
|
|
9
|
+
translate(x: number, y: number): this;
|
|
10
|
+
translate(x: number, y: number, z: number): this;
|
|
11
|
+
translate(p: PointLike): this;
|
|
12
|
+
rotate(angle: number): this;
|
|
13
|
+
rotate(axis: AxisLike, angle: number): this;
|
|
14
|
+
mirror(plane: PlaneLike): this;
|
|
15
|
+
mirror(axis: AxisLike): this;
|
|
16
|
+
}
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
import { SceneObject } from "./scene-object.js";
|
|
2
|
+
import { Matrix4 } from "../math/matrix4.js";
|
|
3
|
+
import { Point } from "../math/point.js";
|
|
4
|
+
import { Vector3d } from "../math/vector3d.js";
|
|
5
|
+
import { rad } from "../helpers/math-helpers.js";
|
|
6
|
+
export class TransformablePrimitive extends SceneObject {
|
|
7
|
+
transform(matrix) {
|
|
8
|
+
this.composeAppliedTransform(matrix);
|
|
9
|
+
return this;
|
|
10
|
+
}
|
|
11
|
+
translate(a, b, c) {
|
|
12
|
+
let x, y, z;
|
|
13
|
+
if (typeof a === 'number') {
|
|
14
|
+
x = a;
|
|
15
|
+
y = b ?? 0;
|
|
16
|
+
z = c ?? 0;
|
|
17
|
+
}
|
|
18
|
+
else if (Array.isArray(a)) {
|
|
19
|
+
x = a[0] ?? 0;
|
|
20
|
+
y = a[1] ?? 0;
|
|
21
|
+
z = a[2] ?? 0;
|
|
22
|
+
}
|
|
23
|
+
else {
|
|
24
|
+
x = a.x;
|
|
25
|
+
y = a.y;
|
|
26
|
+
z = a.z;
|
|
27
|
+
}
|
|
28
|
+
return this.transform(Matrix4.fromTranslation(x, y, z));
|
|
29
|
+
}
|
|
30
|
+
rotate(a, b) {
|
|
31
|
+
let origin;
|
|
32
|
+
let direction;
|
|
33
|
+
let angleDeg;
|
|
34
|
+
if (typeof a === 'number') {
|
|
35
|
+
origin = new Point(0, 0, 0);
|
|
36
|
+
direction = Vector3d.unitZ();
|
|
37
|
+
angleDeg = a;
|
|
38
|
+
}
|
|
39
|
+
else {
|
|
40
|
+
const resolved = resolveAxisLike(a);
|
|
41
|
+
origin = resolved.origin;
|
|
42
|
+
direction = resolved.direction;
|
|
43
|
+
angleDeg = b;
|
|
44
|
+
}
|
|
45
|
+
return this.transform(Matrix4.fromRotationAroundAxis(origin, direction, rad(angleDeg)));
|
|
46
|
+
}
|
|
47
|
+
mirror(arg) {
|
|
48
|
+
if (isAxisLikeArg(arg)) {
|
|
49
|
+
const axis = resolveAxisLike(arg);
|
|
50
|
+
return this.transform(Matrix4.mirrorAxis(axis.origin, axis.direction));
|
|
51
|
+
}
|
|
52
|
+
const plane = resolvePlaneLike(arg);
|
|
53
|
+
return this.transform(Matrix4.mirrorPlane(plane.normal, plane.origin));
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
function isAxisLikeArg(arg) {
|
|
57
|
+
if (arg === 'x' || arg === 'y' || arg === 'z') {
|
|
58
|
+
return true;
|
|
59
|
+
}
|
|
60
|
+
if (arg && typeof arg === 'object') {
|
|
61
|
+
if (typeof arg.getAxis === 'function') {
|
|
62
|
+
return true;
|
|
63
|
+
}
|
|
64
|
+
if (arg.origin && arg.direction) {
|
|
65
|
+
return true;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
return false;
|
|
69
|
+
}
|
|
70
|
+
function resolveAxisLike(arg) {
|
|
71
|
+
if (arg === 'x') {
|
|
72
|
+
return { origin: new Point(0, 0, 0), direction: Vector3d.unitX() };
|
|
73
|
+
}
|
|
74
|
+
if (arg === 'y') {
|
|
75
|
+
return { origin: new Point(0, 0, 0), direction: Vector3d.unitY() };
|
|
76
|
+
}
|
|
77
|
+
if (arg === 'z') {
|
|
78
|
+
return { origin: new Point(0, 0, 0), direction: Vector3d.unitZ() };
|
|
79
|
+
}
|
|
80
|
+
const a = arg;
|
|
81
|
+
if (typeof a.getAxis === 'function') {
|
|
82
|
+
const axis = a.getAxis();
|
|
83
|
+
return { origin: axis.origin, direction: axis.direction };
|
|
84
|
+
}
|
|
85
|
+
return { origin: a.origin, direction: a.direction };
|
|
86
|
+
}
|
|
87
|
+
function resolvePlaneLike(arg) {
|
|
88
|
+
if (typeof arg === 'string') {
|
|
89
|
+
switch (arg) {
|
|
90
|
+
case 'xy':
|
|
91
|
+
case 'top':
|
|
92
|
+
return { origin: new Point(0, 0, 0), normal: Vector3d.unitZ() };
|
|
93
|
+
case '-xy':
|
|
94
|
+
case 'bottom':
|
|
95
|
+
return { origin: new Point(0, 0, 0), normal: Vector3d.unitZ().multiply(-1) };
|
|
96
|
+
case 'xz':
|
|
97
|
+
case 'front':
|
|
98
|
+
return { origin: new Point(0, 0, 0), normal: Vector3d.unitY().multiply(-1) };
|
|
99
|
+
case '-xz':
|
|
100
|
+
case 'back':
|
|
101
|
+
return { origin: new Point(0, 0, 0), normal: Vector3d.unitY() };
|
|
102
|
+
case 'yz':
|
|
103
|
+
case 'right':
|
|
104
|
+
return { origin: new Point(0, 0, 0), normal: Vector3d.unitX() };
|
|
105
|
+
case '-yz':
|
|
106
|
+
case 'left':
|
|
107
|
+
return { origin: new Point(0, 0, 0), normal: Vector3d.unitX().multiply(-1) };
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
const p = arg;
|
|
111
|
+
if (typeof p.getPlane === 'function') {
|
|
112
|
+
const plane = p.getPlane();
|
|
113
|
+
return { origin: plane.origin, normal: plane.normal };
|
|
114
|
+
}
|
|
115
|
+
return { origin: p.origin, normal: p.normal };
|
|
116
|
+
}
|
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
import { ISceneObject
|
|
1
|
+
import { ISceneObject } from "./interfaces.js";
|
|
2
2
|
interface ChamferFunction {
|
|
3
3
|
/**
|
|
4
4
|
* Chamfers selected edges with the given distance.
|
|
5
5
|
* @param distance - The chamfer distance (defaults to 1)
|
|
6
6
|
*/
|
|
7
|
-
(distance?: number):
|
|
7
|
+
(distance?: number): ISceneObject;
|
|
8
8
|
/**
|
|
9
9
|
* Chamfers the given edge selections with the given distance.
|
|
10
10
|
* @param distance - The chamfer distance
|
|
11
11
|
* @param sceneObjects - The edge selections to chamfer
|
|
12
12
|
*/
|
|
13
|
-
(distance: number, ...sceneObjects: ISceneObject[]):
|
|
13
|
+
(distance: number, ...sceneObjects: ISceneObject[]): ISceneObject;
|
|
14
14
|
/**
|
|
15
15
|
* Chamfers selected edges with two distances or a distance and angle.
|
|
16
16
|
* @param distance - The first chamfer distance
|
|
17
17
|
* @param distance2 - The second distance, or angle if `isAngle` is true
|
|
18
18
|
* @param isAngle - Whether `distance2` is an angle
|
|
19
19
|
*/
|
|
20
|
-
(distance: number, distance2: number, isAngle?: boolean):
|
|
20
|
+
(distance: number, distance2: number, isAngle?: boolean): ISceneObject;
|
|
21
21
|
/**
|
|
22
22
|
* Chamfers the given edge selections with two distances or a distance and angle.
|
|
23
23
|
* @param distance - The first chamfer distance
|
|
@@ -25,7 +25,7 @@ interface ChamferFunction {
|
|
|
25
25
|
* @param isAngle - Whether `distance2` is an angle
|
|
26
26
|
* @param sceneObjects - The edge selections to chamfer
|
|
27
27
|
*/
|
|
28
|
-
(distance: number, distance2: number, isAngle: boolean, ...sceneObjects: ISceneObject[]):
|
|
28
|
+
(distance: number, distance2: number, isAngle: boolean, ...sceneObjects: ISceneObject[]): ISceneObject;
|
|
29
29
|
}
|
|
30
30
|
declare const _default: ChamferFunction;
|
|
31
31
|
export default _default;
|
package/lib/dist/core/color.d.ts
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import { ISceneObject
|
|
1
|
+
import { ISceneObject } from "./interfaces.js";
|
|
2
2
|
interface ColorFunction {
|
|
3
3
|
/**
|
|
4
4
|
* Applies a color to the last selection.
|
|
5
5
|
* @param color - The color value (CSS color string)
|
|
6
6
|
*/
|
|
7
|
-
(color: string):
|
|
7
|
+
(color: string): ISceneObject;
|
|
8
8
|
/**
|
|
9
9
|
* Applies a color to the given selection.
|
|
10
10
|
* @param color - The color value (CSS color string)
|
|
11
11
|
* @param selection - The face or edge selection to color
|
|
12
12
|
*/
|
|
13
|
-
(color: string, selection: ISceneObject):
|
|
13
|
+
(color: string, selection: ISceneObject): ISceneObject;
|
|
14
14
|
}
|
|
15
15
|
declare const _default: ColorFunction;
|
|
16
16
|
export default _default;
|
|
@@ -1,33 +1,33 @@
|
|
|
1
|
-
import { IGeometry, ISceneObject
|
|
1
|
+
import { IGeometry, ISceneObject } from "./interfaces.js";
|
|
2
2
|
interface FilletFunction {
|
|
3
3
|
/**
|
|
4
4
|
* Fillets selected edges with the given radius.
|
|
5
5
|
* @param radius - The fillet radius (defaults to 1)
|
|
6
6
|
*/
|
|
7
|
-
(radius?: number):
|
|
7
|
+
(radius?: number): ISceneObject;
|
|
8
8
|
/**
|
|
9
9
|
* Fillets the given edge selections with the given radius.
|
|
10
10
|
* @param radius - The fillet radius
|
|
11
11
|
* @param sceneObjects - The edge selections to fillet
|
|
12
12
|
*/
|
|
13
|
-
(radius: number, ...sceneObjects: ISceneObject[]):
|
|
13
|
+
(radius: number, ...sceneObjects: ISceneObject[]): ISceneObject;
|
|
14
14
|
/**
|
|
15
15
|
* [2D] Fillets corners between the given geometries.
|
|
16
16
|
* @param objects - The geometries whose corners to fillet
|
|
17
17
|
*/
|
|
18
|
-
(objects: IGeometry[]):
|
|
18
|
+
(objects: IGeometry[]): ISceneObject;
|
|
19
19
|
/**
|
|
20
20
|
* [2D] Fillets corners between the given geometries with a radius.
|
|
21
21
|
* @param objects - The geometries whose corners to fillet
|
|
22
22
|
* @param radius - The fillet radius
|
|
23
23
|
*/
|
|
24
|
-
(objects: IGeometry[], radius: number):
|
|
24
|
+
(objects: IGeometry[], radius: number): ISceneObject;
|
|
25
25
|
/**
|
|
26
26
|
* [2D] Fillets corners at the given radius and geometries.
|
|
27
27
|
* @param radius - The fillet radius
|
|
28
28
|
* @param objects - The geometries whose corners to fillet
|
|
29
29
|
*/
|
|
30
|
-
(radius: number, ...objects: IGeometry[]):
|
|
30
|
+
(radius: number, ...objects: IGeometry[]): ISceneObject;
|
|
31
31
|
}
|
|
32
32
|
declare const _default: FilletFunction;
|
|
33
33
|
export default _default;
|
package/lib/dist/core/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export type { ISceneObject, ITransformable,
|
|
1
|
+
export type { ISceneObject, ITransformable, IBooleanOperation, IPlane, IAxis, ISelect, IGeometry, IExtrudableGeometry, IRect, ISlot, IPolygon, ITwoObjectsTangentLine, ITangentArcTwoObjects, IExtrude, ICut, ICommon, ISweep, ILoft, IRevolve, IDraft } from "./interfaces.js";
|
|
2
2
|
export { default as axis } from "./axis.js";
|
|
3
3
|
export { default as local } from "./local.js";
|
|
4
4
|
export { default as plane } from "./plane.js";
|
|
@@ -24,26 +24,28 @@ export interface ISceneObject {
|
|
|
24
24
|
*/
|
|
25
25
|
reusable(): this;
|
|
26
26
|
}
|
|
27
|
-
export interface
|
|
27
|
+
export interface IBooleanOperation extends ISceneObject {
|
|
28
28
|
/**
|
|
29
|
-
* Additive boolean operation — fuses the result with
|
|
30
|
-
*
|
|
31
|
-
* When called with specific objects, fuses only with those objects.
|
|
32
|
-
* @param objects - Optional target objects to fuse with.
|
|
29
|
+
* Additive boolean operation — fuses the result with all intersecting scene objects.
|
|
30
|
+
* Use `.scope()` to target specific objects.
|
|
33
31
|
*/
|
|
34
|
-
add(
|
|
32
|
+
add(): this;
|
|
35
33
|
/**
|
|
36
34
|
* No boolean operation — keeps the result as a standalone shape,
|
|
37
35
|
* separate from all other scene objects.
|
|
38
36
|
*/
|
|
39
37
|
'new'(): this;
|
|
40
38
|
/**
|
|
41
|
-
* Subtractive boolean operation — cuts the result from
|
|
42
|
-
*
|
|
43
|
-
* When called with specific objects, cuts only from those objects.
|
|
44
|
-
* @param objects - Optional target objects to cut from.
|
|
39
|
+
* Subtractive boolean operation — cuts the result from all intersecting scene objects.
|
|
40
|
+
* Use `.scope()` to target specific objects.
|
|
45
41
|
*/
|
|
46
|
-
remove(
|
|
42
|
+
remove(): this;
|
|
43
|
+
/**
|
|
44
|
+
* Narrows the boolean operation scope to specific target objects.
|
|
45
|
+
* Must be chained after `.add()` or `.remove()`.
|
|
46
|
+
* @param objects - The target objects to operate on.
|
|
47
|
+
*/
|
|
48
|
+
scope(...objects: ISceneObject[]): this;
|
|
47
49
|
}
|
|
48
50
|
/**
|
|
49
51
|
* Scene objects that can be chained with world-space transformations.
|
|
@@ -98,13 +100,13 @@ export interface ITransformable extends ISceneObject {
|
|
|
98
100
|
*/
|
|
99
101
|
mirror(axis: AxisLike): this;
|
|
100
102
|
}
|
|
101
|
-
export interface IPlane extends
|
|
103
|
+
export interface IPlane extends ISceneObject {
|
|
102
104
|
}
|
|
103
|
-
export interface IAxis extends
|
|
105
|
+
export interface IAxis extends ISceneObject {
|
|
104
106
|
}
|
|
105
107
|
export interface ISelect extends ISceneObject {
|
|
106
108
|
}
|
|
107
|
-
export interface IGeometry extends
|
|
109
|
+
export interface IGeometry extends ISceneObject {
|
|
108
110
|
/**
|
|
109
111
|
* Returns a lazy-evaluated vertex at the start point of this geometry element.
|
|
110
112
|
*/
|
|
@@ -211,6 +213,11 @@ export interface ISlot extends IExtrudableGeometry {
|
|
|
211
213
|
* @param value - `true` to center, `false` (default) to start from the current position.
|
|
212
214
|
*/
|
|
213
215
|
centered(value?: boolean): this;
|
|
216
|
+
/**
|
|
217
|
+
* Sets the rotation angle of the slot's primary axis.
|
|
218
|
+
* @param angle - Rotation in degrees.
|
|
219
|
+
*/
|
|
220
|
+
rotate(angle: number): this;
|
|
214
221
|
}
|
|
215
222
|
export interface IPolygon extends IExtrudableGeometry {
|
|
216
223
|
/**
|
|
@@ -248,7 +255,7 @@ export interface ITangentArcTwoObjects extends IGeometry {
|
|
|
248
255
|
*/
|
|
249
256
|
end(index?: number): LazyVertex;
|
|
250
257
|
}
|
|
251
|
-
export interface ICommon extends
|
|
258
|
+
export interface ICommon extends ISceneObject {
|
|
252
259
|
/**
|
|
253
260
|
* Controls whether the original objects involved in the boolean intersection
|
|
254
261
|
* are retained or removed after the operation.
|
|
@@ -256,7 +263,7 @@ export interface ICommon extends ITransformable {
|
|
|
256
263
|
*/
|
|
257
264
|
keepOriginal(value?: boolean): this;
|
|
258
265
|
}
|
|
259
|
-
export interface IExtrude extends
|
|
266
|
+
export interface IExtrude extends IBooleanOperation {
|
|
260
267
|
/**
|
|
261
268
|
* Enables symmetric mode — extrudes equally in both directions from the sketch plane.
|
|
262
269
|
*/
|
|
@@ -348,16 +355,17 @@ export interface IExtrude extends IFuseable {
|
|
|
348
355
|
*/
|
|
349
356
|
thin(offset1: number, offset2: number): this;
|
|
350
357
|
}
|
|
351
|
-
export interface ICut extends
|
|
358
|
+
export interface ICut extends ISceneObject {
|
|
352
359
|
/**
|
|
353
360
|
* Enables symmetric mode — cuts equally in both directions from the sketch plane.
|
|
354
361
|
*/
|
|
355
362
|
symmetric(): this;
|
|
356
363
|
/**
|
|
357
|
-
* Narrows the cut scope to specific
|
|
364
|
+
* Narrows the cut scope to specific target objects.
|
|
365
|
+
* Must be chained after `.remove()`.
|
|
358
366
|
* @param objects - The target objects to cut from.
|
|
359
367
|
*/
|
|
360
|
-
|
|
368
|
+
scope(...objects: ISceneObject[]): this;
|
|
361
369
|
/**
|
|
362
370
|
* Applies a draft (taper) angle to the cut walls.
|
|
363
371
|
* @param value - A single angle for uniform draft, or a `[start, end]` tuple for asymmetric draft.
|
|
@@ -408,7 +416,7 @@ export interface ICut extends ITransformable {
|
|
|
408
416
|
*/
|
|
409
417
|
thin(offset1: number, offset2: number): this;
|
|
410
418
|
}
|
|
411
|
-
export interface IRevolve extends
|
|
419
|
+
export interface IRevolve extends IBooleanOperation {
|
|
412
420
|
/**
|
|
413
421
|
* Enables symmetric mode — revolves equally in both directions from the sketch plane.
|
|
414
422
|
*/
|
|
@@ -456,7 +464,7 @@ export interface IRevolve extends IFuseable {
|
|
|
456
464
|
*/
|
|
457
465
|
capEdges(...args: (number | EdgeFilterBuilder)[]): ISceneObject;
|
|
458
466
|
}
|
|
459
|
-
export interface ILoft extends
|
|
467
|
+
export interface ILoft extends IBooleanOperation {
|
|
460
468
|
/**
|
|
461
469
|
* Selects faces on the first profile plane of the loft.
|
|
462
470
|
* @param args - Numeric indices or {@link FaceFilterBuilder} instances to filter the selection.
|
|
@@ -525,7 +533,7 @@ export interface ILoft extends IFuseable {
|
|
|
525
533
|
*/
|
|
526
534
|
capEdges(...args: (number | EdgeFilterBuilder)[]): ISceneObject;
|
|
527
535
|
}
|
|
528
|
-
export interface ISweep extends
|
|
536
|
+
export interface ISweep extends IBooleanOperation {
|
|
529
537
|
/**
|
|
530
538
|
* Selects faces at the start (profile plane) of the sweep.
|
|
531
539
|
* @param args - Numeric indices or {@link FaceFilterBuilder} instances to filter the selection.
|
|
@@ -613,9 +621,9 @@ export interface ISweep extends IFuseable {
|
|
|
613
621
|
*/
|
|
614
622
|
capEdges(...args: (number | EdgeFilterBuilder)[]): ISceneObject;
|
|
615
623
|
}
|
|
616
|
-
export interface IDraft extends
|
|
624
|
+
export interface IDraft extends ISceneObject {
|
|
617
625
|
}
|
|
618
|
-
export interface IShell extends
|
|
626
|
+
export interface IShell extends ISceneObject {
|
|
619
627
|
/**
|
|
620
628
|
* Selects the inner wall faces created by the shell operation (from thickness removal).
|
|
621
629
|
* @param args - Numeric indices or {@link FaceFilterBuilder} instances to filter the selection.
|
package/lib/dist/core/load.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ISceneObject } from "./interfaces.js";
|
|
2
2
|
interface LoadFunction {
|
|
3
3
|
/**
|
|
4
4
|
* Loads a 3D model file (STEP, STL, etc.) by filename.
|
|
5
5
|
* @param fileName - The path to the model file
|
|
6
6
|
*/
|
|
7
|
-
(fileName: string):
|
|
7
|
+
(fileName: string): ISceneObject;
|
|
8
8
|
}
|
|
9
9
|
declare const _default: LoadFunction;
|
|
10
10
|
export default _default;
|
|
@@ -1,40 +1,40 @@
|
|
|
1
1
|
import { PlaneLike } from "../math/plane.js";
|
|
2
2
|
import { AxisLike } from "../math/axis.js";
|
|
3
|
-
import { ISceneObject
|
|
3
|
+
import { ISceneObject } from "./interfaces.js";
|
|
4
4
|
interface MirrorFunction {
|
|
5
5
|
/**
|
|
6
6
|
* [2D] Mirror all sketch geometries across a given line.
|
|
7
7
|
* @param line The line to mirror across
|
|
8
8
|
*/
|
|
9
|
-
(line: ISceneObject):
|
|
9
|
+
(line: ISceneObject): ISceneObject;
|
|
10
10
|
/**
|
|
11
11
|
* [2D] Mirror all sketch geometries across a given axis.
|
|
12
12
|
* @param axis The local axis to mirror across
|
|
13
13
|
*/
|
|
14
|
-
(axis: AxisLike):
|
|
14
|
+
(axis: AxisLike): ISceneObject;
|
|
15
15
|
/**
|
|
16
16
|
* [2D] Mirror given sketch geometries across a given line.
|
|
17
17
|
* @param line The line to mirror across
|
|
18
18
|
* @param geometries The geometries to mirror
|
|
19
19
|
*/
|
|
20
|
-
(line: ISceneObject, ...geometries: ISceneObject[]):
|
|
20
|
+
(line: ISceneObject, ...geometries: ISceneObject[]): ISceneObject;
|
|
21
21
|
/**
|
|
22
22
|
* [2D] Mirror given sketch geometries across a given axis.
|
|
23
23
|
* @param axis The local axis to mirror across
|
|
24
24
|
* @param geometries The geometries to mirror
|
|
25
25
|
*/
|
|
26
|
-
(axis: AxisLike, ...geometries: ISceneObject[]):
|
|
26
|
+
(axis: AxisLike, ...geometries: ISceneObject[]): ISceneObject;
|
|
27
27
|
/**
|
|
28
28
|
* [3D] Mirror all scene shapes across a given plane.
|
|
29
29
|
* @param plane The plane to mirror across
|
|
30
30
|
*/
|
|
31
|
-
(plane: PlaneLike):
|
|
31
|
+
(plane: PlaneLike): ISceneObject;
|
|
32
32
|
/**
|
|
33
33
|
* [3D] Mirror given shapes across a given plane.
|
|
34
34
|
* @param plane The plane to mirror across
|
|
35
35
|
* @param objects The shapes to mirror
|
|
36
36
|
*/
|
|
37
|
-
(plane: PlaneLike, ...objects: ISceneObject[]):
|
|
37
|
+
(plane: PlaneLike, ...objects: ISceneObject[]): ISceneObject;
|
|
38
38
|
}
|
|
39
39
|
declare const _default: MirrorFunction;
|
|
40
40
|
export default _default;
|