@constructorfleet/sketchforge-engine 1.13.0 → 1.14.0
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/dist/domain/sketchforge.d.ts +4 -0
- package/dist/domain/sketchforge.d.ts.map +1 -1
- package/dist/serverStepExplode.d.ts.map +1 -1
- package/dist/serverStepExplode.js +2 -75
- package/dist/serverStepExplode.js.map +1 -1
- package/dist/skfProject.d.ts.map +1 -1
- package/dist/skfProject.js +17 -0
- package/dist/skfProject.js.map +1 -1
- package/dist/stepComponentMetadata.d.ts +10 -0
- package/dist/stepComponentMetadata.d.ts.map +1 -0
- package/dist/stepComponentMetadata.js +73 -0
- package/dist/stepComponentMetadata.js.map +1 -0
- package/dist/stepImport.d.ts +1 -0
- package/dist/stepImport.d.ts.map +1 -1
- package/dist/stepImport.js +6 -76
- package/dist/stepImport.js.map +1 -1
- package/dist/stepImportCommon.d.ts +11 -0
- package/dist/stepImportCommon.d.ts.map +1 -0
- package/dist/stepImportCommon.js +121 -0
- package/dist/stepImportCommon.js.map +1 -0
- package/dist/stepImportKernel.d.ts +2 -13
- package/dist/stepImportKernel.d.ts.map +1 -1
- package/dist/stepImportKernel.js +4 -142
- package/dist/stepImportKernel.js.map +1 -1
- package/dist/support/cadModifierTypes.d.ts +19 -0
- package/dist/support/cadModifierTypes.d.ts.map +1 -1
- package/dist/support/i18n/locales/en/messages.json +3 -0
- package/dist/support/lib/brepKernel.d.ts +4 -0
- package/dist/support/lib/brepKernel.d.ts.map +1 -1
- package/dist/support/lib/brepKernel.js +22 -10
- package/dist/support/lib/brepKernel.js.map +1 -1
- package/dist/support/lib/operator-configuration.json +124 -0
- package/dist/support/lib/operatorConfiguration.d.ts +14 -0
- package/dist/support/lib/operatorConfiguration.d.ts.map +1 -0
- package/dist/support/lib/operatorConfiguration.js +6 -0
- package/dist/support/lib/operatorConfiguration.js.map +1 -0
- package/dist/support/lib/serverProjectStore.d.ts +1 -1
- package/dist/support/lib/serverProjectStore.d.ts.map +1 -1
- package/dist/support/lib/serverProjectStore.js +2 -1
- package/dist/support/lib/serverProjectStore.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
import { createLocalId } from "./localIds.js";
|
|
2
|
+
import { LocalizedError } from "./support/i18n/LocalizedError.js";
|
|
3
|
+
import { importedShapeFromTriangleSoup } from "./stlImport.js";
|
|
4
|
+
import { stepComponentMetadata, stepShapeKey } from "./stepComponentMetadata.js";
|
|
5
|
+
const IMPORT_TESSELLATION = { linearDeflection: 0.1, angularDeflection: 0.5 };
|
|
6
|
+
const EXACT_GEOMETRY_LIMITS = { solids: 200, sourceBytes: 8 * 1024 * 1024 };
|
|
7
|
+
function messageOf(error) {
|
|
8
|
+
if (error instanceof Error && error.message)
|
|
9
|
+
return error.message;
|
|
10
|
+
const described = String(error);
|
|
11
|
+
return described === "[object WebAssembly.Exception]" ? "the CAD kernel refused the file" : described;
|
|
12
|
+
}
|
|
13
|
+
function meshBounds(positions) {
|
|
14
|
+
if (positions.length < 9)
|
|
15
|
+
return null;
|
|
16
|
+
let minX = Infinity, minY = Infinity, minZ = Infinity, maxX = -Infinity, maxZ = -Infinity;
|
|
17
|
+
for (let index = 0; index < positions.length; index += 3) {
|
|
18
|
+
minX = Math.min(minX, positions[index]);
|
|
19
|
+
maxX = Math.max(maxX, positions[index]);
|
|
20
|
+
minY = Math.min(minY, positions[index + 1]);
|
|
21
|
+
minZ = Math.min(minZ, positions[index + 2]);
|
|
22
|
+
maxZ = Math.max(maxZ, positions[index + 2]);
|
|
23
|
+
}
|
|
24
|
+
return { minX, minY, minZ, maxX, maxZ };
|
|
25
|
+
}
|
|
26
|
+
function componentColorsByFace(cad, stepText, solids, faces) {
|
|
27
|
+
// XCAF import and its GLB fallback are intentionally bounded. The regular
|
|
28
|
+
// mesh import still accepts larger files, where building a second colored
|
|
29
|
+
// representation can multiply the tessellation cost substantially.
|
|
30
|
+
if (solids.length > EXACT_GEOMETRY_LIMITS.solids || new TextEncoder().encode(stepText).byteLength > EXACT_GEOMETRY_LIMITS.sourceBytes) {
|
|
31
|
+
return new Map();
|
|
32
|
+
}
|
|
33
|
+
const metadataBySolid = stepComponentMetadata(cad, stepText);
|
|
34
|
+
const colorsBySolid = new Map();
|
|
35
|
+
for (const [key, candidates] of metadataBySolid) {
|
|
36
|
+
const colors = [...new Set(candidates.map(({ color }) => color).filter((color) => Boolean(color)))];
|
|
37
|
+
// Identical solids with conflicting labels cannot be associated by bounds
|
|
38
|
+
// and volume alone, so leave those faces at the ordinary shape color.
|
|
39
|
+
if (colors.length === 1 && candidates.every(({ color }) => color === colors[0]))
|
|
40
|
+
colorsBySolid.set(key, colors[0]);
|
|
41
|
+
}
|
|
42
|
+
const faceIndexByHash = new Map(faces.map((face, index) => [cad.hashCode(face, 2_147_483_647), index]));
|
|
43
|
+
const colorsByFace = new Map();
|
|
44
|
+
for (const solid of solids) {
|
|
45
|
+
const color = colorsBySolid.get(stepShapeKey(cad, solid));
|
|
46
|
+
if (!color)
|
|
47
|
+
continue;
|
|
48
|
+
for (const face of cad.getSubShapes(solid, "face")) {
|
|
49
|
+
const faceIndex = faceIndexByHash.get(cad.hashCode(face, 2_147_483_647));
|
|
50
|
+
if (faceIndex !== undefined)
|
|
51
|
+
colorsByFace.set(faceIndex, color);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
return colorsByFace;
|
|
55
|
+
}
|
|
56
|
+
/** Import STEP geometry and available XCAF component colors through one kernel seam. */
|
|
57
|
+
export async function importedShapeFromStepWithKernel(cad, fileName, stepText) {
|
|
58
|
+
if (!stepText.trim())
|
|
59
|
+
throw new LocalizedError("errors.step.readFailed", { detail: "the file was empty" });
|
|
60
|
+
let imported;
|
|
61
|
+
try {
|
|
62
|
+
imported = cad.importStep(stepText);
|
|
63
|
+
}
|
|
64
|
+
catch (error) {
|
|
65
|
+
throw new LocalizedError("errors.step.readFailed", { detail: messageOf(error) });
|
|
66
|
+
}
|
|
67
|
+
const solids = cad.getSubShapes(imported, "solid");
|
|
68
|
+
let mesh;
|
|
69
|
+
try {
|
|
70
|
+
mesh = cad.meshShape(imported, IMPORT_TESSELLATION);
|
|
71
|
+
}
|
|
72
|
+
catch (error) {
|
|
73
|
+
throw new LocalizedError("errors.step.meshFailed", { detail: messageOf(error) });
|
|
74
|
+
}
|
|
75
|
+
if (mesh.triangleCount < 1)
|
|
76
|
+
throw new LocalizedError("errors.step.noSolidGeometry");
|
|
77
|
+
const positions = [];
|
|
78
|
+
const normals = [];
|
|
79
|
+
const faceGroups = [];
|
|
80
|
+
const faces = cad.getSubShapes(imported, "face");
|
|
81
|
+
const faceIndexByHash = new Map(faces.map((face, index) => [cad.hashCode(face, 2_147_483_647), index]));
|
|
82
|
+
for (let group = 0; group + 2 < (mesh.faceGroups?.length ?? 0); group += 3) {
|
|
83
|
+
const start = mesh.faceGroups[group];
|
|
84
|
+
const count = mesh.faceGroups[group + 1];
|
|
85
|
+
const index = faceIndexByHash.get(mesh.faceGroups[group + 2]);
|
|
86
|
+
// `meshShape` reports triangle ranges in index units, while the stored
|
|
87
|
+
// non-indexed mesh and viewport face groups count triangles.
|
|
88
|
+
if (index !== undefined)
|
|
89
|
+
faceGroups.push(start / 3, count / 3, index);
|
|
90
|
+
}
|
|
91
|
+
const hasNormals = mesh.normals.length === mesh.positions.length;
|
|
92
|
+
for (let index = 0; index < mesh.indices.length; index += 1) {
|
|
93
|
+
const vertex = mesh.indices[index] * 3;
|
|
94
|
+
positions.push(mesh.positions[vertex], mesh.positions[vertex + 2], -mesh.positions[vertex + 1]);
|
|
95
|
+
if (hasNormals)
|
|
96
|
+
normals.push(mesh.normals[vertex], mesh.normals[vertex + 2], -mesh.normals[vertex + 1]);
|
|
97
|
+
}
|
|
98
|
+
const shape = importedShapeFromTriangleSoup(fileName, positions, hasNormals ? normals : undefined, "step");
|
|
99
|
+
if (shape.importedMesh && faceGroups.length)
|
|
100
|
+
shape.importedMesh.faceGroups = faceGroups;
|
|
101
|
+
const colorsByFace = componentColorsByFace(cad, stepText, solids, faces);
|
|
102
|
+
if (colorsByFace.size) {
|
|
103
|
+
shape.faceIds = faces.map((_, index) => `face_${createLocalId(`${shape.id}-face-${index}`)}`);
|
|
104
|
+
shape.faceColors = Object.fromEntries([...colorsByFace].map(([index, color]) => [shape.faceIds[index], color]));
|
|
105
|
+
}
|
|
106
|
+
const bounds = meshBounds(positions);
|
|
107
|
+
const worthKeepingExact = solids.length <= EXACT_GEOMETRY_LIMITS.solids
|
|
108
|
+
&& new TextEncoder().encode(stepText).byteLength <= EXACT_GEOMETRY_LIMITS.sourceBytes;
|
|
109
|
+
if (shape.importedMesh && bounds && worthKeepingExact) {
|
|
110
|
+
try {
|
|
111
|
+
const turned = cad.rotate(imported, { point: { x: 0, y: 0, z: 0 }, direction: { x: 1, y: 0, z: 0 } }, -Math.PI / 2);
|
|
112
|
+
const centred = cad.translate(turned, -(bounds.minX + bounds.maxX) / 2, -bounds.minY, -(bounds.minZ + bounds.maxZ) / 2);
|
|
113
|
+
shape.importedMesh.brepStep = cad.exportStep(centred);
|
|
114
|
+
}
|
|
115
|
+
catch {
|
|
116
|
+
// Exact geometry is optional; the correctly framed mesh remains importable.
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
return { shape, solids: solids.length, triangles: mesh.triangleCount, exactGeometry: Boolean(shape.importedMesh?.brepStep) };
|
|
120
|
+
}
|
|
121
|
+
//# sourceMappingURL=stepImportCommon.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stepImportCommon.js","sourceRoot":"","sources":["../src/stepImportCommon.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAC9C,OAAO,EAAE,cAAc,EAAE,MAAM,kCAAkC,CAAC;AAClE,OAAO,EAAE,6BAA6B,EAAE,MAAM,gBAAgB,CAAC;AAC/D,OAAO,EAAE,qBAAqB,EAAE,YAAY,EAAE,MAAM,4BA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AAG,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;YACxH,KAAK,CAAC,YAAY,CAAC,QAAQ,GAAG,GAAG,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC;QACxD,CAAC;QAAC,MAAM,CAAC;YACP,4EAA4E;QAC9E,CAAC;IACH,CAAC;IAED,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,SAAS,EAAE,IAAI,CAAC,aAAa,EAAE,aAAa,EAAE,OAAO,CAAC,KAAK,CAAC,YAAY,EAAE,QAAQ,CAAC,EAAE,CAAC;AAC/H,CAAC"}
|
|
@@ -1,15 +1,4 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
export type StepImportSummary
|
|
3
|
-
shape: WorkplaneShape;
|
|
4
|
-
/** How many separate solids the file held, which is what makes it an assembly. */
|
|
5
|
-
solids: number;
|
|
6
|
-
triangles: number;
|
|
7
|
-
/**
|
|
8
|
-
* Whether the exact B-rep was kept alongside the mesh. False for an assembly
|
|
9
|
-
* past `EXACT_GEOMETRY_LIMITS`, so a caller can say why a later fillet or
|
|
10
|
-
* STEP export of this shape works from triangles.
|
|
11
|
-
*/
|
|
12
|
-
exactGeometry: boolean;
|
|
13
|
-
};
|
|
1
|
+
import type { StepImportSummary } from "./stepImportCommon.js";
|
|
2
|
+
export type { StepImportSummary } from "./stepImportCommon.js";
|
|
14
3
|
export declare function importedShapeFromStepOnKernel(fileName: string, stepText: string): Promise<StepImportSummary>;
|
|
15
4
|
//# sourceMappingURL=stepImportKernel.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stepImportKernel.d.ts","sourceRoot":"","sources":["../src/stepImportKernel.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"stepImportKernel.d.ts","sourceRoot":"","sources":["../src/stepImportKernel.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAE/D,YAAY,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAE/D,wBAAgB,6BAA6B,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAE5G"}
|
package/dist/stepImportKernel.js
CHANGED
|
@@ -1,145 +1,7 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* STEP import on the OCCT kernel directly, rather than through brepjs.
|
|
3
|
-
*
|
|
4
|
-
* `stepImport.ts` reads a STEP file with brepjs: `importSTEP`, `rotate`, then
|
|
5
|
-
* `mesh`. That works for the files anyone had tried, and fails on a real
|
|
6
|
-
* assembly. Measured on a 74 MB FreeCAD AP214 export of a Raspberry Pi 5 board
|
|
7
|
-
* (45,689 faces, 2,689 solids):
|
|
8
|
-
*
|
|
9
|
-
* | step | brepjs | this kernel path |
|
|
10
|
-
* | ---------------------------------- | ----------------------------- | ---------------- |
|
|
11
|
-
* | read the file | ok, 20.5s | ok, 20.5s |
|
|
12
|
-
* | rotate Z-up to Y-up | ok, 1.6s | ok |
|
|
13
|
-
* | tessellate | **memory access out of bounds** | ok, 5.0s, 674,520 triangles |
|
|
14
|
-
*
|
|
15
|
-
* It is not a memory ceiling: the module grows to 4 GB, the failure is the same
|
|
16
|
-
* under Node as in a browser, and coarsening `linearDeflection` from 0.1 to 1.0
|
|
17
|
-
* does not move it -- a heap that was merely full would have. The kernel's own
|
|
18
|
-
* `tessellate` meshes the identical shape, whole or per solid. So the mesher
|
|
19
|
-
* above the kernel is the thing that cannot do it, and this module skips it.
|
|
20
|
-
*
|
|
21
|
-
* Node-only, because it uses the server kernel. The browser keeps the brepjs
|
|
22
|
-
* path, which is all a static export has.
|
|
23
|
-
*/
|
|
24
|
-
import { LocalizedError } from "./support/i18n/LocalizedError.js";
|
|
1
|
+
/** STEP import on the OCCT kernel directly, rather than through brepjs. */
|
|
25
2
|
import { withCadKernel } from "./serverCadKernel.js";
|
|
26
|
-
import {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
/**
|
|
30
|
-
* Above this, the exact geometry is left out and only the mesh is kept.
|
|
31
|
-
*
|
|
32
|
-
* Re-exporting the model to STEP text is what fills `importedMesh.brepStep`,
|
|
33
|
-
* and the text is far larger than the file it came from: the 74 MB Raspberry Pi
|
|
34
|
-
* assembly comes back as **202.7 MB**. That string would be stored in the
|
|
35
|
-
* project, which autosave writes on every edit -- a measured 48 ms for a small
|
|
36
|
-
* project, and that is before adding 200 MB of text to it. An assembly this
|
|
37
|
-
* size is imported as a mesh, and keeping the exact geometry for one is a
|
|
38
|
-
* separate piece of work: the right answer is to store the *source* text with
|
|
39
|
-
* the frame it was placed into, rather than a fresh export, and that changes
|
|
40
|
-
* what the consumers of `brepStep` have to understand.
|
|
41
|
-
*/
|
|
42
|
-
const EXACT_GEOMETRY_LIMITS = { solids: 200, sourceBytes: 8 * 1024 * 1024 };
|
|
43
|
-
const X_AXIS = { point: { x: 0, y: 0, z: 0 }, direction: { x: 1, y: 0, z: 0 } };
|
|
44
|
-
export async function importedShapeFromStepOnKernel(fileName, stepText) {
|
|
45
|
-
if (!stepText.trim())
|
|
46
|
-
throw new LocalizedError("errors.step.readFailed", { detail: "the file was empty" });
|
|
47
|
-
return withCadKernel(async (cad) => {
|
|
48
|
-
let imported;
|
|
49
|
-
try {
|
|
50
|
-
imported = cad.importStep(stepText);
|
|
51
|
-
}
|
|
52
|
-
catch (error) {
|
|
53
|
-
throw new LocalizedError("errors.step.readFailed", { detail: messageOf(error) });
|
|
54
|
-
}
|
|
55
|
-
const solids = cad.getSubShapes(imported, "solid");
|
|
56
|
-
// Tessellated *before* any kernel transform, and deliberately. `rotate`
|
|
57
|
-
// copies the whole B-rep, so rotating first means two 74 MB models in the
|
|
58
|
-
// kernel at once -- and that is what exhausts it: the same file tessellates
|
|
59
|
-
// in 5s when nothing has been copied, and dies with "memory access out of
|
|
60
|
-
// bounds" when the rotation went first. Both the old brepjs path and my own
|
|
61
|
-
// first attempt rotated first, and both failed here.
|
|
62
|
-
let mesh;
|
|
63
|
-
try {
|
|
64
|
-
mesh = cad.meshShape(imported, IMPORT_TESSELLATION);
|
|
65
|
-
}
|
|
66
|
-
catch (error) {
|
|
67
|
-
throw new LocalizedError("errors.step.meshFailed", { detail: messageOf(error) });
|
|
68
|
-
}
|
|
69
|
-
if (mesh.triangleCount < 1)
|
|
70
|
-
throw new LocalizedError("errors.step.noSolidGeometry");
|
|
71
|
-
// The kernel hands back indexed triangles; the shape builder takes a soup.
|
|
72
|
-
// STEP/CAD space is Z-up and SketchForge is Y-up, so the triangles are
|
|
73
|
-
// turned here rather than the solid: (x, y, z) -> (x, z, -y) is exactly the
|
|
74
|
-
// -90 degrees about X that the solid would have been given, and it costs a
|
|
75
|
-
// multiply-free swap per vertex instead of a copy of the model.
|
|
76
|
-
const positions = [];
|
|
77
|
-
const normals = [];
|
|
78
|
-
const faceGroups = [];
|
|
79
|
-
const hasNormals = mesh.normals.length === mesh.positions.length;
|
|
80
|
-
const faceIndexByHash = new Map(cad.getSubShapes(imported, "face").map((face, index) => [cad.hashCode(face, 2_147_483_647), index]));
|
|
81
|
-
for (let group = 0; group + 2 < (mesh.faceGroups?.length ?? 0); group += 3) {
|
|
82
|
-
const start = mesh.faceGroups[group];
|
|
83
|
-
const count = mesh.faceGroups[group + 1];
|
|
84
|
-
const index = faceIndexByHash.get(mesh.faceGroups[group + 2]);
|
|
85
|
-
if (index !== undefined)
|
|
86
|
-
faceGroups.push(start, count, index);
|
|
87
|
-
}
|
|
88
|
-
for (let index = 0; index < mesh.indices.length; index += 1) {
|
|
89
|
-
const vertex = mesh.indices[index] * 3;
|
|
90
|
-
positions.push(mesh.positions[vertex], mesh.positions[vertex + 2], -mesh.positions[vertex + 1]);
|
|
91
|
-
if (hasNormals)
|
|
92
|
-
normals.push(mesh.normals[vertex], mesh.normals[vertex + 2], -mesh.normals[vertex + 1]);
|
|
93
|
-
}
|
|
94
|
-
const shape = importedShapeFromTriangleSoup(fileName, positions, hasNormals ? normals : undefined, "step");
|
|
95
|
-
if (shape.importedMesh && faceGroups.length)
|
|
96
|
-
shape.importedMesh.faceGroups = faceGroups;
|
|
97
|
-
// `importedShapeFromTriangleSoup` recentres the mesh on x/z and rests it on
|
|
98
|
-
// y = 0, so the stored exact geometry has to move by the same offset or the
|
|
99
|
-
// two frames disagree -- the mismatch #53 found and fixed for treatments.
|
|
100
|
-
const bounds = meshBounds(positions);
|
|
101
|
-
const worthKeepingExact = solids.length <= EXACT_GEOMETRY_LIMITS.solids
|
|
102
|
-
&& stepText.length <= EXACT_GEOMETRY_LIMITS.sourceBytes;
|
|
103
|
-
if (shape.importedMesh && bounds && worthKeepingExact) {
|
|
104
|
-
try {
|
|
105
|
-
// Only now is the solid turned and moved, to match the frame the mesh
|
|
106
|
-
// was recentred into. This is the step that can exhaust the kernel on a
|
|
107
|
-
// large assembly, so it comes last and its failure costs only the exact
|
|
108
|
-
// geometry: a project that cannot be imported at all is worse than one
|
|
109
|
-
// whose imported mesh has no B-rep behind it.
|
|
110
|
-
const turned = cad.rotate(imported, X_AXIS, -Math.PI / 2);
|
|
111
|
-
const centred = cad.translate(turned, -(bounds.minX + bounds.maxX) / 2, -bounds.minY, -(bounds.minZ + bounds.maxZ) / 2);
|
|
112
|
-
shape.importedMesh.brepStep = cad.exportStep(centred);
|
|
113
|
-
}
|
|
114
|
-
catch {
|
|
115
|
-
// Left without exact geometry on purpose. The mesh is still correct.
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
return {
|
|
119
|
-
shape,
|
|
120
|
-
solids: solids.length,
|
|
121
|
-
triangles: mesh.triangleCount,
|
|
122
|
-
exactGeometry: Boolean(shape.importedMesh?.brepStep),
|
|
123
|
-
};
|
|
124
|
-
});
|
|
125
|
-
}
|
|
126
|
-
function messageOf(error) {
|
|
127
|
-
if (error instanceof Error && error.message)
|
|
128
|
-
return error.message;
|
|
129
|
-
const described = String(error);
|
|
130
|
-
return described === "[object WebAssembly.Exception]" ? "the CAD kernel refused the file" : described;
|
|
131
|
-
}
|
|
132
|
-
function meshBounds(positions) {
|
|
133
|
-
if (positions.length < 9)
|
|
134
|
-
return null;
|
|
135
|
-
let minX = Infinity, minY = Infinity, minZ = Infinity, maxX = -Infinity, maxZ = -Infinity;
|
|
136
|
-
for (let index = 0; index < positions.length; index += 3) {
|
|
137
|
-
minX = Math.min(minX, positions[index]);
|
|
138
|
-
maxX = Math.max(maxX, positions[index]);
|
|
139
|
-
minY = Math.min(minY, positions[index + 1]);
|
|
140
|
-
minZ = Math.min(minZ, positions[index + 2]);
|
|
141
|
-
maxZ = Math.max(maxZ, positions[index + 2]);
|
|
142
|
-
}
|
|
143
|
-
return { minX, minY, minZ, maxX, maxZ };
|
|
3
|
+
import { importedShapeFromStepWithKernel } from "./stepImportCommon.js";
|
|
4
|
+
export function importedShapeFromStepOnKernel(fileName, stepText) {
|
|
5
|
+
return withCadKernel((cad) => importedShapeFromStepWithKernel(cad, fileName, stepText));
|
|
144
6
|
}
|
|
145
7
|
//# sourceMappingURL=stepImportKernel.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stepImportKernel.js","sourceRoot":"","sources":["../src/stepImportKernel.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"stepImportKernel.js","sourceRoot":"","sources":["../src/stepImportKernel.ts"],"names":[],"mappings":"AAAA,2EAA2E;AAC3E,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,+BAA+B,EAAE,MAAM,uBAAuB,CAAC;AAKxE,MAAM,UAAU,6BAA6B,CAAC,QAAgB,EAAE,QAAgB;IAC9E,OAAO,aAAa,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,+BAA+B,CAAC,GAAG,EAAE,QAAQ,EAAE,QAAQ,CAAC,CAAC,CAAC;AAC1F,CAAC"}
|
|
@@ -77,6 +77,15 @@ export type CadModifierWorkerRequest = {
|
|
|
77
77
|
profile: SketchProfile;
|
|
78
78
|
height: number;
|
|
79
79
|
angle: number;
|
|
80
|
+
} | {
|
|
81
|
+
type: "draft-face";
|
|
82
|
+
requestId: number;
|
|
83
|
+
brep: string;
|
|
84
|
+
faceIds: string[];
|
|
85
|
+
faceId: string;
|
|
86
|
+
angle: number;
|
|
87
|
+
pullDirection: "x" | "y" | "z";
|
|
88
|
+
brepTransform?: number[];
|
|
80
89
|
} | {
|
|
81
90
|
type: "dispose";
|
|
82
91
|
requestId: number;
|
|
@@ -115,6 +124,16 @@ export type CadModifierWorkerResponse = {
|
|
|
115
124
|
indices: Uint32Array;
|
|
116
125
|
triangleCount: number;
|
|
117
126
|
brep: string;
|
|
127
|
+
} | {
|
|
128
|
+
type: "draft-face";
|
|
129
|
+
requestId: number;
|
|
130
|
+
positions: Float32Array;
|
|
131
|
+
normals: Float32Array;
|
|
132
|
+
indices: Uint32Array;
|
|
133
|
+
triangleCount: number;
|
|
134
|
+
faceCount: number;
|
|
135
|
+
volume: number;
|
|
136
|
+
brep: string;
|
|
118
137
|
} | {
|
|
119
138
|
type: "disposed";
|
|
120
139
|
requestId: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cadModifierTypes.d.ts","sourceRoot":"","sources":["../../src/support/cadModifierTypes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,0BAA0B,CAAC;AACtE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AACjE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAEhE,MAAM,MAAM,eAAe,GAAG,SAAS,GAAG,QAAQ,CAAC;AAEnD,MAAM,MAAM,eAAe,GAAG;IAC5B,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,CAAC,EAAE,MAAM,CAAC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AM,CAAC;IAAC,YAAY,CAAC,EAAE,OAAO,CAAA;CAAE,GAAG,qBAAqB,CAAC,CAAC"}
|
|
@@ -1268,6 +1268,9 @@
|
|
|
1268
1268
|
"notPrepared": "Prepare an object before previewing the modifier",
|
|
1269
1269
|
"noEdgesSelected": "Select at least one highlighted edge",
|
|
1270
1270
|
"invalidResult": "The chosen size creates invalid or overlapping edge geometry",
|
|
1271
|
+
"draftFaceInvalid": "The face draft could not produce a valid solid. Check the face index and draft angle.",
|
|
1272
|
+
"draftFaceNotFound": "The selected face is no longer available on this solid. Choose another face index.",
|
|
1273
|
+
"draftFaceIncompatible": "The selected face cannot be drafted along that local CAD axis at this angle. Try another axis, face, or angle.",
|
|
1271
1274
|
"filletTooLarge": "The selected edges cannot be filleted together at this size. Reduce the size or select fewer connected edges.",
|
|
1272
1275
|
"chamferTooLarge": "The selected edges cannot be chamfered together at this size. Reduce the size or select fewer connected edges.",
|
|
1273
1276
|
"edgeTreatmentFailed": "The CAD kernel could not complete this edge treatment",
|
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
export type Brep = typeof import("brepjs");
|
|
2
2
|
export type BrepSolid = ReturnType<Brep["box"]>;
|
|
3
|
+
type OcctKernel = import("occt-wasm").OcctKernel;
|
|
4
|
+
/** Load the registered OCCT instance for operations that need its XCAF API. */
|
|
5
|
+
export declare function loadOcctKernel(): Promise<OcctKernel>;
|
|
3
6
|
export declare function loadBrepWithOcct(): Promise<Brep>;
|
|
7
|
+
export {};
|
|
4
8
|
//# sourceMappingURL=brepKernel.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"brepKernel.d.ts","sourceRoot":"","sources":["../../../src/support/lib/brepKernel.ts"],"names":[],"mappings":"AAcA,MAAM,MAAM,IAAI,GAAG,cAAc,QAAQ,CAAC,CAAC;AAC3C,MAAM,MAAM,SAAS,GAAG,UAAU,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"brepKernel.d.ts","sourceRoot":"","sources":["../../../src/support/lib/brepKernel.ts"],"names":[],"mappings":"AAcA,MAAM,MAAM,IAAI,GAAG,cAAc,QAAQ,CAAC,CAAC;AAC3C,MAAM,MAAM,SAAS,GAAG,UAAU,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC;AAEhD,KAAK,UAAU,GAAG,OAAO,WAAW,EAAE,UAAU,CAAC;AAKjD,+EAA+E;AAC/E,wBAAsB,cAAc,IAAI,OAAO,CAAC,UAAU,CAAC,CAoB1D;AAED,wBAAsB,gBAAgB,IAAI,OAAO,CAAC,IAAI,CAAC,CAatD"}
|
|
@@ -12,17 +12,13 @@ const OCCT_NODE_INDEX_URL = "occt-wasm/dist/occt-wasm.js";
|
|
|
12
12
|
const OCCT_PACKAGE_URL = "occt-wasm";
|
|
13
13
|
const OCCT_WASM_URL = "/occt/occt-wasm.wasm";
|
|
14
14
|
let brepReady = null;
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
brepReady ??= (async () => {
|
|
20
|
-
const brep = await import("brepjs");
|
|
15
|
+
let kernelReady = null;
|
|
16
|
+
/** Load the registered OCCT instance for operations that need its XCAF API. */
|
|
17
|
+
export async function loadOcctKernel() {
|
|
18
|
+
kernelReady ??= (async () => {
|
|
21
19
|
if (typeof window !== "undefined") {
|
|
22
20
|
const occt = (await import(/* webpackIgnore: true */ OCCT_INDEX_URL));
|
|
23
|
-
|
|
24
|
-
brep.registerKernel("occt-wasm", brep.OcctWasmAdapter.fromKernel(kernel));
|
|
25
|
-
return brep;
|
|
21
|
+
return occt.OcctKernel.init({ wasm: OCCT_WASM_URL });
|
|
26
22
|
}
|
|
27
23
|
const [{ OcctKernel: KernelConstructor }, { default: createModule }] = await Promise.all([
|
|
28
24
|
import(/* webpackIgnore: true */ OCCT_PACKAGE_URL),
|
|
@@ -30,7 +26,23 @@ export async function loadBrepWithOcct() {
|
|
|
30
26
|
]);
|
|
31
27
|
const module = await createModule();
|
|
32
28
|
const Kernel = KernelConstructor;
|
|
33
|
-
|
|
29
|
+
return new Kernel(module);
|
|
30
|
+
})();
|
|
31
|
+
try {
|
|
32
|
+
return await kernelReady;
|
|
33
|
+
}
|
|
34
|
+
catch (error) {
|
|
35
|
+
kernelReady = null;
|
|
36
|
+
throw error;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
export async function loadBrepWithOcct() {
|
|
40
|
+
// Cache the in-flight/resolved load, but drop a rejected attempt so a transient
|
|
41
|
+
// failure (e.g. a blip fetching the 22 MB wasm) can be retried on the next call
|
|
42
|
+
// instead of poisoning STEP for the rest of the session.
|
|
43
|
+
brepReady ??= (async () => {
|
|
44
|
+
const [brep, kernel] = await Promise.all([import("brepjs"), loadOcctKernel()]);
|
|
45
|
+
brep.registerKernel("occt-wasm", brep.OcctWasmAdapter.fromKernel(kernel));
|
|
34
46
|
return brep;
|
|
35
47
|
})().catch((error) => {
|
|
36
48
|
brepReady = null;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"brepKernel.js","sourceRoot":"","sources":["../../../src/support/lib/brepKernel.ts"],"names":[],"mappings":"AAAA,+EAA+E;AAC/E,8EAA8E;AAC9E,kEAAkE;AAClE,EAAE;AACF,gFAAgF;AAChF,+EAA+E;AAC/E,8EAA8E;AAC9E,6EAA6E;AAC7E,sEAAsE;AACtE,MAAM,cAAc,GAAW,gBAAgB,CAAC;AAChD,MAAM,mBAAmB,GAAW,6BAA6B,CAAC;AAClE,MAAM,gBAAgB,GAAW,WAAW,CAAC;AAC7C,MAAM,aAAa,GAAG,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"brepKernel.js","sourceRoot":"","sources":["../../../src/support/lib/brepKernel.ts"],"names":[],"mappings":"AAAA,+EAA+E;AAC/E,8EAA8E;AAC9E,kEAAkE;AAClE,EAAE;AACF,gFAAgF;AAChF,+EAA+E;AAC/E,8EAA8E;AAC9E,6EAA6E;AAC7E,sEAAsE;AAC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AK,CAAC,KAAK,IAAI,EAAE;QACxB,MAAM,CAAC,IAAI,EAAE,MAAM,CAAC,GAAG,MAAM,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC,EAAE,cAAc,EAAE,CAAC,CAAC,CAAC;QAC/E,IAAI,CAAC,cAAc,CAAC,WAAW,EAAE,IAAI,CAAC,eAAe,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC;QAC1E,OAAO,IAAI,CAAC;IACd,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE;QACnB,SAAS,GAAG,IAAI,CAAC;QACjB,MAAM,KAAK,CAAC;IACd,CAAC,CAAC,CAAC;IACH,OAAO,SAAS,CAAC;AACnB,CAAC"}
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
{
|
|
2
|
+
"settings": [
|
|
3
|
+
{
|
|
4
|
+
"name": "SKETCHFORGE_PORT",
|
|
5
|
+
"default": "3000",
|
|
6
|
+
"required": false,
|
|
7
|
+
"validation": "Compose host port published to container port 3000; configure this when host port 3000 is already occupied.",
|
|
8
|
+
"sensitive": false,
|
|
9
|
+
"subsystem": "Docker port publishing"
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
"name": "SKETCHFORGE_SHARED_PROJECTS_VOLUME",
|
|
13
|
+
"default": "sketchforge-shared-projects",
|
|
14
|
+
"required": false,
|
|
15
|
+
"validation": "Docker named volume or bind mount source for /data/projects, where shared project files are stored.",
|
|
16
|
+
"sensitive": false,
|
|
17
|
+
"subsystem": "Docker shared project persistence"
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
"name": "SKETCHFORGE_PROJECTS_VOLUME",
|
|
21
|
+
"default": "sketchforge-projects",
|
|
22
|
+
"required": false,
|
|
23
|
+
"validation": "Docker named volume or bind mount source for /data/my-projects. Used when SKETCHFORGE_PROJECTS_DIR points to that path.",
|
|
24
|
+
"sensitive": false,
|
|
25
|
+
"subsystem": "Docker server project persistence"
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
"name": "PORT",
|
|
29
|
+
"default": "3000",
|
|
30
|
+
"required": false,
|
|
31
|
+
"validation": "Integer from 1 through 65535; invalid values fall back to 3000.",
|
|
32
|
+
"sensitive": false,
|
|
33
|
+
"subsystem": "Docker server listener"
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
"name": "HOSTNAME",
|
|
37
|
+
"default": "0.0.0.0 in the Docker launcher; otherwise supplied by the hosting runtime.",
|
|
38
|
+
"required": false,
|
|
39
|
+
"validation": "Passed to the Next.js server as its bind host.",
|
|
40
|
+
"sensitive": false,
|
|
41
|
+
"subsystem": "Docker server listener"
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
"name": "SKETCHFORGE_LEGACY_PORT",
|
|
45
|
+
"default": "80",
|
|
46
|
+
"required": false,
|
|
47
|
+
"validation": "Integer from 1 through 65535; invalid values fall back to 80. Set equal to PORT to disable the compatibility proxy.",
|
|
48
|
+
"sensitive": false,
|
|
49
|
+
"subsystem": "Docker compatibility proxy"
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
"name": "SKETCHFORGE_PROJECTS_DIR",
|
|
53
|
+
"default": "Unset; browser-local storage is used.",
|
|
54
|
+
"required": false,
|
|
55
|
+
"validation": "Filesystem path writable by the server. Enables server-backed project storage and must be paired with SKETCHFORGE_API_TOKEN to enable the scripting REST API.",
|
|
56
|
+
"sensitive": false,
|
|
57
|
+
"subsystem": "Server project storage and REST API"
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
"name": "SKETCHFORGE_API_TOKEN",
|
|
61
|
+
"default": "Unset; REST API authorization is disabled.",
|
|
62
|
+
"required": false,
|
|
63
|
+
"validation": "Non-empty bearer token. Configure a high-entropy secret; never expose it to browsers or logs. Used with SKETCHFORGE_PROJECTS_DIR.",
|
|
64
|
+
"sensitive": true,
|
|
65
|
+
"subsystem": "REST API authentication"
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
"name": "SKETCHFORGE_SHARED_PROJECTS_DIR",
|
|
69
|
+
"default": "/data/projects in the Docker image and compose examples.",
|
|
70
|
+
"required": false,
|
|
71
|
+
"validation": "Filesystem path writable by the server; mount persistent storage at this path to retain shared projects across container replacement.",
|
|
72
|
+
"sensitive": false,
|
|
73
|
+
"subsystem": "Shared project files"
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
"name": "SKETCHFORGE_APP_VERSION",
|
|
77
|
+
"default": "Detected from the installed package or project metadata.",
|
|
78
|
+
"required": false,
|
|
79
|
+
"validation": "Semantic version; invalid values are ignored.",
|
|
80
|
+
"sensitive": false,
|
|
81
|
+
"subsystem": "Update status"
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
"name": "SKETCHFORGE_UPDATE_MANIFEST_URL",
|
|
85
|
+
"default": "Official SketchForge release manifest URL.",
|
|
86
|
+
"required": false,
|
|
87
|
+
"validation": "HTTP or HTTPS URL returning JSON with a semantic-version `version` field.",
|
|
88
|
+
"sensitive": false,
|
|
89
|
+
"subsystem": "Update status"
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
"name": "SKETCHFORGE_UPDATE_GUIDE_URL",
|
|
93
|
+
"default": "Official SketchForge update guide URL.",
|
|
94
|
+
"required": false,
|
|
95
|
+
"validation": "URL shown to users as the update guide.",
|
|
96
|
+
"sensitive": false,
|
|
97
|
+
"subsystem": "Update status"
|
|
98
|
+
},
|
|
99
|
+
{
|
|
100
|
+
"name": "SKETCHFORGE_UPDATE_TRIGGER_URL",
|
|
101
|
+
"default": "Unset; server-triggered updates are unavailable.",
|
|
102
|
+
"required": false,
|
|
103
|
+
"validation": "HTTP or HTTPS URL for the configured update trigger endpoint.",
|
|
104
|
+
"sensitive": false,
|
|
105
|
+
"subsystem": "Server-triggered updates"
|
|
106
|
+
},
|
|
107
|
+
{
|
|
108
|
+
"name": "SKETCHFORGE_UPDATE_ADMIN_KEY",
|
|
109
|
+
"default": "Unset; server-triggered updates are unavailable.",
|
|
110
|
+
"required": false,
|
|
111
|
+
"validation": "Secret expected by the update trigger service. Required with SKETCHFORGE_UPDATE_TRIGGER_URL.",
|
|
112
|
+
"sensitive": true,
|
|
113
|
+
"subsystem": "Server-triggered updates"
|
|
114
|
+
},
|
|
115
|
+
{
|
|
116
|
+
"name": "SKETCHFORGE_UPDATE_TRIGGER_TOKEN",
|
|
117
|
+
"default": "Unset; trigger requests are unauthorized.",
|
|
118
|
+
"required": false,
|
|
119
|
+
"validation": "Secret bearer token sent to the configured trigger endpoint. Required when that endpoint enforces a trigger token.",
|
|
120
|
+
"sensitive": true,
|
|
121
|
+
"subsystem": "Server-triggered updates"
|
|
122
|
+
}
|
|
123
|
+
]
|
|
124
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import configuration from "./operator-configuration.json";
|
|
2
|
+
export declare const OPERATOR_CONFIGURATION: {
|
|
3
|
+
settings: {
|
|
4
|
+
name: string;
|
|
5
|
+
default: string;
|
|
6
|
+
required: boolean;
|
|
7
|
+
validation: string;
|
|
8
|
+
sensitive: boolean;
|
|
9
|
+
subsystem: string;
|
|
10
|
+
}[];
|
|
11
|
+
};
|
|
12
|
+
export type OperatorSettingName = (typeof configuration.settings)[number]["name"];
|
|
13
|
+
export declare function operatorSettingName(name: OperatorSettingName): string;
|
|
14
|
+
//# sourceMappingURL=operatorConfiguration.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"operatorConfiguration.d.ts","sourceRoot":"","sources":["../../../src/support/lib/operatorConfiguration.ts"],"names":[],"mappings":"AAAA,OAAO,aAAa,MAAM,+BAA+B,CAAuB;AAEhF,eAAO,MAAM,sBAAsB;;;;;;;;;CAAgB,CAAC;AACpD,MAAM,MAAM,mBAAmB,GAAG,CAAC,OAAO,aAAa,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,CAAC,MAAM,CAAC,CAAC;AAElF,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,mBAAmB,UAE5D"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"operatorConfiguration.js","sourceRoot":"","sources":["../../../src/support/lib/operatorConfiguration.ts"],"names":[],"mappings":"AAAA,OAAO,aAAa,MAAM,+BAA+B,CAAC,OAAO,IAAI,EAAE,MAAM,EAAE,CAAC;AAEhF,MAAM,CAAC,MAAM,sBAAsB,GAAG,aAAa,CAAC;AAGpD,MAAM,UAAU,mBAAmB,CAAC,IAAyB;IAC3D,OAAO,IAAI,CAAC;AACd,CAAC"}
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
* the dashboard agree on names, limits, and staleness) or a `fetch` against
|
|
12
12
|
* `/api/projects`.
|
|
13
13
|
*/
|
|
14
|
-
export declare const SERVER_PROJECTS_ENV
|
|
14
|
+
export declare const SERVER_PROJECTS_ENV: string;
|
|
15
15
|
export declare const SERVER_PROJECTS_ENDPOINT = "/api/projects";
|
|
16
16
|
/** A project id as the server will spell it on disk, or null when it cannot be one. */
|
|
17
17
|
export declare function safeServerProjectId(projectId: string): string | null;
|