fluidcad 0.0.19 → 0.0.21
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/features/2d/rect.d.ts +1 -0
- package/lib/dist/features/2d/rect.js +13 -9
- package/lib/dist/filters/edge/edge-filter.d.ts +0 -14
- package/lib/dist/filters/edge/edge-filter.js +2 -0
- package/lib/dist/filters/face/face-filter.d.ts +0 -14
- package/lib/dist/filters/face/face-filter.js +2 -0
- package/lib/dist/oc/wire-ops.js +4 -1
- package/lib/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/server/dist/code-editor.js +7 -4
- package/ui/dist/assets/{index-Bz0YoaQD.js → index-B1LkrBga.js} +7 -7
- package/ui/dist/index.html +1 -1
|
@@ -13,6 +13,7 @@ export declare class Rect extends ExtrudableGeometryBase implements IRect {
|
|
|
13
13
|
height: number;
|
|
14
14
|
private _radius?;
|
|
15
15
|
private _center;
|
|
16
|
+
private static normalizeRadius;
|
|
16
17
|
constructor(width: number, height: number, targetPlane?: PlaneObjectBase);
|
|
17
18
|
build(): void;
|
|
18
19
|
buildSimpleRect(start: Point2D, plane: Plane): Edge[];
|
|
@@ -8,6 +8,13 @@ export class Rect extends ExtrudableGeometryBase {
|
|
|
8
8
|
height;
|
|
9
9
|
_radius;
|
|
10
10
|
_center = false;
|
|
11
|
+
static normalizeRadius(r) {
|
|
12
|
+
if (Array.isArray(r)) {
|
|
13
|
+
return [r[0] || 0, r[1] || 0, r[2] || 0, r[3] || 0];
|
|
14
|
+
}
|
|
15
|
+
const v = r || 0;
|
|
16
|
+
return [v, v, v, v];
|
|
17
|
+
}
|
|
11
18
|
constructor(width, height, targetPlane = null) {
|
|
12
19
|
super(targetPlane);
|
|
13
20
|
this.width = width;
|
|
@@ -171,14 +178,8 @@ export class Rect extends ExtrudableGeometryBase {
|
|
|
171
178
|
if (this.width !== other.width || this.height !== other.height || this._center !== other._center) {
|
|
172
179
|
return false;
|
|
173
180
|
}
|
|
174
|
-
const thisRadius =
|
|
175
|
-
|
|
176
|
-
this._radius || 0,
|
|
177
|
-
this._radius || 0];
|
|
178
|
-
const otherRadius = Array.isArray(other._radius) ? other._radius : [other._radius || 0,
|
|
179
|
-
other._radius || 0,
|
|
180
|
-
other._radius || 0,
|
|
181
|
-
other._radius || 0];
|
|
181
|
+
const thisRadius = Rect.normalizeRadius(this._radius);
|
|
182
|
+
const otherRadius = Rect.normalizeRadius(other._radius);
|
|
182
183
|
return thisRadius.every((r, i) => r === otherRadius[i]);
|
|
183
184
|
}
|
|
184
185
|
topEdge() {
|
|
@@ -242,7 +243,10 @@ export class Rect extends ExtrudableGeometryBase {
|
|
|
242
243
|
});
|
|
243
244
|
}
|
|
244
245
|
radius(...r) {
|
|
245
|
-
if (r.length ===
|
|
246
|
+
if (r.length === 0) {
|
|
247
|
+
this._radius = 0;
|
|
248
|
+
}
|
|
249
|
+
else if (r.length === 1) {
|
|
246
250
|
this._radius = r[0];
|
|
247
251
|
}
|
|
248
252
|
else {
|
|
@@ -5,20 +5,6 @@ import { PlaneObjectBase } from "../../features/plane-renderable-base.js";
|
|
|
5
5
|
import { ISceneObject } from "../../core/interfaces.js";
|
|
6
6
|
export declare class EdgeFilterBuilder extends FilterBuilderBase<Edge> {
|
|
7
7
|
constructor();
|
|
8
|
-
/**
|
|
9
|
-
* Selects the edge at the given index.
|
|
10
|
-
* @param index - Zero-based edge index.
|
|
11
|
-
* @param shapes - The edge array to index into.
|
|
12
|
-
* @param originalShapes - Optional original edge array before filtering.
|
|
13
|
-
*/
|
|
14
|
-
atIndex(index: number, shapes: Edge[], originalShapes?: Edge[]): this;
|
|
15
|
-
/**
|
|
16
|
-
* Excludes the edge at the given index.
|
|
17
|
-
* @param index - Zero-based edge index to exclude.
|
|
18
|
-
* @param shapes - The edge array to index into.
|
|
19
|
-
* @param originalShapes - Optional original edge array before filtering.
|
|
20
|
-
*/
|
|
21
|
-
notAtIndex(index: number, shapes: Edge[], originalShapes?: Edge[]): this;
|
|
22
8
|
/**
|
|
23
9
|
* Selects edges that lie on the given plane.
|
|
24
10
|
* @param plane - The reference plane.
|
|
@@ -21,6 +21,7 @@ export class EdgeFilterBuilder extends FilterBuilderBase {
|
|
|
21
21
|
* @param index - Zero-based edge index.
|
|
22
22
|
* @param shapes - The edge array to index into.
|
|
23
23
|
* @param originalShapes - Optional original edge array before filtering.
|
|
24
|
+
* @internal
|
|
24
25
|
*/
|
|
25
26
|
atIndex(index, shapes, originalShapes) {
|
|
26
27
|
const filter = new AtIndexFilter(index, shapes, originalShapes);
|
|
@@ -32,6 +33,7 @@ export class EdgeFilterBuilder extends FilterBuilderBase {
|
|
|
32
33
|
* @param index - Zero-based edge index to exclude.
|
|
33
34
|
* @param shapes - The edge array to index into.
|
|
34
35
|
* @param originalShapes - Optional original edge array before filtering.
|
|
36
|
+
* @internal
|
|
35
37
|
*/
|
|
36
38
|
notAtIndex(index, shapes, originalShapes) {
|
|
37
39
|
const filter = new NotAtIndexFilter(index, shapes, originalShapes);
|
|
@@ -6,20 +6,6 @@ import { EdgeFilterBuilder } from "../edge/edge-filter.js";
|
|
|
6
6
|
import { ISceneObject } from "../../core/interfaces.js";
|
|
7
7
|
export declare class FaceFilterBuilder extends FilterBuilderBase<Face> {
|
|
8
8
|
constructor();
|
|
9
|
-
/**
|
|
10
|
-
* Selects the face at the given index.
|
|
11
|
-
* @param index - Zero-based face index.
|
|
12
|
-
* @param shapes - The face array to index into.
|
|
13
|
-
* @param originalShapes - Optional original face array before filtering.
|
|
14
|
-
*/
|
|
15
|
-
atIndex(index: number, shapes: Face[], originalShapes?: Face[]): this;
|
|
16
|
-
/**
|
|
17
|
-
* Excludes the face at the given index.
|
|
18
|
-
* @param index - Zero-based face index to exclude.
|
|
19
|
-
* @param shapes - The face array to index into.
|
|
20
|
-
* @param originalShapes - Optional original face array before filtering.
|
|
21
|
-
*/
|
|
22
|
-
notAtIndex(index: number, shapes: Face[], originalShapes?: Face[]): this;
|
|
23
9
|
/**
|
|
24
10
|
* Selects faces that lie on the given plane.
|
|
25
11
|
* @param plane - The reference plane.
|
|
@@ -23,6 +23,7 @@ export class FaceFilterBuilder extends FilterBuilderBase {
|
|
|
23
23
|
* @param index - Zero-based face index.
|
|
24
24
|
* @param shapes - The face array to index into.
|
|
25
25
|
* @param originalShapes - Optional original face array before filtering.
|
|
26
|
+
* @internal
|
|
26
27
|
*/
|
|
27
28
|
atIndex(index, shapes, originalShapes) {
|
|
28
29
|
const filter = new AtIndexFilter(index, shapes, originalShapes);
|
|
@@ -34,6 +35,7 @@ export class FaceFilterBuilder extends FilterBuilderBase {
|
|
|
34
35
|
* @param index - Zero-based face index to exclude.
|
|
35
36
|
* @param shapes - The face array to index into.
|
|
36
37
|
* @param originalShapes - Optional original face array before filtering.
|
|
38
|
+
* @internal
|
|
37
39
|
*/
|
|
38
40
|
notAtIndex(index, shapes, originalShapes) {
|
|
39
41
|
const filter = new NotAtIndexFilter(index, shapes, originalShapes);
|
package/lib/dist/oc/wire-ops.js
CHANGED
|
@@ -43,9 +43,12 @@ export class WireOps {
|
|
|
43
43
|
static makeWireFromEdgesRaw(edges) {
|
|
44
44
|
const oc = getOC();
|
|
45
45
|
const wireMaker = new oc.BRepBuilderAPI_MakeWire();
|
|
46
|
+
const edgeList = new oc.TopTools_ListOfShape();
|
|
46
47
|
for (const edge of edges) {
|
|
47
|
-
|
|
48
|
+
edgeList.Append(oc.TopoDS.Edge(edge));
|
|
48
49
|
}
|
|
50
|
+
wireMaker.Add(edgeList);
|
|
51
|
+
edgeList.delete();
|
|
49
52
|
if (!wireMaker.IsDone()) {
|
|
50
53
|
wireMaker.delete();
|
|
51
54
|
throw new Error("Failed to create wire from edges");
|