brepjs 20.13.0 → 20.13.1
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/2d.cjs +6 -6
- package/dist/2d.js +6 -6
- package/dist/{adjacencyFns-BXzEHSC5.cjs → adjacencyFns-BA9xrrmS.cjs} +3 -3
- package/dist/{adjacencyFns-BYjzMejn.js → adjacencyFns-C4Tui11_.js} +3 -3
- package/dist/{blueprint-464KGkzc.cjs → blueprint-D193PMxX.cjs} +5 -5
- package/dist/{blueprint-D-4-uTkr.js → blueprint-DH0H9OWv.js} +5 -5
- package/dist/{blueprintFns-CE5RdX-E.js → blueprintFns-Bfiqbmtc.js} +2 -2
- package/dist/{blueprintFns-BdyFiuiC.cjs → blueprintFns-DYIKTIvJ.cjs} +2 -2
- package/dist/{blueprintSketcher-C4XHzqTw.cjs → blueprintSketcher-B1UrnhFt.cjs} +3 -3
- package/dist/{blueprintSketcher-CQ9LxcIl.js → blueprintSketcher-RA8ti2Xp.js} +3 -3
- package/dist/{boolean2D-DwJvQ4p_.js → boolean2D-CCKUmway.js} +4 -4
- package/dist/{boolean2D-CKE32vHV.cjs → boolean2D-XIehGONX.cjs} +4 -4
- package/dist/{booleanFns-CsTz48A3.js → booleanFns-CyxmW1pL.js} +5 -5
- package/dist/{booleanFns-MkzdfjDv.cjs → booleanFns-zRlNDHQY.cjs} +5 -5
- package/dist/brepjs.cjs +30 -30
- package/dist/brepjs.js +30 -30
- package/dist/{cameraFns-vHpapIZG.cjs → cameraFns-BDjt94fY.cjs} +3 -3
- package/dist/{cameraFns-BDl_D28X.js → cameraFns-CtpBKmwD.js} +3 -3
- package/dist/core.cjs +2 -2
- package/dist/core.js +2 -2
- package/dist/{cornerFinder-Dyk5sKEN.js → cornerFinder-CIryesVI.js} +1 -1
- package/dist/{cornerFinder-adDN0_C4.cjs → cornerFinder-DWN1Vkea.cjs} +1 -1
- package/dist/{curveFns-HtjEh2W-.cjs → curveFns-0vAErrs9.cjs} +1 -1
- package/dist/{curveFns-RjNVzxNc.js → curveFns-b_C6tBeU.js} +1 -1
- package/dist/{drawFns-stc8-Gma.js → drawFns--_Bd7ONO.js} +12 -12
- package/dist/{drawFns-B5gZtD_P.cjs → drawFns-vcRf5KKV.cjs} +12 -12
- package/dist/{faceFns-C7wBHMPv.cjs → faceFns-DzNcnzS5.cjs} +2 -2
- package/dist/{faceFns-DaPoCzd-.js → faceFns-WtnWpVQl.js} +2 -2
- package/dist/{healingFns-C3Wq_hN3.js → healingFns-B82dNj9P.js} +7 -7
- package/dist/{healingFns-zYCbT8vR.cjs → healingFns-D26gj7M5.cjs} +7 -7
- package/dist/{helpers-BdtYVyP5.cjs → helpers-BO5NktbN.cjs} +6 -6
- package/dist/{helpers-CDzSlBi_.js → helpers-C5I0ZqYC.js} +6 -6
- package/dist/{importFns-CotbQ9l7.cjs → importFns-Ceb2VgcK.cjs} +34 -20
- package/dist/{importFns-DR7Adv-W.js → importFns-sxpO2z86.js} +34 -20
- package/dist/io/importFns.d.ts +12 -5
- package/dist/io.cjs +2 -2
- package/dist/io.js +2 -2
- package/dist/kernel/brepkit/igesMerge.d.ts +13 -0
- package/dist/kernel/brepkit/stepMerge.d.ts +14 -0
- package/dist/kernel/occtWasm/occtWasmAdapter.cjs +1 -1
- package/dist/kernel/occtWasm/occtWasmAdapter.js +1 -1
- package/dist/{loftFns-C9k9UAKh.cjs → loftFns-KXrP3aat.cjs} +1 -1
- package/dist/{loftFns-Cbnrz3p8.js → loftFns-Y-aBF_f7.js} +1 -1
- package/dist/{measureFns-DivR02Xb.js → measureFns-B0PhQ5dY.js} +3 -3
- package/dist/{measureFns-Bi62maOJ.cjs → measureFns-C8UjdHpB.cjs} +3 -3
- package/dist/measurement.cjs +2 -2
- package/dist/measurement.js +2 -2
- package/dist/{meshFns-CcuY52tt.js → meshFns-BazHDlpY.js} +4 -4
- package/dist/{meshFns-8MTf0Lo_.cjs → meshFns-BnkXZ0Xm.cjs} +4 -4
- package/dist/{occtWasmAdapter-BNOuP9DA.cjs → occtWasmAdapter-4YnvqZOW.cjs} +72 -3
- package/dist/{occtWasmAdapter-1k4udeb3.js → occtWasmAdapter-CGsnjMOe.js} +72 -3
- package/dist/operations.cjs +2 -2
- package/dist/operations.js +2 -2
- package/dist/{primitiveFns-BifV4IGL.cjs → primitiveFns-BM709SMs.cjs} +5 -5
- package/dist/{primitiveFns-uDvN1FH6.js → primitiveFns-BZALpT35.js} +5 -5
- package/dist/{principalBoxFns-DjxE8Rym.cjs → principalBoxFns-C_hSxRc7.cjs} +3 -3
- package/dist/{principalBoxFns-ez0xXLyK.js → principalBoxFns-DLOoxmZB.js} +3 -3
- package/dist/projection.cjs +1 -1
- package/dist/projection.js +1 -1
- package/dist/query.cjs +2 -2
- package/dist/query.js +2 -2
- package/dist/{refResolveFns-CuaYXFya.js → refResolveFns-BA1ES0sL.js} +6 -6
- package/dist/{refResolveFns-CTkAPUwM.cjs → refResolveFns-BkSLmvyY.cjs} +6 -6
- package/dist/{shapeFns-Rmgd4x9I.cjs → shapeFns-Bgql2_E6.cjs} +2 -2
- package/dist/{shapeFns-DgpWLKra.js → shapeFns-CSWOXGx9.js} +2 -2
- package/dist/shapeRef.cjs +1 -1
- package/dist/shapeRef.js +1 -1
- package/dist/{shapeTypes-BjitsJRQ.cjs → shapeTypes-BFfnNmzj.cjs} +214 -23
- package/dist/{shapeTypes-DbPghQD3.js → shapeTypes-C7hqbMwl.js} +214 -23
- package/dist/sketching.cjs +3 -3
- package/dist/sketching.js +3 -3
- package/dist/{solidBuilders-BUI_fGzR.js → solidBuilders-B01dFnd7.js} +3 -3
- package/dist/{solidBuilders-Bs2NA3xl.cjs → solidBuilders-CWw3yasa.cjs} +3 -3
- package/dist/{surfaceBuilders-CO_DKhWA.js → surfaceBuilders-Cn7GIsyR.js} +3 -3
- package/dist/{surfaceBuilders-Cn1mkQ3j.cjs → surfaceBuilders-DL7UTpW2.cjs} +3 -3
- package/dist/text.cjs +2 -2
- package/dist/text.js +2 -2
- package/dist/{textBlueprints-CT0Kbw1f.js → textBlueprints-B7gDC-aP.js} +8 -8
- package/dist/{textBlueprints-P_D0KUVx.cjs → textBlueprints-dOnCv38X.cjs} +8 -8
- package/dist/{textMetrics-CXKdzefS.js → textMetrics-BFzj8Zvn.js} +1 -1
- package/dist/{textMetrics-CVyX8GyL.cjs → textMetrics-Cqc0xzHC.cjs} +1 -1
- package/dist/{threadFns-BV4HLdPE.cjs → threadFns-DwTPnV_1.cjs} +7 -7
- package/dist/{threadFns-COs6jmaf.js → threadFns-M8pqF4TW.js} +7 -7
- package/dist/topology.cjs +9 -9
- package/dist/topology.js +9 -9
- package/dist/{topologyQueryFns-s0LddGkF.cjs → topologyQueryFns-95FptXtu.cjs} +1 -1
- package/dist/{topologyQueryFns-J2ae_Gvc.js → topologyQueryFns-C3-_9dFM.js} +1 -1
- package/dist/{validityTypes-BVZ0lSNi.cjs → validityTypes--tgDeAF8.cjs} +1 -1
- package/dist/{validityTypes-CD_Xz0vZ.js → validityTypes-C6qOP241.js} +1 -1
- package/package.json +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
const require_shapeTypes = require("./shapeTypes-
|
|
1
|
+
const require_shapeTypes = require("./shapeTypes-BFfnNmzj.cjs");
|
|
2
2
|
const require_errors = require("./errors-O_blYTWT.cjs");
|
|
3
|
-
const require_topologyQueryFns = require("./topologyQueryFns-
|
|
3
|
+
const require_topologyQueryFns = require("./topologyQueryFns-95FptXtu.cjs");
|
|
4
4
|
const require_types = require("./types-CjF9Rofr.cjs");
|
|
5
5
|
// src/topology/cast.ts
|
|
6
6
|
var TOPO_ENUM = {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { O as getOrQueryType, i as castShape, q as getKernel } from "./shapeTypes-
|
|
1
|
+
import { O as getOrQueryType, i as castShape, q as getKernel } from "./shapeTypes-C7hqbMwl.js";
|
|
2
2
|
import { E as ok, P as unwrap, g as err, l as typeCastError } from "./errors-BTccWbtE.js";
|
|
3
|
-
import { a as getCachedSurfaceType } from "./topologyQueryFns-
|
|
3
|
+
import { a as getCachedSurfaceType } from "./topologyQueryFns-C3-_9dFM.js";
|
|
4
4
|
import { r as toVec3 } from "./types-CKXsIm9-.js";
|
|
5
5
|
// src/topology/cast.ts
|
|
6
6
|
var TOPO_ENUM = {
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { C as isSolid, D as getShapeKind, T as isWire, Y as getKernelCapabilities, h as disposeResultShape, i as castShape, m as disposeDowncastSource, n as castResultShape, q as getKernel, r as castResultShapeWithKnownType, x as isShape3D, y as isFace } from "./shapeTypes-
|
|
2
|
-
import { j as isUnsupportedKernelOperationError, n as faultyEdgeIndexesOf } from "./occtWasmAdapter-
|
|
1
|
+
import { C as isSolid, D as getShapeKind, T as isWire, Y as getKernelCapabilities, h as disposeResultShape, i as castShape, m as disposeDowncastSource, n as castResultShape, q as getKernel, r as castResultShapeWithKnownType, x as isShape3D, y as isFace } from "./shapeTypes-C7hqbMwl.js";
|
|
2
|
+
import { j as isUnsupportedKernelOperationError, n as faultyEdgeIndexesOf } from "./occtWasmAdapter-CGsnjMOe.js";
|
|
3
3
|
import { E as ok, b as isErr, d as validationError, g as err, i as kernelError, l as typeCastError, t as BrepErrorCode, u as unsupportedError, x as isOk } from "./errors-BTccWbtE.js";
|
|
4
|
-
import { C as subShapeHashes, O as getSuggestionForCode, c as getFaces, i as getCachedIsValid, m as invalidateShapeCache, p as getWires, s as getEdges } from "./topologyQueryFns-
|
|
4
|
+
import { C as subShapeHashes, O as getSuggestionForCode, c as getFaces, i as getCachedIsValid, m as invalidateShapeCache, p as getWires, s as getEdges } from "./topologyQueryFns-C3-_9dFM.js";
|
|
5
5
|
import { n as HASH_CODE_MAX } from "./constants-iraOnb2p.js";
|
|
6
|
-
import { y as downcast } from "./faceFns-
|
|
7
|
-
import { a as fuse, f as collectInputFaceHashes, h as propagateMetadataByHash, i as cutAll, m as propagateAllMetadata, n as copyAsBooleanResult, o as fuseAll, r as cut } from "./booleanFns-
|
|
8
|
-
import { a as isSameShape } from "./shapeFns-
|
|
6
|
+
import { y as downcast } from "./faceFns-WtnWpVQl.js";
|
|
7
|
+
import { a as fuse, f as collectInputFaceHashes, h as propagateMetadataByHash, i as cutAll, m as propagateAllMetadata, n as copyAsBooleanResult, o as fuseAll, r as cut } from "./booleanFns-CyxmW1pL.js";
|
|
8
|
+
import { a as isSameShape } from "./shapeFns-CSWOXGx9.js";
|
|
9
9
|
import { t as firstOrThrow } from "./arrayAccess-BpgouNir.js";
|
|
10
|
-
import { i as facesOfEdge } from "./adjacencyFns-
|
|
10
|
+
import { i as facesOfEdge } from "./adjacencyFns-C4Tui11_.js";
|
|
11
11
|
// src/topology/threeHelpers.ts
|
|
12
12
|
/**
|
|
13
13
|
* Convert a ShapeMesh into BufferGeometry-compatible typed arrays.
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
const require_shapeTypes = require("./shapeTypes-
|
|
2
|
-
const require_occtWasmAdapter = require("./occtWasmAdapter-
|
|
1
|
+
const require_shapeTypes = require("./shapeTypes-BFfnNmzj.cjs");
|
|
2
|
+
const require_occtWasmAdapter = require("./occtWasmAdapter-4YnvqZOW.cjs");
|
|
3
3
|
const require_errors = require("./errors-O_blYTWT.cjs");
|
|
4
|
-
const require_topologyQueryFns = require("./topologyQueryFns-
|
|
4
|
+
const require_topologyQueryFns = require("./topologyQueryFns-95FptXtu.cjs");
|
|
5
5
|
const require_constants = require("./constants-oee0S_x6.cjs");
|
|
6
|
-
const require_faceFns = require("./faceFns-
|
|
7
|
-
const require_booleanFns = require("./booleanFns-
|
|
8
|
-
const require_shapeFns = require("./shapeFns-
|
|
6
|
+
const require_faceFns = require("./faceFns-DzNcnzS5.cjs");
|
|
7
|
+
const require_booleanFns = require("./booleanFns-zRlNDHQY.cjs");
|
|
8
|
+
const require_shapeFns = require("./shapeFns-Bgql2_E6.cjs");
|
|
9
9
|
const require_arrayAccess = require("./arrayAccess-DpJYARwv.cjs");
|
|
10
|
-
const require_adjacencyFns = require("./adjacencyFns-
|
|
10
|
+
const require_adjacencyFns = require("./adjacencyFns-BA9xrrmS.cjs");
|
|
11
11
|
// src/topology/threeHelpers.ts
|
|
12
12
|
/**
|
|
13
13
|
* Convert a ShapeMesh into BufferGeometry-compatible typed arrays.
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
const require_shapeTypes = require("./shapeTypes-
|
|
1
|
+
const require_shapeTypes = require("./shapeTypes-BFfnNmzj.cjs");
|
|
2
2
|
const require_errors = require("./errors-O_blYTWT.cjs");
|
|
3
|
-
const require_topologyQueryFns = require("./topologyQueryFns-
|
|
3
|
+
const require_topologyQueryFns = require("./topologyQueryFns-95FptXtu.cjs");
|
|
4
4
|
const require_constants = require("./constants-oee0S_x6.cjs");
|
|
5
5
|
const require_vecOps = require("./vecOps-CrGEPPQM.cjs");
|
|
6
|
-
const require_faceFns = require("./faceFns-
|
|
7
|
-
const require_shapeFns = require("./shapeFns-
|
|
8
|
-
const require_curveFns = require("./curveFns-
|
|
9
|
-
const require_measureFns = require("./measureFns-
|
|
6
|
+
const require_faceFns = require("./faceFns-DzNcnzS5.cjs");
|
|
7
|
+
const require_shapeFns = require("./shapeFns-Bgql2_E6.cjs");
|
|
8
|
+
const require_curveFns = require("./curveFns-0vAErrs9.cjs");
|
|
9
|
+
const require_measureFns = require("./measureFns-C8UjdHpB.cjs");
|
|
10
10
|
// src/utils/vec2d.ts
|
|
11
11
|
/** Precision for curve intersection and parameter operations. */
|
|
12
12
|
var PRECISION_INTERSECTION = 1e-9;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { q as getKernel, y as isFace } from "./shapeTypes-
|
|
1
|
+
import { q as getKernel, y as isFace } from "./shapeTypes-C7hqbMwl.js";
|
|
2
2
|
import { E as ok, g as err, o as queryError, x as isOk } from "./errors-BTccWbtE.js";
|
|
3
|
-
import { c as getFaces, f as getVertices, p as getWires, s as getEdges } from "./topologyQueryFns-
|
|
3
|
+
import { c as getFaces, f as getVertices, p as getWires, s as getEdges } from "./topologyQueryFns-C3-_9dFM.js";
|
|
4
4
|
import { t as DEG2RAD } from "./constants-iraOnb2p.js";
|
|
5
5
|
import { a as vecDot, d as vecNormalize } from "./vecOps-S-m9H_fe.js";
|
|
6
|
-
import { l as normalAt, s as getSurfaceType } from "./faceFns-
|
|
7
|
-
import { a as isSameShape, n as getHashCode } from "./shapeFns-
|
|
8
|
-
import { f as getCurveType, i as curveIsClosed, o as curveLength } from "./curveFns-
|
|
9
|
-
import { n as measureArea } from "./measureFns-
|
|
6
|
+
import { l as normalAt, s as getSurfaceType } from "./faceFns-WtnWpVQl.js";
|
|
7
|
+
import { a as isSameShape, n as getHashCode } from "./shapeFns-CSWOXGx9.js";
|
|
8
|
+
import { f as getCurveType, i as curveIsClosed, o as curveLength } from "./curveFns-b_C6tBeU.js";
|
|
9
|
+
import { n as measureArea } from "./measureFns-B0PhQ5dY.js";
|
|
10
10
|
// src/utils/vec2d.ts
|
|
11
11
|
/** Precision for curve intersection and parameter operations. */
|
|
12
12
|
var PRECISION_INTERSECTION = 1e-9;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
const require_shapeTypes = require("./shapeTypes-
|
|
1
|
+
const require_shapeTypes = require("./shapeTypes-BFfnNmzj.cjs");
|
|
2
2
|
const require_bug = require("./bug-CBcpIPuf.cjs");
|
|
3
3
|
const require_errors = require("./errors-O_blYTWT.cjs");
|
|
4
|
-
const require_topologyQueryFns = require("./topologyQueryFns-
|
|
4
|
+
const require_topologyQueryFns = require("./topologyQueryFns-95FptXtu.cjs");
|
|
5
5
|
const require_constants = require("./constants-oee0S_x6.cjs");
|
|
6
|
-
const require_solidBuilders = require("./solidBuilders-
|
|
7
|
-
const require_meshFns = require("./meshFns-
|
|
6
|
+
const require_solidBuilders = require("./solidBuilders-CWw3yasa.cjs");
|
|
7
|
+
const require_meshFns = require("./meshFns-BnkXZ0Xm.cjs");
|
|
8
8
|
const require_arrayAccess = require("./arrayAccess-DpJYARwv.cjs");
|
|
9
|
-
const require_blueprint = require("./blueprint-
|
|
9
|
+
const require_blueprint = require("./blueprint-D193PMxX.cjs");
|
|
10
10
|
// src/io/objExportFns.ts
|
|
11
11
|
/** Read a vec3 from a typed array at the given vertex index. */
|
|
12
12
|
function vec3At(arr, i) {
|
|
@@ -1999,15 +1999,33 @@ function binaryPositions(data) {
|
|
|
1999
1999
|
* Supports STEP, STL, and IGES formats.
|
|
2000
2000
|
*/
|
|
2001
2001
|
/**
|
|
2002
|
+
* The whole model a reader returned: its one shape as is, or a compound of
|
|
2003
|
+
* every top-level shape (brepkit returns a solid per part, the OCCT kernels
|
|
2004
|
+
* one shape for the file).
|
|
2005
|
+
*/
|
|
2006
|
+
function wholeModel(shapes) {
|
|
2007
|
+
const [only] = shapes;
|
|
2008
|
+
if (shapes.length === 1 && only !== void 0) return require_shapeTypes.castResultShape(only);
|
|
2009
|
+
const parts = shapes.map((s) => require_shapeTypes.castResultShape(s));
|
|
2010
|
+
try {
|
|
2011
|
+
return require_solidBuilders.makeCompound(parts);
|
|
2012
|
+
} finally {
|
|
2013
|
+
for (const part of parts) part[Symbol.dispose]();
|
|
2014
|
+
}
|
|
2015
|
+
}
|
|
2016
|
+
/**
|
|
2002
2017
|
* Import a STEP file from a Blob.
|
|
2003
2018
|
*
|
|
2004
|
-
*
|
|
2005
|
-
*
|
|
2019
|
+
* Reads every part in the file. A file holding one solid comes back as that
|
|
2020
|
+
* solid; an assembly or a file with several parts comes back as a `Compound`
|
|
2021
|
+
* of every part, each at the placement the file gives it.
|
|
2006
2022
|
*
|
|
2007
2023
|
* @param blob - A Blob or File containing STEP data (.step / .stp).
|
|
2008
|
-
* @returns A `Result` wrapping the imported shape
|
|
2024
|
+
* @returns A `Result` wrapping the imported shape (a `Compound` when the file
|
|
2025
|
+
* holds several parts), or an error if parsing fails.
|
|
2009
2026
|
*
|
|
2010
|
-
* @remarks
|
|
2027
|
+
* @remarks Part names and colors in the file are not read. The temporary file
|
|
2028
|
+
* on the WASM FS is cleaned up automatically.
|
|
2011
2029
|
*
|
|
2012
2030
|
* @example
|
|
2013
2031
|
* ```ts
|
|
@@ -2020,11 +2038,7 @@ async function importSTEP(blob) {
|
|
|
2020
2038
|
const data = await blob.arrayBuffer();
|
|
2021
2039
|
const shapes = require_shapeTypes.getKernel().importSTEP(data);
|
|
2022
2040
|
if (shapes.length === 0) return require_errors.err(require_errors.ioError("STEP_IMPORT_FAILED", "STEP file contains no valid geometry"));
|
|
2023
|
-
|
|
2024
|
-
const extra = shapes[i];
|
|
2025
|
-
if (extra) require_shapeTypes.getKernel().dispose(extra);
|
|
2026
|
-
}
|
|
2027
|
-
return require_errors.ok(require_shapeTypes.castResultShape(shapes[0]));
|
|
2041
|
+
return require_errors.ok(wholeModel(shapes));
|
|
2028
2042
|
} catch (e) {
|
|
2029
2043
|
return require_errors.err(require_errors.ioError("STEP_IMPORT_FAILED", "Failed to load STEP file", e));
|
|
2030
2044
|
}
|
|
@@ -2081,8 +2095,12 @@ async function importSTL(blob) {
|
|
|
2081
2095
|
/**
|
|
2082
2096
|
* Import an IGES file from a Blob.
|
|
2083
2097
|
*
|
|
2098
|
+
* Reads every part in the file: one solid comes back as that solid, several as
|
|
2099
|
+
* a `Compound` of every part.
|
|
2100
|
+
*
|
|
2084
2101
|
* @param blob - A Blob or File containing IGES data (.iges / .igs).
|
|
2085
|
-
* @returns A `Result` wrapping the imported shape
|
|
2102
|
+
* @returns A `Result` wrapping the imported shape (a `Compound` when the file
|
|
2103
|
+
* holds several parts), or an error if parsing fails.
|
|
2086
2104
|
*
|
|
2087
2105
|
* @remarks The temporary file on the WASM FS is cleaned up automatically. The
|
|
2088
2106
|
* default occt-wasm kernel is built without an IGES translator, so there this
|
|
@@ -2098,11 +2116,7 @@ async function importIGES(blob) {
|
|
|
2098
2116
|
const data = await blob.arrayBuffer();
|
|
2099
2117
|
const shapes = require_shapeTypes.getKernel().importIGES(data);
|
|
2100
2118
|
if (shapes.length === 0) return require_errors.err(require_errors.ioError("IGES_IMPORT_FAILED", "IGES file contains no valid geometry"));
|
|
2101
|
-
|
|
2102
|
-
const extra = shapes[i];
|
|
2103
|
-
if (extra) require_shapeTypes.getKernel().dispose(extra);
|
|
2104
|
-
}
|
|
2105
|
-
return require_errors.ok(require_shapeTypes.castResultShape(shapes[0]));
|
|
2119
|
+
return require_errors.ok(wholeModel(shapes));
|
|
2106
2120
|
} catch (e) {
|
|
2107
2121
|
return require_errors.err(require_meshFns.igesUnsupportedError("importIGES", e) ?? require_errors.ioError("IGES_IMPORT_FAILED", "Failed to load IGES file", e));
|
|
2108
2122
|
}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { C as isSolid, G as _usingCtx, S as isShell, _ as isCompound, n as castResultShape, q as getKernel } from "./shapeTypes-
|
|
1
|
+
import { C as isSolid, G as _usingCtx, S as isShell, _ as isCompound, n as castResultShape, q as getKernel } from "./shapeTypes-C7hqbMwl.js";
|
|
2
2
|
import { i as wasmIndex, r as vec3At$1 } from "./bug-ClMTAJhe.js";
|
|
3
3
|
import { E as ok, g as err, r as ioError, t as BrepErrorCode } from "./errors-BTccWbtE.js";
|
|
4
|
-
import { S as subShapeCount, c as getFaces, u as getShells } from "./topologyQueryFns-
|
|
4
|
+
import { S as subShapeCount, c as getFaces, u as getShells } from "./topologyQueryFns-C3-_9dFM.js";
|
|
5
5
|
import { n as HASH_CODE_MAX } from "./constants-iraOnb2p.js";
|
|
6
|
-
import { t as makeCompound } from "./solidBuilders-
|
|
7
|
-
import { u as igesUnsupportedError } from "./meshFns-
|
|
6
|
+
import { t as makeCompound } from "./solidBuilders-B01dFnd7.js";
|
|
7
|
+
import { u as igesUnsupportedError } from "./meshFns-BazHDlpY.js";
|
|
8
8
|
import { n as getAtOrThrow } from "./arrayAccess-BpgouNir.js";
|
|
9
|
-
import { c as make2dBezierCurve, h as make2dThreePointArc, p as make2dSegmentCurve, t as Blueprint } from "./blueprint-
|
|
9
|
+
import { c as make2dBezierCurve, h as make2dThreePointArc, p as make2dSegmentCurve, t as Blueprint } from "./blueprint-DH0H9OWv.js";
|
|
10
10
|
// src/io/objExportFns.ts
|
|
11
11
|
/** Read a vec3 from a typed array at the given vertex index. */
|
|
12
12
|
function vec3At(arr, i) {
|
|
@@ -1999,15 +1999,33 @@ function binaryPositions(data) {
|
|
|
1999
1999
|
* Supports STEP, STL, and IGES formats.
|
|
2000
2000
|
*/
|
|
2001
2001
|
/**
|
|
2002
|
+
* The whole model a reader returned: its one shape as is, or a compound of
|
|
2003
|
+
* every top-level shape (brepkit returns a solid per part, the OCCT kernels
|
|
2004
|
+
* one shape for the file).
|
|
2005
|
+
*/
|
|
2006
|
+
function wholeModel(shapes) {
|
|
2007
|
+
const [only] = shapes;
|
|
2008
|
+
if (shapes.length === 1 && only !== void 0) return castResultShape(only);
|
|
2009
|
+
const parts = shapes.map((s) => castResultShape(s));
|
|
2010
|
+
try {
|
|
2011
|
+
return makeCompound(parts);
|
|
2012
|
+
} finally {
|
|
2013
|
+
for (const part of parts) part[Symbol.dispose]();
|
|
2014
|
+
}
|
|
2015
|
+
}
|
|
2016
|
+
/**
|
|
2002
2017
|
* Import a STEP file from a Blob.
|
|
2003
2018
|
*
|
|
2004
|
-
*
|
|
2005
|
-
*
|
|
2019
|
+
* Reads every part in the file. A file holding one solid comes back as that
|
|
2020
|
+
* solid; an assembly or a file with several parts comes back as a `Compound`
|
|
2021
|
+
* of every part, each at the placement the file gives it.
|
|
2006
2022
|
*
|
|
2007
2023
|
* @param blob - A Blob or File containing STEP data (.step / .stp).
|
|
2008
|
-
* @returns A `Result` wrapping the imported shape
|
|
2024
|
+
* @returns A `Result` wrapping the imported shape (a `Compound` when the file
|
|
2025
|
+
* holds several parts), or an error if parsing fails.
|
|
2009
2026
|
*
|
|
2010
|
-
* @remarks
|
|
2027
|
+
* @remarks Part names and colors in the file are not read. The temporary file
|
|
2028
|
+
* on the WASM FS is cleaned up automatically.
|
|
2011
2029
|
*
|
|
2012
2030
|
* @example
|
|
2013
2031
|
* ```ts
|
|
@@ -2020,11 +2038,7 @@ async function importSTEP(blob) {
|
|
|
2020
2038
|
const data = await blob.arrayBuffer();
|
|
2021
2039
|
const shapes = getKernel().importSTEP(data);
|
|
2022
2040
|
if (shapes.length === 0) return err(ioError("STEP_IMPORT_FAILED", "STEP file contains no valid geometry"));
|
|
2023
|
-
|
|
2024
|
-
const extra = shapes[i];
|
|
2025
|
-
if (extra) getKernel().dispose(extra);
|
|
2026
|
-
}
|
|
2027
|
-
return ok(castResultShape(shapes[0]));
|
|
2041
|
+
return ok(wholeModel(shapes));
|
|
2028
2042
|
} catch (e) {
|
|
2029
2043
|
return err(ioError("STEP_IMPORT_FAILED", "Failed to load STEP file", e));
|
|
2030
2044
|
}
|
|
@@ -2081,8 +2095,12 @@ async function importSTL(blob) {
|
|
|
2081
2095
|
/**
|
|
2082
2096
|
* Import an IGES file from a Blob.
|
|
2083
2097
|
*
|
|
2098
|
+
* Reads every part in the file: one solid comes back as that solid, several as
|
|
2099
|
+
* a `Compound` of every part.
|
|
2100
|
+
*
|
|
2084
2101
|
* @param blob - A Blob or File containing IGES data (.iges / .igs).
|
|
2085
|
-
* @returns A `Result` wrapping the imported shape
|
|
2102
|
+
* @returns A `Result` wrapping the imported shape (a `Compound` when the file
|
|
2103
|
+
* holds several parts), or an error if parsing fails.
|
|
2086
2104
|
*
|
|
2087
2105
|
* @remarks The temporary file on the WASM FS is cleaned up automatically. The
|
|
2088
2106
|
* default occt-wasm kernel is built without an IGES translator, so there this
|
|
@@ -2098,11 +2116,7 @@ async function importIGES(blob) {
|
|
|
2098
2116
|
const data = await blob.arrayBuffer();
|
|
2099
2117
|
const shapes = getKernel().importIGES(data);
|
|
2100
2118
|
if (shapes.length === 0) return err(ioError("IGES_IMPORT_FAILED", "IGES file contains no valid geometry"));
|
|
2101
|
-
|
|
2102
|
-
const extra = shapes[i];
|
|
2103
|
-
if (extra) getKernel().dispose(extra);
|
|
2104
|
-
}
|
|
2105
|
-
return ok(castResultShape(shapes[0]));
|
|
2119
|
+
return ok(wholeModel(shapes));
|
|
2106
2120
|
} catch (e) {
|
|
2107
2121
|
return err(igesUnsupportedError("importIGES", e) ?? ioError("IGES_IMPORT_FAILED", "Failed to load IGES file", e));
|
|
2108
2122
|
}
|
package/dist/io/importFns.d.ts
CHANGED
|
@@ -3,13 +3,16 @@ import { Result } from '../core/result.js';
|
|
|
3
3
|
/**
|
|
4
4
|
* Import a STEP file from a Blob.
|
|
5
5
|
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
6
|
+
* Reads every part in the file. A file holding one solid comes back as that
|
|
7
|
+
* solid; an assembly or a file with several parts comes back as a `Compound`
|
|
8
|
+
* of every part, each at the placement the file gives it.
|
|
8
9
|
*
|
|
9
10
|
* @param blob - A Blob or File containing STEP data (.step / .stp).
|
|
10
|
-
* @returns A `Result` wrapping the imported shape
|
|
11
|
+
* @returns A `Result` wrapping the imported shape (a `Compound` when the file
|
|
12
|
+
* holds several parts), or an error if parsing fails.
|
|
11
13
|
*
|
|
12
|
-
* @remarks
|
|
14
|
+
* @remarks Part names and colors in the file are not read. The temporary file
|
|
15
|
+
* on the WASM FS is cleaned up automatically.
|
|
13
16
|
*
|
|
14
17
|
* @example
|
|
15
18
|
* ```ts
|
|
@@ -48,8 +51,12 @@ export declare function importSTL(blob: Blob): Promise<Result<UnknownDimShape>>;
|
|
|
48
51
|
/**
|
|
49
52
|
* Import an IGES file from a Blob.
|
|
50
53
|
*
|
|
54
|
+
* Reads every part in the file: one solid comes back as that solid, several as
|
|
55
|
+
* a `Compound` of every part.
|
|
56
|
+
*
|
|
51
57
|
* @param blob - A Blob or File containing IGES data (.iges / .igs).
|
|
52
|
-
* @returns A `Result` wrapping the imported shape
|
|
58
|
+
* @returns A `Result` wrapping the imported shape (a `Compound` when the file
|
|
59
|
+
* holds several parts), or an error if parsing fails.
|
|
53
60
|
*
|
|
54
61
|
* @remarks The temporary file on the WASM FS is cleaned up automatically. The
|
|
55
62
|
* default occt-wasm kernel is built without an IGES translator, so there this
|
package/dist/io.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_meshFns = require("./meshFns-
|
|
3
|
-
const require_importFns = require("./importFns-
|
|
2
|
+
const require_meshFns = require("./meshFns-BnkXZ0Xm.cjs");
|
|
3
|
+
const require_importFns = require("./importFns-Ceb2VgcK.cjs");
|
|
4
4
|
exports.blueprintToDXF = require_importFns.blueprintToDXF;
|
|
5
5
|
exports.exportDXF = require_importFns.exportDXF;
|
|
6
6
|
exports.exportGlb = require_importFns.exportGlb;
|
package/dist/io.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { n as exportSTEP, r as exportSTL, t as exportIGES } from "./meshFns-
|
|
2
|
-
import { a as exportSTEPConfigured, c as exportThreeMF, d as exportGlb, f as exportGltf, l as blueprintToDXF, n as importSTEP, o as importSVG, p as exportOBJ, r as importSTL, s as importSVGPathD, t as importIGES, u as exportDXF } from "./importFns-
|
|
1
|
+
import { n as exportSTEP, r as exportSTL, t as exportIGES } from "./meshFns-BazHDlpY.js";
|
|
2
|
+
import { a as exportSTEPConfigured, c as exportThreeMF, d as exportGlb, f as exportGltf, l as blueprintToDXF, n as importSTEP, o as importSVG, p as exportOBJ, r as importSTL, s as importSVGPathD, t as importIGES, u as exportDXF } from "./importFns-sxpO2z86.js";
|
|
3
3
|
export { blueprintToDXF, exportDXF, exportGlb, exportGltf, exportIGES, exportOBJ, exportSTEP, exportSTEPConfigured, exportSTL, exportThreeMF, importIGES, importSTEP, importSTL, importSVG, importSVGPathD };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Merge single-solid brepkit IGES documents into one.
|
|
3
|
+
*
|
|
4
|
+
* brepkit-wasm's `exportIges` takes one solid, but an IGES file holds one
|
|
5
|
+
* document. brepkit's writer emits only standalone entities that point at no
|
|
6
|
+
* other entity, so the merge appends each later document's directory and
|
|
7
|
+
* parameter entries, renumbering only the fixed-column fields that number or
|
|
8
|
+
* link them, and keeps the first document's start and global sections.
|
|
9
|
+
*
|
|
10
|
+
* @module
|
|
11
|
+
*/
|
|
12
|
+
/** One IGES document holding the entities of every brepkit IGES document in `docs`. */
|
|
13
|
+
export declare function mergeIgesDocuments(docs: readonly string[]): string;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Merge single-solid brepkit STEP documents into one.
|
|
3
|
+
*
|
|
4
|
+
* brepkit-wasm's `exportStep` takes one solid, but a STEP file holds one
|
|
5
|
+
* document. brepkit's own multi-solid writer lists every solid in a single
|
|
6
|
+
* ADVANCED_BREP_SHAPE_REPRESENTATION under one product, so the merge rebuilds
|
|
7
|
+
* that layout: each later document contributes only the entities its solids
|
|
8
|
+
* reach, renumbered past the ids already used, and its solids join the first
|
|
9
|
+
* document's representation.
|
|
10
|
+
*
|
|
11
|
+
* @module
|
|
12
|
+
*/
|
|
13
|
+
/** One STEP document holding the solids of every brepkit STEP document in `docs`. */
|
|
14
|
+
export declare function mergeStepDocuments(docs: readonly string[]): string;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_occtWasmAdapter = require("../../occtWasmAdapter-
|
|
2
|
+
const require_occtWasmAdapter = require("../../occtWasmAdapter-4YnvqZOW.cjs");
|
|
3
3
|
exports.OcctWasmAdapter = require_occtWasmAdapter.OcctWasmAdapter;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { t as OcctWasmAdapter } from "../../occtWasmAdapter-
|
|
1
|
+
export { t as OcctWasmAdapter } from "../../occtWasmAdapter-CGsnjMOe.js";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const require_shapeTypes = require("./shapeTypes-
|
|
1
|
+
const require_shapeTypes = require("./shapeTypes-BFfnNmzj.cjs");
|
|
2
2
|
const require_errors = require("./errors-O_blYTWT.cjs");
|
|
3
3
|
const require_types = require("./types-CjF9Rofr.cjs");
|
|
4
4
|
const require_vecOps = require("./vecOps-CrGEPPQM.cjs");
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { G as _usingCtx, T as isWire, h as disposeResultShape, n as castResultShape, q as getKernel, x as isShape3D } from "./shapeTypes-
|
|
1
|
+
import { G as _usingCtx, T as isWire, h as disposeResultShape, n as castResultShape, q as getKernel, x as isShape3D } from "./shapeTypes-C7hqbMwl.js";
|
|
2
2
|
import { E as ok, b as isErr, d as validationError, g as err, i as kernelError, l as typeCastError, t as BrepErrorCode } from "./errors-BTccWbtE.js";
|
|
3
3
|
import { r as toVec3 } from "./types-CKXsIm9-.js";
|
|
4
4
|
import { c as vecLength, t as vecAdd } from "./vecOps-S-m9H_fe.js";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { q as getKernel } from "./shapeTypes-
|
|
1
|
+
import { q as getKernel } from "./shapeTypes-C7hqbMwl.js";
|
|
2
2
|
import { E as ok, d as validationError, g as err, t as BrepErrorCode } from "./errors-BTccWbtE.js";
|
|
3
|
-
import { E as kernelCallRaw } from "./topologyQueryFns-
|
|
4
|
-
import { m as uvBounds } from "./faceFns-
|
|
3
|
+
import { E as kernelCallRaw } from "./topologyQueryFns-C3-_9dFM.js";
|
|
4
|
+
import { m as uvBounds } from "./faceFns-WtnWpVQl.js";
|
|
5
5
|
// src/measurement/measureCache.ts
|
|
6
6
|
var cache = /* @__PURE__ */ new WeakMap();
|
|
7
7
|
function getCachedMeasurement(shape, key) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
const require_shapeTypes = require("./shapeTypes-
|
|
1
|
+
const require_shapeTypes = require("./shapeTypes-BFfnNmzj.cjs");
|
|
2
2
|
const require_errors = require("./errors-O_blYTWT.cjs");
|
|
3
|
-
const require_topologyQueryFns = require("./topologyQueryFns-
|
|
4
|
-
const require_faceFns = require("./faceFns-
|
|
3
|
+
const require_topologyQueryFns = require("./topologyQueryFns-95FptXtu.cjs");
|
|
4
|
+
const require_faceFns = require("./faceFns-DzNcnzS5.cjs");
|
|
5
5
|
// src/measurement/measureCache.ts
|
|
6
6
|
var cache = /* @__PURE__ */ new WeakMap();
|
|
7
7
|
function getCachedMeasurement(shape, key) {
|
package/dist/measurement.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_measureFns = require("./measureFns-
|
|
3
|
-
const require_principalBoxFns = require("./principalBoxFns-
|
|
2
|
+
const require_measureFns = require("./measureFns-C8UjdHpB.cjs");
|
|
3
|
+
const require_principalBoxFns = require("./principalBoxFns-C_hSxRc7.cjs");
|
|
4
4
|
exports.createDistanceQuery = require_measureFns.createDistanceQuery;
|
|
5
5
|
exports.measureArea = require_measureFns.measureArea;
|
|
6
6
|
exports.measureDistance = require_measureFns.measureDistance;
|
package/dist/measurement.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { a as measureDistance, c as measureLinearProps, d as measureVolumeProps, l as measureSurfaceProps, n as measureArea, o as measureDistanceProps, s as measureLength, t as createDistanceQuery, u as measureVolume } from "./measureFns-
|
|
2
|
-
import { t as principalBoundingBox } from "./principalBoxFns-
|
|
1
|
+
import { a as measureDistance, c as measureLinearProps, d as measureVolumeProps, l as measureSurfaceProps, n as measureArea, o as measureDistanceProps, s as measureLength, t as createDistanceQuery, u as measureVolume } from "./measureFns-B0PhQ5dY.js";
|
|
2
|
+
import { t as principalBoundingBox } from "./principalBoxFns-DLOoxmZB.js";
|
|
3
3
|
export { createDistanceQuery, measureArea, measureDistance, measureDistanceProps, measureLength, measureLinearProps, measureSurfaceProps, measureVolume, measureVolumeProps, principalBoundingBox };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { q as getKernel, ut as qualityDeflection } from "./shapeTypes-
|
|
2
|
-
import { j as isUnsupportedKernelOperationError } from "./occtWasmAdapter-
|
|
1
|
+
import { q as getKernel, ut as qualityDeflection } from "./shapeTypes-C7hqbMwl.js";
|
|
2
|
+
import { j as isUnsupportedKernelOperationError } from "./occtWasmAdapter-CGsnjMOe.js";
|
|
3
3
|
import { E as ok, g as err, r as ioError, t as BrepErrorCode, u as unsupportedError } from "./errors-BTccWbtE.js";
|
|
4
|
-
import { d as getSolids, n as getBounds } from "./topologyQueryFns-
|
|
5
|
-
import { d as getFaceOrigins } from "./solidBuilders-
|
|
4
|
+
import { d as getSolids, n as getBounds } from "./topologyQueryFns-C3-_9dFM.js";
|
|
5
|
+
import { d as getFaceOrigins } from "./solidBuilders-B01dFnd7.js";
|
|
6
6
|
// src/topology/meshCache.ts
|
|
7
7
|
/**
|
|
8
8
|
* Build a parameter key for the inner cache map (excludes shape identity).
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
const require_shapeTypes = require("./shapeTypes-
|
|
2
|
-
const require_occtWasmAdapter = require("./occtWasmAdapter-
|
|
1
|
+
const require_shapeTypes = require("./shapeTypes-BFfnNmzj.cjs");
|
|
2
|
+
const require_occtWasmAdapter = require("./occtWasmAdapter-4YnvqZOW.cjs");
|
|
3
3
|
const require_errors = require("./errors-O_blYTWT.cjs");
|
|
4
|
-
const require_topologyQueryFns = require("./topologyQueryFns-
|
|
5
|
-
const require_solidBuilders = require("./solidBuilders-
|
|
4
|
+
const require_topologyQueryFns = require("./topologyQueryFns-95FptXtu.cjs");
|
|
5
|
+
const require_solidBuilders = require("./solidBuilders-CWw3yasa.cjs");
|
|
6
6
|
// src/topology/meshCache.ts
|
|
7
7
|
/**
|
|
8
8
|
* Build a parameter key for the inner cache map (excludes shape identity).
|
|
@@ -4850,17 +4850,86 @@ function toBREP(k, shape) {
|
|
|
4850
4850
|
function fromBREP(k, data) {
|
|
4851
4851
|
return wrapResult(k, k.fromBREP(data));
|
|
4852
4852
|
}
|
|
4853
|
+
/**
|
|
4854
|
+
* A new XCAF document holding each part as a free shape of its own, tagged
|
|
4855
|
+
* with its name and color.
|
|
4856
|
+
*
|
|
4857
|
+
* XCAF stores a shape once. A part identical to an earlier one comes back as
|
|
4858
|
+
* that part's label, and a part sharing another part's geometry (`TShape`) at
|
|
4859
|
+
* another placement becomes a reference to it, which leaves the shared label
|
|
4860
|
+
* no longer free, so it is not written. Either way there are fewer free shapes
|
|
4861
|
+
* than parts; the document is then rebuilt once with those parts copied, and a
|
|
4862
|
+
* copy has a `TShape` of its own. Copying the part whose label became shared,
|
|
4863
|
+
* not the placed parts referencing it, keeps those sharing one geometry.
|
|
4864
|
+
*/
|
|
4853
4865
|
function addXcafParts(k, parts) {
|
|
4854
4866
|
const docId = k.xcafNewDocument();
|
|
4855
|
-
|
|
4856
|
-
|
|
4867
|
+
let merged;
|
|
4868
|
+
try {
|
|
4869
|
+
merged = mergedParts(addEachPart(k, docId, parts, /* @__PURE__ */ new Set()), freeShapes(k, docId));
|
|
4870
|
+
} catch (e) {
|
|
4871
|
+
k.xcafClose(docId);
|
|
4872
|
+
throw e;
|
|
4873
|
+
}
|
|
4874
|
+
if (merged.size === 0) return docId;
|
|
4875
|
+
k.xcafClose(docId);
|
|
4876
|
+
const rebuilt = k.xcafNewDocument();
|
|
4877
|
+
try {
|
|
4878
|
+
addEachPart(k, rebuilt, parts, merged);
|
|
4879
|
+
return rebuilt;
|
|
4880
|
+
} catch (e) {
|
|
4881
|
+
k.xcafClose(rebuilt);
|
|
4882
|
+
throw e;
|
|
4883
|
+
}
|
|
4884
|
+
}
|
|
4885
|
+
/** Add `parts` in order, copying those in `copy`; the label each part went in as. */
|
|
4886
|
+
function addEachPart(k, docId, parts, copy) {
|
|
4887
|
+
return parts.map((entry, i) => {
|
|
4888
|
+
const labelId = addPartShape(k, docId, unwrap(entry.shape), copy.has(i));
|
|
4857
4889
|
if (entry.name) k.xcafSetName(docId, labelId, entry.name);
|
|
4858
4890
|
if (entry.color) {
|
|
4859
4891
|
const [r, g, b] = entry.color;
|
|
4860
4892
|
k.xcafSetColor(docId, labelId, r / 255, g / 255, b / 255);
|
|
4861
4893
|
}
|
|
4894
|
+
return labelId;
|
|
4895
|
+
});
|
|
4896
|
+
}
|
|
4897
|
+
/**
|
|
4898
|
+
* The parts that did not become a free shape of their own: a repeat of an
|
|
4899
|
+
* earlier part's label, or a label no longer free. Each part adds at most one
|
|
4900
|
+
* free shape, so as many free shapes as parts means none merged.
|
|
4901
|
+
*/
|
|
4902
|
+
function mergedParts(labels, free) {
|
|
4903
|
+
const merged = /* @__PURE__ */ new Set();
|
|
4904
|
+
if (free.length === labels.length) return merged;
|
|
4905
|
+
const freeLabels = new Set(free);
|
|
4906
|
+
const seen = /* @__PURE__ */ new Set();
|
|
4907
|
+
labels.forEach((label, i) => {
|
|
4908
|
+
if (seen.has(label) || !freeLabels.has(label)) merged.add(i);
|
|
4909
|
+
seen.add(label);
|
|
4910
|
+
});
|
|
4911
|
+
return merged;
|
|
4912
|
+
}
|
|
4913
|
+
/** Add a shape, or a copy of it; the document keeps the copy's geometry once its slot is released. */
|
|
4914
|
+
function addPartShape(k, docId, shapeId, copy) {
|
|
4915
|
+
if (!copy) return k.xcafAddShape(docId, shapeId);
|
|
4916
|
+
const copyId = k.copy(shapeId);
|
|
4917
|
+
try {
|
|
4918
|
+
return k.xcafAddShape(docId, copyId);
|
|
4919
|
+
} finally {
|
|
4920
|
+
k.release(copyId);
|
|
4921
|
+
}
|
|
4922
|
+
}
|
|
4923
|
+
/** The document's free shapes' label ids. */
|
|
4924
|
+
function freeShapes(k, docId) {
|
|
4925
|
+
const roots = k.xcafGetRootLabels(docId);
|
|
4926
|
+
try {
|
|
4927
|
+
const ids = [];
|
|
4928
|
+
for (let i = 0; i < roots.size(); i++) ids.push(roots.get(i));
|
|
4929
|
+
return ids;
|
|
4930
|
+
} finally {
|
|
4931
|
+
roots.delete();
|
|
4862
4932
|
}
|
|
4863
|
-
return docId;
|
|
4864
4933
|
}
|
|
4865
4934
|
function writeXcafDoc(k, docId, units) {
|
|
4866
4935
|
const roots = k.xcafGetRootLabels(docId);
|