partforge 0.33.0 → 0.35.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/package.json
CHANGED
|
@@ -34,7 +34,7 @@ const MESH = { preview: { tolerance: 0.1, angularTolerance: 0.5 }, print: { tole
|
|
|
34
34
|
|
|
35
35
|
export function createOcctKernel(replicad) {
|
|
36
36
|
const { makeCylinder, makeBox, makeCircle, makeHelix, assembleWire, genericSweep,
|
|
37
|
-
makeCompound, loft, draw, exportSTEP, measureVolume, makeSphere, makeLine, Plane
|
|
37
|
+
makeCompound, loft, draw, exportSTEP, measureVolume, makeSphere, makeLine, Plane } = replicad;
|
|
38
38
|
|
|
39
39
|
// Fillet/chamfer/shell failure recovery (skip-on-failure, chamfer binary search) —
|
|
40
40
|
// see occt-repair.js for the policies and why they differ per op.
|
|
@@ -449,28 +449,7 @@ export function createOcctKernel(replicad) {
|
|
|
449
449
|
});
|
|
450
450
|
},
|
|
451
451
|
shape2d,
|
|
452
|
-
toSTEP: (named) => {
|
|
453
|
-
// Blob-free STEP: replicad's exportSTEP writes the STEP text to OCCT's
|
|
454
|
-
// virtual FS, reads it, and wraps it in a Blob. Safari's sandbox worker
|
|
455
|
-
// cannot read a Blob, so we intercept the FS read to capture the raw
|
|
456
|
-
// Uint8Array before it is wrapped, and return an ArrayBuffer instead. The
|
|
457
|
-
// interception is synchronous (exportSTEP is sync) and restored in finally.
|
|
458
|
-
const oc = getOC();
|
|
459
|
-
const realRead = oc.FS.readFile.bind(oc.FS);
|
|
460
|
-
let captured = null;
|
|
461
|
-
oc.FS.readFile = (path, ...rest) => {
|
|
462
|
-
const bytes = realRead(path, ...rest);
|
|
463
|
-
if (typeof path === "string" && path.toLowerCase().endsWith(".step")) captured = bytes;
|
|
464
|
-
return bytes;
|
|
465
|
-
};
|
|
466
|
-
try {
|
|
467
|
-
exportSTEP(named.map(({ name, solid }) => ({ name, shape: solid._mat()._s })));
|
|
468
|
-
} finally {
|
|
469
|
-
oc.FS.readFile = realRead;
|
|
470
|
-
}
|
|
471
|
-
if (!captured) throw new Error("STEP export produced no bytes");
|
|
472
|
-
return Promise.resolve(captured.buffer.slice(captured.byteOffset, captured.byteOffset + captured.byteLength));
|
|
473
|
-
},
|
|
452
|
+
toSTEP: (named) => exportSTEP(named.map(({ name, solid }) => ({ name, shape: solid._mat()._s }))).arrayBuffer(),
|
|
474
453
|
beginSubPart: (name) => cache.begin(name),
|
|
475
454
|
endSubPart: () => cache.end(),
|
|
476
455
|
sweepCache: () => cache.sweep(),
|