brepjs 20.12.4 → 20.12.5
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-54UTqtan.js → adjacencyFns-B2Po1gPs.js} +3 -3
- package/dist/{adjacencyFns-C_Vb1AeW.cjs → adjacencyFns-Cho9v3Q3.cjs} +3 -3
- package/dist/{blueprint-D0VEeTzJ.cjs → blueprint-ERmwk6zG.cjs} +5 -5
- package/dist/{blueprint-DFpjcrlm.js → blueprint-Zmt5-07y.js} +5 -5
- package/dist/{blueprintFns-Douf5ZdX.cjs → blueprintFns-B_sxtIo7.cjs} +2 -2
- package/dist/{blueprintFns-Dye1jezD.js → blueprintFns-Dtm-XukP.js} +2 -2
- package/dist/{blueprintSketcher-W9yON-UC.cjs → blueprintSketcher-CZyokLGJ.cjs} +3 -3
- package/dist/{blueprintSketcher-Cr0Lr1Dq.js → blueprintSketcher-CwTAtrkY.js} +3 -3
- package/dist/{boolean2D-C9VghXHG.cjs → boolean2D-CRuNKgXs.cjs} +4 -4
- package/dist/{boolean2D-CCV3R6lN.js → boolean2D-yUpS8onH.js} +4 -4
- package/dist/brepjs.cjs +128 -100
- package/dist/brepjs.js +128 -100
- package/dist/{cameraFns-x3L6dtA8.cjs → cameraFns-DB1IyMmS.cjs} +3 -3
- package/dist/{cameraFns-DZOI_ewG.js → cameraFns-DRok4UxZ.js} +3 -3
- package/dist/core.cjs +2 -2
- package/dist/core.js +2 -2
- package/dist/{cornerFinder-BY10jciz.js → cornerFinder-D5qnDbtZ.js} +1 -1
- package/dist/{cornerFinder-B8PqO4um.cjs → cornerFinder-DfYBHHZG.cjs} +1 -1
- package/dist/{curveFns-B4308HNM.js → curveFns-BGPSFUWB.js} +1 -1
- package/dist/{curveFns-8lUhNquZ.cjs → curveFns-BKT4Sg8q.cjs} +1 -1
- package/dist/{drawFns-C7zAvera.cjs → drawFns-D8e5RiRe.cjs} +23 -15
- package/dist/{drawFns-DjnU3fEd.js → drawFns-aGufr-pr.js} +23 -15
- package/dist/{faceFns-BjmlYcc9.cjs → faceFns-Cx7cwUMx.cjs} +2 -2
- package/dist/{faceFns-7eHqNM0P.js → faceFns-lE2OvBfq.js} +2 -2
- package/dist/{healingFns-BW7mZ_SW.js → healingFns-B94zSk1-.js} +5 -5
- package/dist/{healingFns-CYLIcIWv.cjs → healingFns-CcgyrL6h.cjs} +5 -5
- package/dist/{helpers-De0Z_6iV.cjs → helpers-C4f2MV-r.cjs} +14 -10
- package/dist/{helpers-BQ6XMFcm.js → helpers-CNgipe6l.js} +14 -10
- package/dist/{importFns-3IMBHQrQ.cjs → importFns-fIdcaMqt.cjs} +2 -2
- package/dist/{importFns-BCL4-H8e.js → importFns-gB1X3ti2.js} +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/io.cjs +2 -2
- package/dist/io.js +2 -2
- package/dist/kernel/occtWasm/constructionOps.d.ts +1 -1
- package/dist/kernel/occtWasm/occtWasmAdapter.cjs +1 -1
- package/dist/kernel/occtWasm/occtWasmAdapter.d.ts +1 -1
- package/dist/kernel/occtWasm/occtWasmAdapter.js +1 -1
- package/dist/kernel/occtWasm/occtWasmTypes.d.ts +5 -0
- package/dist/{loftFns-DlG5oR0X.cjs → loftFns-AHaYxJyS.cjs} +17 -2
- package/dist/{loftFns-H4ZOpRAk.js → loftFns-mbyBvJ8Y.js} +17 -2
- package/dist/{measureFns-1IfNe629.js → measureFns-C94G0fH8.js} +102 -35
- package/dist/{measureFns-Ce01LVwq.cjs → measureFns-CuabRDRL.cjs} +102 -35
- package/dist/measurement/measureFns.d.ts +3 -2
- package/dist/measurement.cjs +2 -2
- package/dist/measurement.js +2 -2
- package/dist/{meshFns-nEvfwNRF.cjs → meshFns-GXF5gPZL.cjs} +3 -3
- package/dist/{meshFns-DaRZxa7B.js → meshFns-jarDZKw1.js} +3 -3
- package/dist/{occtWasmAdapter-CRd9RFEu.cjs → occtWasmAdapter-DeoeK2iJ.cjs} +7 -4
- package/dist/{occtWasmAdapter-ipKUdNLN.js → occtWasmAdapter-DlNmVNUn.js} +7 -4
- package/dist/operations/patternFns.d.ts +6 -1
- package/dist/operations.cjs +2 -2
- package/dist/operations.js +2 -2
- package/dist/{originTrackingFns-zrksCJTa.js → originTrackingFns-BxeUD2NM.js} +2 -2
- package/dist/{originTrackingFns-9gyCMFFQ.cjs → originTrackingFns-C-yuMV3m.cjs} +2 -2
- package/dist/{primitiveFns-BRXZ7jnP.cjs → primitiveFns-BVAkYHVf.cjs} +7 -14
- package/dist/{primitiveFns-ClQP6zMQ.js → primitiveFns-CualoFAk.js} +7 -14
- package/dist/{principalBoxFns-tIv-crMB.cjs → principalBoxFns-DHh5_HCw.cjs} +3 -3
- package/dist/{principalBoxFns-DsfWOoXg.js → principalBoxFns-DtI7tVuS.js} +3 -3
- package/dist/projection.cjs +1 -1
- package/dist/projection.js +1 -1
- package/dist/query/finderCore.d.ts +7 -7
- package/dist/query.cjs +2 -2
- package/dist/query.js +2 -2
- package/dist/{refResolveFns-BG3JGs--.js → refResolveFns--SRyN2qa.js} +6 -6
- package/dist/{refResolveFns-BZdUlv9f.cjs → refResolveFns-CaAw-ya3.cjs} +6 -6
- package/dist/{shapeFns-BCgegapL.js → shapeFns-CdrDroOM.js} +2 -2
- package/dist/{shapeFns-BbXqiNqY.cjs → shapeFns-CwjjUOr0.cjs} +2 -2
- package/dist/shapeRef.cjs +1 -1
- package/dist/shapeRef.js +1 -1
- package/dist/{shapeTypes-DJT3SnGK.cjs → shapeTypes-D938X2mg.cjs} +1 -1
- package/dist/{shapeTypes-DAz6aAnJ.js → shapeTypes-PNVEv6ga.js} +1 -1
- package/dist/sketching/sketches.d.ts +2 -0
- package/dist/sketching.cjs +3 -3
- package/dist/sketching.js +3 -3
- package/dist/{solidBuilders-BWbqhbyv.cjs → solidBuilders-CAkBQKWb.cjs} +5 -5
- package/dist/{solidBuilders-8xytLt8-.js → solidBuilders-Hft8Cr6a.js} +5 -5
- package/dist/{surfaceBuilders-CwG_RPdZ.cjs → surfaceBuilders-BKCiVf7T.cjs} +3 -3
- package/dist/{surfaceBuilders-BO96DMCH.js → surfaceBuilders-CrO_BBKM.js} +3 -3
- package/dist/text.cjs +2 -2
- package/dist/text.js +2 -2
- package/dist/{textBlueprints-Dhe8_Uvc.js → textBlueprints-B8q2a-nN.js} +19 -11
- package/dist/{textBlueprints-DHfYmLtP.cjs → textBlueprints-C9HeYc5a.cjs} +19 -11
- package/dist/{textMetrics-CwYDH9js.cjs → textMetrics-1fhCSAGF.cjs} +1 -1
- package/dist/{textMetrics-Bbf-Dllw.js → textMetrics-DJfTSy6w.js} +1 -1
- package/dist/{threadFns-B23RqugN.cjs → threadFns-CVIEbOW3.cjs} +37 -29
- package/dist/{threadFns-Cn7_bmux.js → threadFns-f2KwibLR.js} +36 -28
- package/dist/topology/apiTypes.d.ts +13 -7
- package/dist/topology.cjs +9 -9
- package/dist/topology.d.ts +1 -1
- package/dist/topology.js +9 -9
- package/dist/{topologyQueryFns-xh11vEQw.cjs → topologyQueryFns-4WYqtSFF.cjs} +1 -1
- package/dist/{topologyQueryFns-BfYdGOJc.js → topologyQueryFns-BZUY10TD.js} +1 -1
- package/dist/{validityTypes-BfOuvfyp.js → validityTypes-DAXIqwZM.js} +1 -1
- package/dist/{validityTypes-CXkecqMw.cjs → validityTypes-tWSx_zAH.cjs} +1 -1
- package/package.json +2 -1
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
const require_shapeTypes = require("./shapeTypes-
|
|
1
|
+
const require_shapeTypes = require("./shapeTypes-D938X2mg.cjs");
|
|
2
2
|
const require_errors = require("./errors-O_blYTWT.cjs");
|
|
3
|
-
const require_topologyQueryFns = require("./topologyQueryFns-
|
|
3
|
+
const require_topologyQueryFns = require("./topologyQueryFns-4WYqtSFF.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-Cx7cwUMx.cjs");
|
|
7
|
+
const require_shapeFns = require("./shapeFns-CwjjUOr0.cjs");
|
|
8
|
+
const require_curveFns = require("./curveFns-BKT4Sg8q.cjs");
|
|
9
|
+
const require_measureFns = require("./measureFns-CuabRDRL.cjs");
|
|
10
10
|
// src/utils/vec2d.ts
|
|
11
11
|
/** Precision for curve intersection and parameter operations. */
|
|
12
12
|
var PRECISION_INTERSECTION = 1e-9;
|
|
@@ -216,11 +216,15 @@ function resolveDir(dir) {
|
|
|
216
216
|
* with a vertex constructed at the reference point.
|
|
217
217
|
*/
|
|
218
218
|
function distanceFromPointFilter(distance, point, tolerance) {
|
|
219
|
-
const kernel = require_shapeTypes.getKernel();
|
|
220
|
-
const vtx = kernel.makeVertex(point[0], point[1], point[2]);
|
|
221
219
|
return (element) => {
|
|
222
|
-
const
|
|
223
|
-
|
|
220
|
+
const kernel = require_shapeTypes.getKernel();
|
|
221
|
+
const vtx = kernel.makeVertex(point[0], point[1], point[2]);
|
|
222
|
+
try {
|
|
223
|
+
const d = kernel.distance(vtx, element.wrapped).value;
|
|
224
|
+
return Math.abs(d - distance) < tolerance;
|
|
225
|
+
} finally {
|
|
226
|
+
kernel.dispose(vtx);
|
|
227
|
+
}
|
|
224
228
|
};
|
|
225
229
|
}
|
|
226
230
|
// src/query/shapeFinders.ts
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { q as getKernel, y as isFace } from "./shapeTypes-
|
|
1
|
+
import { q as getKernel, y as isFace } from "./shapeTypes-PNVEv6ga.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-BZUY10TD.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-lE2OvBfq.js";
|
|
7
|
+
import { a as isSameShape, n as getHashCode } from "./shapeFns-CdrDroOM.js";
|
|
8
|
+
import { f as getCurveType, i as curveIsClosed, o as curveLength } from "./curveFns-BGPSFUWB.js";
|
|
9
|
+
import { n as measureArea } from "./measureFns-C94G0fH8.js";
|
|
10
10
|
// src/utils/vec2d.ts
|
|
11
11
|
/** Precision for curve intersection and parameter operations. */
|
|
12
12
|
var PRECISION_INTERSECTION = 1e-9;
|
|
@@ -216,11 +216,15 @@ function resolveDir(dir) {
|
|
|
216
216
|
* with a vertex constructed at the reference point.
|
|
217
217
|
*/
|
|
218
218
|
function distanceFromPointFilter(distance, point, tolerance) {
|
|
219
|
-
const kernel = getKernel();
|
|
220
|
-
const vtx = kernel.makeVertex(point[0], point[1], point[2]);
|
|
221
219
|
return (element) => {
|
|
222
|
-
const
|
|
223
|
-
|
|
220
|
+
const kernel = getKernel();
|
|
221
|
+
const vtx = kernel.makeVertex(point[0], point[1], point[2]);
|
|
222
|
+
try {
|
|
223
|
+
const d = kernel.distance(vtx, element.wrapped).value;
|
|
224
|
+
return Math.abs(d - distance) < tolerance;
|
|
225
|
+
} finally {
|
|
226
|
+
kernel.dispose(vtx);
|
|
227
|
+
}
|
|
224
228
|
};
|
|
225
229
|
}
|
|
226
230
|
// src/query/shapeFinders.ts
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
const require_shapeTypes = require("./shapeTypes-
|
|
1
|
+
const require_shapeTypes = require("./shapeTypes-D938X2mg.cjs");
|
|
2
2
|
const require_bug = require("./bug-CBcpIPuf.cjs");
|
|
3
3
|
const require_errors = require("./errors-O_blYTWT.cjs");
|
|
4
4
|
const require_arrayAccess = require("./arrayAccess-DpJYARwv.cjs");
|
|
5
|
-
const require_blueprint = require("./blueprint-
|
|
5
|
+
const require_blueprint = require("./blueprint-ERmwk6zG.cjs");
|
|
6
6
|
// src/io/objExportFns.ts
|
|
7
7
|
/** Read a vec3 from a typed array at the given vertex index. */
|
|
8
8
|
function vec3At(arr, i) {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { n as castResultShape, q as getKernel } from "./shapeTypes-
|
|
1
|
+
import { n as castResultShape, q as getKernel } from "./shapeTypes-PNVEv6ga.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
4
|
import { n as getAtOrThrow } from "./arrayAccess-BpgouNir.js";
|
|
5
|
-
import { c as make2dBezierCurve, h as make2dThreePointArc, p as make2dSegmentCurve, t as Blueprint } from "./blueprint-
|
|
5
|
+
import { c as make2dBezierCurve, h as make2dThreePointArc, p as make2dSegmentCurve, t as Blueprint } from "./blueprint-Zmt5-07y.js";
|
|
6
6
|
// src/io/objExportFns.ts
|
|
7
7
|
/** Read a vec3 from a typed array at the given vertex index. */
|
|
8
8
|
function vec3At(arr, i) {
|
package/dist/index.d.ts
CHANGED
|
@@ -6,7 +6,7 @@ export { currentQuality } from './kernel/quality.js';
|
|
|
6
6
|
export type { QualityLevel } from './kernel/quality.js';
|
|
7
7
|
export { EXACT_BREP_CAPABILITIES, DEFAULT_CAPABILITIES } from './kernel/capabilities.js';
|
|
8
8
|
export type { KernelCapabilities, TessellationModel } from './kernel/capabilities.js';
|
|
9
|
-
export type { KernelAdapter, BrepkitHandle, OcctWasmHandle, OcctWasmModule, OcctKernelWasm, SurfaceType, ShapeOrientation, ShapeType, KernelBooleanOps, KernelBuilderOps, KernelCore, KernelCurveOps, KernelEvolutionOps, KernelIOOps, KernelMeasureOps, KernelMeshOps, KernelModifierOps, KernelPrimitiveOps, KernelRepairOps, KernelSurfaceOps, KernelSweepOps, KernelTopologyOps, KernelTransformOps, } from './kernel/index.js';
|
|
9
|
+
export type { KernelAdapter, BrepkitHandle, OcctWasmHandle, OcctWasmModule, OcctKernelWasm, SurfaceType as KernelSurfaceType, ShapeOrientation, ShapeType, KernelBooleanOps, KernelBuilderOps, KernelCore, KernelCurveOps, KernelEvolutionOps, KernelIOOps, KernelMeasureOps, KernelMeshOps, KernelModifierOps, KernelPrimitiveOps, KernelRepairOps, KernelSurfaceOps, KernelSweepOps, KernelTopologyOps, KernelTransformOps, } from './kernel/index.js';
|
|
10
10
|
export { supportsProjection, supportsConstraintSketch } from './kernel/index.js';
|
|
11
11
|
export type { ProjectionCapability, ConstraintSketchCapability } from './kernel/index.js';
|
|
12
12
|
export { getPerformanceStats, resetPerformanceStats } from './kernel/index.js';
|
|
@@ -93,7 +93,7 @@ export { facesOfEdge, edgesOfFace, wiresOfFace, verticesOfEdge, verticesOfFace,
|
|
|
93
93
|
export { getCurveType, curveStartPoint, curveEndPoint, curvePointAt, curveTangentAt, curveAxis, curveLength, curveIsClosed, curveIsPeriodic, curvePeriod, getOrientation, flipOrientation, offsetWire2D, interpolateCurve, approximateCurve, type InterpolateCurveOptions, type ApproximateCurveOptions, } from './topology/curveFns.js';
|
|
94
94
|
export { getNurbsCurveData, getNurbsSurfaceData } from './topology/nurbsFns.js';
|
|
95
95
|
export type { NurbsCurveData, NurbsSurfaceData } from './kernel/types.js';
|
|
96
|
-
export { getSurfaceType, faceGeomType, faceOrientation, flipFaceOrientation, uvBounds, pointOnSurface, uvCoordinates, normalAt, faceCenter, faceAxis, classifyPointOnFace, outerWire, innerWires, removeHolesFromFace, projectPointOnFace, type UVBounds, type PointProjectionResult, } from './topology/faceFns.js';
|
|
96
|
+
export { getSurfaceType, faceGeomType, faceOrientation, flipFaceOrientation, uvBounds, pointOnSurface, uvCoordinates, normalAt, faceCenter, faceAxis, classifyPointOnFace, outerWire, innerWires, removeHolesFromFace, projectPointOnFace, type SurfaceType, type UVBounds, type PointProjectionResult, } from './topology/faceFns.js';
|
|
97
97
|
export { exportSTEP, exportSTL, exportIGES, meshMultiLOD, meshLODs, meshLODsProgressive, type ShapeMesh, type EdgeMesh, type MeshOptions, type MultiLODMesh, type LODMesh, type MeshLODsOptions, type MeshLODsProgressiveOptions, type MeshLevelFn, } from './topology/meshFns.js';
|
|
98
98
|
export { clearMeshCache, createMeshCache, type MeshCacheContext } from './topology/meshCache.js';
|
|
99
99
|
export { toBufferGeometryData, toLineGeometryData, toGroupedBufferGeometryData, type BufferGeometryData, type LineGeometryData, type GroupedBufferGeometryData, type BufferGeometryGroup, toLODGeometryData, type LODGeometryData, toLODGeometryLevels, type LODGeometryLevel, } from './topology/threeHelpers.js';
|
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-GXF5gPZL.cjs");
|
|
3
|
+
const require_importFns = require("./importFns-fIdcaMqt.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 importSVG, c as blueprintToDXF, d as exportGltf, f as exportOBJ, i as exportSTEPConfigured, l as exportDXF, n as importSTEP, o as importSVGPathD, r as importSTL, s as exportThreeMF, t as importIGES, u as exportGlb } from "./importFns-
|
|
1
|
+
import { n as exportSTEP, r as exportSTL, t as exportIGES } from "./meshFns-jarDZKw1.js";
|
|
2
|
+
import { a as importSVG, c as blueprintToDXF, d as exportGltf, f as exportOBJ, i as exportSTEPConfigured, l as exportDXF, n as importSTEP, o as importSVGPathD, r as importSTL, s as exportThreeMF, t as importIGES, u as exportGlb } from "./importFns-gB1X3ti2.js";
|
|
3
3
|
export { blueprintToDXF, exportDXF, exportGlb, exportGltf, exportIGES, exportOBJ, exportSTEP, exportSTEPConfigured, exportSTL, exportThreeMF, importIGES, importSTEP, importSTL, importSVG, importSVGPathD };
|
|
@@ -14,7 +14,7 @@ export declare function makeEllipseEdge(k: OcctKernelWasm, center: Vec3, normal:
|
|
|
14
14
|
export declare function makeEllipseArc(k: OcctKernelWasm, center: Vec3, normal: Vec3, majorRadius: number, minorRadius: number, startAngle: number, endAngle: number, xDir?: Vec3): KernelShape;
|
|
15
15
|
export declare function makeBezierEdge(k: OcctKernelWasm, Module: OcctWasmModule, points: [number, number, number][]): KernelShape;
|
|
16
16
|
export declare function makeTangentArc(k: OcctKernelWasm, startPoint: [number, number, number], startTangent: [number, number, number], endPoint: [number, number, number]): KernelShape;
|
|
17
|
-
export declare function makeHelixWire(k: OcctKernelWasm, pitch: number, height: number, radius: number, center?: [number, number, number], direction?: [number, number, number]): KernelShape;
|
|
17
|
+
export declare function makeHelixWire(k: OcctKernelWasm, pitch: number, height: number, radius: number, center?: [number, number, number], direction?: [number, number, number], leftHanded?: boolean): KernelShape;
|
|
18
18
|
export declare function makeCompound(k: OcctKernelWasm, Module: OcctWasmModule, shapes: KernelShape[]): KernelShape;
|
|
19
19
|
export declare function solidFromShell(k: OcctKernelWasm, shell: KernelShape): KernelShape;
|
|
20
20
|
export declare function buildSolidFromFaces(k: OcctKernelWasm, Module: OcctWasmModule, points: Array<{
|
|
@@ -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-DeoeK2iJ.cjs");
|
|
3
3
|
exports.OcctWasmAdapter = require_occtWasmAdapter.OcctWasmAdapter;
|
|
@@ -96,7 +96,7 @@ export declare class OcctWasmAdapter implements KernelAdapter {
|
|
|
96
96
|
makeEllipseArc(center: [number, number, number], normal: [number, number, number], majorRadius: number, minorRadius: number, startAngle: number, endAngle: number, xDir?: [number, number, number]): KernelShape;
|
|
97
97
|
makeBezierEdge(points: [number, number, number][]): KernelShape;
|
|
98
98
|
makeTangentArc(startPoint: [number, number, number], startTangent: [number, number, number], endPoint: [number, number, number]): KernelShape;
|
|
99
|
-
makeHelixWire(pitch: number, height: number, radius: number, center?: [number, number, number], direction?: [number, number, number],
|
|
99
|
+
makeHelixWire(pitch: number, height: number, radius: number, center?: [number, number, number], direction?: [number, number, number], leftHanded?: boolean): KernelShape;
|
|
100
100
|
makeWireFromMixed(items: KernelShape[]): KernelShape;
|
|
101
101
|
makeCompound(shapes: KernelShape[]): KernelShape;
|
|
102
102
|
solidFromShell(shell: KernelShape): KernelShape;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { t as OcctWasmAdapter } from "../../occtWasmAdapter-
|
|
1
|
+
export { t as OcctWasmAdapter } from "../../occtWasmAdapter-DlNmVNUn.js";
|
|
@@ -172,6 +172,11 @@ export interface OcctKernelWasm {
|
|
|
172
172
|
makeBezierEdge(flatPoints: EmVectorDouble): number;
|
|
173
173
|
makeTangentArc(x1: number, y1: number, z1: number, tx: number, ty: number, tz: number, x2: number, y2: number, z2: number): number;
|
|
174
174
|
makeHelixWire(px: number, py: number, pz: number, dx: number, dy: number, dz: number, pitch: number, height: number, radius: number): number;
|
|
175
|
+
/**
|
|
176
|
+
* {@link makeHelixWire} with an explicit winding. Optional: absent on WASM
|
|
177
|
+
* builds older than occt-wasm 4.3.0, so callers must feature-detect it.
|
|
178
|
+
*/
|
|
179
|
+
makeHelixWireHanded?(px: number, py: number, pz: number, dx: number, dy: number, dz: number, pitch: number, height: number, radius: number, leftHanded: boolean): number;
|
|
175
180
|
makeWire(edgeIds: EmVectorUint32): number;
|
|
176
181
|
makeFace(wireId: number): number;
|
|
177
182
|
makeNonPlanarFace(wireId: number): number;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const require_shapeTypes = require("./shapeTypes-
|
|
1
|
+
const require_shapeTypes = require("./shapeTypes-D938X2mg.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");
|
|
@@ -40,6 +40,14 @@ function makeSpineWire(start, end) {
|
|
|
40
40
|
kernel.dispose(edge);
|
|
41
41
|
return require_shapeTypes.castResultShape(wire);
|
|
42
42
|
}
|
|
43
|
+
/** A planar face bounded by `wire`, or `null` when the wire does not span one. */
|
|
44
|
+
function planarFaceOf(wire) {
|
|
45
|
+
try {
|
|
46
|
+
return require_shapeTypes.getKernel().makeFace(wire.wrapped, true);
|
|
47
|
+
} catch {
|
|
48
|
+
return null;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
43
51
|
/** Build a helix wire for twist extrusion. */
|
|
44
52
|
function makeHelixWire(pitch, height, radius, center, dir, leftHanded = false) {
|
|
45
53
|
const kernel = require_shapeTypes.getKernel();
|
|
@@ -87,7 +95,14 @@ function castSweepShellTuple(result) {
|
|
|
87
95
|
*/
|
|
88
96
|
function sweep(wire, spine, config = {}, shellMode = false) {
|
|
89
97
|
if (config.mode === "simple" && !shellMode) {
|
|
90
|
-
const
|
|
98
|
+
const kernel = require_shapeTypes.getKernel();
|
|
99
|
+
const profileFace = planarFaceOf(wire);
|
|
100
|
+
let resultOc;
|
|
101
|
+
try {
|
|
102
|
+
resultOc = kernel.simplePipe(profileFace ?? wire.wrapped, spine.wrapped);
|
|
103
|
+
} finally {
|
|
104
|
+
if (profileFace) kernel.dispose(profileFace);
|
|
105
|
+
}
|
|
91
106
|
const shape = require_shapeTypes.castResultShape(resultOc);
|
|
92
107
|
if (!require_shapeTypes.isShape3D(shape)) {
|
|
93
108
|
require_shapeTypes.disposeResultShape(shape);
|
|
@@ -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-PNVEv6ga.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";
|
|
@@ -40,6 +40,14 @@ function makeSpineWire(start, end) {
|
|
|
40
40
|
kernel.dispose(edge);
|
|
41
41
|
return castResultShape(wire);
|
|
42
42
|
}
|
|
43
|
+
/** A planar face bounded by `wire`, or `null` when the wire does not span one. */
|
|
44
|
+
function planarFaceOf(wire) {
|
|
45
|
+
try {
|
|
46
|
+
return getKernel().makeFace(wire.wrapped, true);
|
|
47
|
+
} catch {
|
|
48
|
+
return null;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
43
51
|
/** Build a helix wire for twist extrusion. */
|
|
44
52
|
function makeHelixWire(pitch, height, radius, center, dir, leftHanded = false) {
|
|
45
53
|
const kernel = getKernel();
|
|
@@ -87,7 +95,14 @@ function castSweepShellTuple(result) {
|
|
|
87
95
|
*/
|
|
88
96
|
function sweep(wire, spine, config = {}, shellMode = false) {
|
|
89
97
|
if (config.mode === "simple" && !shellMode) {
|
|
90
|
-
const
|
|
98
|
+
const kernel = getKernel();
|
|
99
|
+
const profileFace = planarFaceOf(wire);
|
|
100
|
+
let resultOc;
|
|
101
|
+
try {
|
|
102
|
+
resultOc = kernel.simplePipe(profileFace ?? wire.wrapped, spine.wrapped);
|
|
103
|
+
} finally {
|
|
104
|
+
if (profileFace) kernel.dispose(profileFace);
|
|
105
|
+
}
|
|
91
106
|
const shape = castResultShape(resultOc);
|
|
92
107
|
if (!isShape3D(shape)) {
|
|
93
108
|
disposeResultShape(shape);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { q as getKernel } from "./shapeTypes-
|
|
1
|
+
import { q as getKernel } from "./shapeTypes-PNVEv6ga.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-BZUY10TD.js";
|
|
4
|
+
import { m as uvBounds } from "./faceFns-lE2OvBfq.js";
|
|
5
5
|
// src/measurement/measureCache.ts
|
|
6
6
|
var cache = /* @__PURE__ */ new WeakMap();
|
|
7
7
|
function getCachedMeasurement(shape, key) {
|
|
@@ -27,6 +27,66 @@ function nullShapeErr(fn) {
|
|
|
27
27
|
return err(validationError(BrepErrorCode.NULL_SHAPE_INPUT, `${fn}: shape is a null shape`));
|
|
28
28
|
}
|
|
29
29
|
/**
|
|
30
|
+
* Run `fn` on fresh handles to the distinct sub-shapes of `type`, releasing them
|
|
31
|
+
* afterwards. Unlike getFaces and friends this leaves the shape's topology cache
|
|
32
|
+
* alone, so a measurement allocates nothing that outlives it.
|
|
33
|
+
*/
|
|
34
|
+
function withSubShapes(shape, type, fn) {
|
|
35
|
+
const kernel = getKernel();
|
|
36
|
+
const items = kernel.iterShapes(shape.wrapped, type);
|
|
37
|
+
try {
|
|
38
|
+
return fn(items);
|
|
39
|
+
} finally {
|
|
40
|
+
for (const item of items) kernel.dispose(item);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
/** Run `fn` on a throwaway compound of `parts`, releasing the compound afterwards. */
|
|
44
|
+
function withCompoundOf(parts, fn) {
|
|
45
|
+
const kernel = getKernel();
|
|
46
|
+
const c = kernel.makeCompound(parts);
|
|
47
|
+
try {
|
|
48
|
+
return fn(c);
|
|
49
|
+
} finally {
|
|
50
|
+
kernel.dispose(c);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
function volumeOf(target) {
|
|
54
|
+
const kernel = getKernel();
|
|
55
|
+
const m = kernel.volume(target);
|
|
56
|
+
const comResult = kernelCallRaw(() => kernel.centerOfMass(target), BrepErrorCode.CENTER_OF_MASS_FAILED, "Failed to compute center of mass");
|
|
57
|
+
if (!comResult.ok) return comResult;
|
|
58
|
+
return ok({
|
|
59
|
+
mass: m,
|
|
60
|
+
volume: m,
|
|
61
|
+
centerOfMass: comResult.value
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
/** Area-weighted centroid of `faces`, from each face's own surface center of mass. */
|
|
65
|
+
function surfaceCentroid(faces) {
|
|
66
|
+
const kernel = getKernel();
|
|
67
|
+
let total = 0;
|
|
68
|
+
let x = 0;
|
|
69
|
+
let y = 0;
|
|
70
|
+
let z = 0;
|
|
71
|
+
for (const f of faces) {
|
|
72
|
+
const a = kernel.area(f);
|
|
73
|
+
const [cx, cy, cz] = kernel.surfaceCenterOfMass(f);
|
|
74
|
+
total += a;
|
|
75
|
+
x += a * cx;
|
|
76
|
+
y += a * cy;
|
|
77
|
+
z += a * cz;
|
|
78
|
+
}
|
|
79
|
+
return total > 0 ? [
|
|
80
|
+
x / total,
|
|
81
|
+
y / total,
|
|
82
|
+
z / total
|
|
83
|
+
] : [
|
|
84
|
+
0,
|
|
85
|
+
0,
|
|
86
|
+
0
|
|
87
|
+
];
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
30
90
|
* Measure volume properties of a 3D shape.
|
|
31
91
|
*
|
|
32
92
|
* @param shape - A solid or compound shape.
|
|
@@ -37,31 +97,23 @@ function measureVolumeProps(shape) {
|
|
|
37
97
|
const cached = getCachedMeasurement(shape.wrapped, "volume");
|
|
38
98
|
if (cached) return ok(cached);
|
|
39
99
|
if (shapeIsNull(shape)) return nullShapeErr("measureVolumeProps");
|
|
40
|
-
const
|
|
41
|
-
const
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
0
|
|
50
|
-
]
|
|
51
|
-
};
|
|
52
|
-
setCachedMeasurement(shape.wrapped, "volume", zero);
|
|
53
|
-
return ok(zero);
|
|
54
|
-
}
|
|
55
|
-
const m = kernel.volume(shape.wrapped);
|
|
56
|
-
const comResult = kernelCallRaw(() => kernel.centerOfMass(shape.wrapped), BrepErrorCode.CENTER_OF_MASS_FAILED, "Failed to compute center of mass");
|
|
57
|
-
if (!comResult.ok) return comResult;
|
|
58
|
-
const result = {
|
|
59
|
-
mass: m,
|
|
60
|
-
volume: m,
|
|
61
|
-
centerOfMass: comResult.value
|
|
100
|
+
const type = getKernel().shapeType(shape.wrapped);
|
|
101
|
+
const zero = {
|
|
102
|
+
mass: 0,
|
|
103
|
+
volume: 0,
|
|
104
|
+
centerOfMass: [
|
|
105
|
+
0,
|
|
106
|
+
0,
|
|
107
|
+
0
|
|
108
|
+
]
|
|
62
109
|
};
|
|
63
|
-
|
|
64
|
-
|
|
110
|
+
let result;
|
|
111
|
+
if (type === "solid" || type === "compsolid") result = volumeOf(shape.wrapped);
|
|
112
|
+
else if (type === "compound") result = withSubShapes(shape, "solid", (solids) => solids.length === 0 ? ok(zero) : withCompoundOf(solids, volumeOf));
|
|
113
|
+
else result = ok(zero);
|
|
114
|
+
if (!result.ok) return result;
|
|
115
|
+
setCachedMeasurement(shape.wrapped, "volume", result.value);
|
|
116
|
+
return result;
|
|
65
117
|
}
|
|
66
118
|
/**
|
|
67
119
|
* Measure surface properties of a face or 3D shape.
|
|
@@ -76,7 +128,7 @@ function measureSurfaceProps(shape) {
|
|
|
76
128
|
if (shapeIsNull(shape)) return nullShapeErr("measureSurfaceProps");
|
|
77
129
|
const kernel = getKernel();
|
|
78
130
|
const m = kernel.area(shape.wrapped);
|
|
79
|
-
const comResult = kernelCallRaw(() => kernel.
|
|
131
|
+
const comResult = kernelCallRaw(() => kernel.shapeType(shape.wrapped) === "face" ? kernel.surfaceCenterOfMass(shape.wrapped) : withSubShapes(shape, "face", surfaceCentroid), BrepErrorCode.CENTER_OF_MASS_FAILED, "Failed to compute center of mass");
|
|
80
132
|
if (!comResult.ok) return comResult;
|
|
81
133
|
const result = {
|
|
82
134
|
mass: m,
|
|
@@ -89,8 +141,9 @@ function measureSurfaceProps(shape) {
|
|
|
89
141
|
/**
|
|
90
142
|
* Measure linear properties of any shape.
|
|
91
143
|
*
|
|
92
|
-
* For edges this is the arc length; for wires
|
|
93
|
-
*
|
|
144
|
+
* For edges this is the arc length; for wires and faces it is the total length
|
|
145
|
+
* of their edges; for shells, solids, and compounds it is the total length of
|
|
146
|
+
* their distinct edges, each counted once.
|
|
94
147
|
*
|
|
95
148
|
* @param shape - Any shape whose linear extent is to be measured.
|
|
96
149
|
* @returns `Result` containing length, center of mass, and raw mass property.
|
|
@@ -101,12 +154,26 @@ function measureLinearProps(shape) {
|
|
|
101
154
|
if (cached) return ok(cached);
|
|
102
155
|
if (shapeIsNull(shape)) return nullShapeErr("measureLinearProps");
|
|
103
156
|
const kernel = getKernel();
|
|
104
|
-
const
|
|
105
|
-
const
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
157
|
+
const type = kernel.shapeType(shape.wrapped);
|
|
158
|
+
const linearOf = (target) => {
|
|
159
|
+
const m = kernel.length(target);
|
|
160
|
+
return {
|
|
161
|
+
mass: m,
|
|
162
|
+
length: m,
|
|
163
|
+
centerOfMass: kernel.linearCenterOfMass(target)
|
|
164
|
+
};
|
|
109
165
|
};
|
|
166
|
+
let result;
|
|
167
|
+
if (type === "vertex" || type === "edge" || type === "wire" || type === "face") result = linearOf(shape.wrapped);
|
|
168
|
+
else result = withSubShapes(shape, "edge", (edges) => edges.length === 0 ? {
|
|
169
|
+
mass: 0,
|
|
170
|
+
length: 0,
|
|
171
|
+
centerOfMass: [
|
|
172
|
+
0,
|
|
173
|
+
0,
|
|
174
|
+
0
|
|
175
|
+
]
|
|
176
|
+
} : withCompoundOf(edges, linearOf));
|
|
110
177
|
setCachedMeasurement(shape.wrapped, "linear", result);
|
|
111
178
|
return ok(result);
|
|
112
179
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
const require_shapeTypes = require("./shapeTypes-
|
|
1
|
+
const require_shapeTypes = require("./shapeTypes-D938X2mg.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-4WYqtSFF.cjs");
|
|
4
|
+
const require_faceFns = require("./faceFns-Cx7cwUMx.cjs");
|
|
5
5
|
// src/measurement/measureCache.ts
|
|
6
6
|
var cache = /* @__PURE__ */ new WeakMap();
|
|
7
7
|
function getCachedMeasurement(shape, key) {
|
|
@@ -27,6 +27,66 @@ function nullShapeErr(fn) {
|
|
|
27
27
|
return require_errors.err(require_errors.validationError(require_errors.BrepErrorCode.NULL_SHAPE_INPUT, `${fn}: shape is a null shape`));
|
|
28
28
|
}
|
|
29
29
|
/**
|
|
30
|
+
* Run `fn` on fresh handles to the distinct sub-shapes of `type`, releasing them
|
|
31
|
+
* afterwards. Unlike getFaces and friends this leaves the shape's topology cache
|
|
32
|
+
* alone, so a measurement allocates nothing that outlives it.
|
|
33
|
+
*/
|
|
34
|
+
function withSubShapes(shape, type, fn) {
|
|
35
|
+
const kernel = require_shapeTypes.getKernel();
|
|
36
|
+
const items = kernel.iterShapes(shape.wrapped, type);
|
|
37
|
+
try {
|
|
38
|
+
return fn(items);
|
|
39
|
+
} finally {
|
|
40
|
+
for (const item of items) kernel.dispose(item);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
/** Run `fn` on a throwaway compound of `parts`, releasing the compound afterwards. */
|
|
44
|
+
function withCompoundOf(parts, fn) {
|
|
45
|
+
const kernel = require_shapeTypes.getKernel();
|
|
46
|
+
const c = kernel.makeCompound(parts);
|
|
47
|
+
try {
|
|
48
|
+
return fn(c);
|
|
49
|
+
} finally {
|
|
50
|
+
kernel.dispose(c);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
function volumeOf(target) {
|
|
54
|
+
const kernel = require_shapeTypes.getKernel();
|
|
55
|
+
const m = kernel.volume(target);
|
|
56
|
+
const comResult = require_topologyQueryFns.kernelCallRaw(() => kernel.centerOfMass(target), require_errors.BrepErrorCode.CENTER_OF_MASS_FAILED, "Failed to compute center of mass");
|
|
57
|
+
if (!comResult.ok) return comResult;
|
|
58
|
+
return require_errors.ok({
|
|
59
|
+
mass: m,
|
|
60
|
+
volume: m,
|
|
61
|
+
centerOfMass: comResult.value
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
/** Area-weighted centroid of `faces`, from each face's own surface center of mass. */
|
|
65
|
+
function surfaceCentroid(faces) {
|
|
66
|
+
const kernel = require_shapeTypes.getKernel();
|
|
67
|
+
let total = 0;
|
|
68
|
+
let x = 0;
|
|
69
|
+
let y = 0;
|
|
70
|
+
let z = 0;
|
|
71
|
+
for (const f of faces) {
|
|
72
|
+
const a = kernel.area(f);
|
|
73
|
+
const [cx, cy, cz] = kernel.surfaceCenterOfMass(f);
|
|
74
|
+
total += a;
|
|
75
|
+
x += a * cx;
|
|
76
|
+
y += a * cy;
|
|
77
|
+
z += a * cz;
|
|
78
|
+
}
|
|
79
|
+
return total > 0 ? [
|
|
80
|
+
x / total,
|
|
81
|
+
y / total,
|
|
82
|
+
z / total
|
|
83
|
+
] : [
|
|
84
|
+
0,
|
|
85
|
+
0,
|
|
86
|
+
0
|
|
87
|
+
];
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
30
90
|
* Measure volume properties of a 3D shape.
|
|
31
91
|
*
|
|
32
92
|
* @param shape - A solid or compound shape.
|
|
@@ -37,31 +97,23 @@ function measureVolumeProps(shape) {
|
|
|
37
97
|
const cached = getCachedMeasurement(shape.wrapped, "volume");
|
|
38
98
|
if (cached) return require_errors.ok(cached);
|
|
39
99
|
if (shapeIsNull(shape)) return nullShapeErr("measureVolumeProps");
|
|
40
|
-
const
|
|
41
|
-
const
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
0
|
|
50
|
-
]
|
|
51
|
-
};
|
|
52
|
-
setCachedMeasurement(shape.wrapped, "volume", zero);
|
|
53
|
-
return require_errors.ok(zero);
|
|
54
|
-
}
|
|
55
|
-
const m = kernel.volume(shape.wrapped);
|
|
56
|
-
const comResult = require_topologyQueryFns.kernelCallRaw(() => kernel.centerOfMass(shape.wrapped), require_errors.BrepErrorCode.CENTER_OF_MASS_FAILED, "Failed to compute center of mass");
|
|
57
|
-
if (!comResult.ok) return comResult;
|
|
58
|
-
const result = {
|
|
59
|
-
mass: m,
|
|
60
|
-
volume: m,
|
|
61
|
-
centerOfMass: comResult.value
|
|
100
|
+
const type = require_shapeTypes.getKernel().shapeType(shape.wrapped);
|
|
101
|
+
const zero = {
|
|
102
|
+
mass: 0,
|
|
103
|
+
volume: 0,
|
|
104
|
+
centerOfMass: [
|
|
105
|
+
0,
|
|
106
|
+
0,
|
|
107
|
+
0
|
|
108
|
+
]
|
|
62
109
|
};
|
|
63
|
-
|
|
64
|
-
|
|
110
|
+
let result;
|
|
111
|
+
if (type === "solid" || type === "compsolid") result = volumeOf(shape.wrapped);
|
|
112
|
+
else if (type === "compound") result = withSubShapes(shape, "solid", (solids) => solids.length === 0 ? require_errors.ok(zero) : withCompoundOf(solids, volumeOf));
|
|
113
|
+
else result = require_errors.ok(zero);
|
|
114
|
+
if (!result.ok) return result;
|
|
115
|
+
setCachedMeasurement(shape.wrapped, "volume", result.value);
|
|
116
|
+
return result;
|
|
65
117
|
}
|
|
66
118
|
/**
|
|
67
119
|
* Measure surface properties of a face or 3D shape.
|
|
@@ -76,7 +128,7 @@ function measureSurfaceProps(shape) {
|
|
|
76
128
|
if (shapeIsNull(shape)) return nullShapeErr("measureSurfaceProps");
|
|
77
129
|
const kernel = require_shapeTypes.getKernel();
|
|
78
130
|
const m = kernel.area(shape.wrapped);
|
|
79
|
-
const comResult = require_topologyQueryFns.kernelCallRaw(() => kernel.
|
|
131
|
+
const comResult = require_topologyQueryFns.kernelCallRaw(() => kernel.shapeType(shape.wrapped) === "face" ? kernel.surfaceCenterOfMass(shape.wrapped) : withSubShapes(shape, "face", surfaceCentroid), require_errors.BrepErrorCode.CENTER_OF_MASS_FAILED, "Failed to compute center of mass");
|
|
80
132
|
if (!comResult.ok) return comResult;
|
|
81
133
|
const result = {
|
|
82
134
|
mass: m,
|
|
@@ -89,8 +141,9 @@ function measureSurfaceProps(shape) {
|
|
|
89
141
|
/**
|
|
90
142
|
* Measure linear properties of any shape.
|
|
91
143
|
*
|
|
92
|
-
* For edges this is the arc length; for wires
|
|
93
|
-
*
|
|
144
|
+
* For edges this is the arc length; for wires and faces it is the total length
|
|
145
|
+
* of their edges; for shells, solids, and compounds it is the total length of
|
|
146
|
+
* their distinct edges, each counted once.
|
|
94
147
|
*
|
|
95
148
|
* @param shape - Any shape whose linear extent is to be measured.
|
|
96
149
|
* @returns `Result` containing length, center of mass, and raw mass property.
|
|
@@ -101,12 +154,26 @@ function measureLinearProps(shape) {
|
|
|
101
154
|
if (cached) return require_errors.ok(cached);
|
|
102
155
|
if (shapeIsNull(shape)) return nullShapeErr("measureLinearProps");
|
|
103
156
|
const kernel = require_shapeTypes.getKernel();
|
|
104
|
-
const
|
|
105
|
-
const
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
157
|
+
const type = kernel.shapeType(shape.wrapped);
|
|
158
|
+
const linearOf = (target) => {
|
|
159
|
+
const m = kernel.length(target);
|
|
160
|
+
return {
|
|
161
|
+
mass: m,
|
|
162
|
+
length: m,
|
|
163
|
+
centerOfMass: kernel.linearCenterOfMass(target)
|
|
164
|
+
};
|
|
109
165
|
};
|
|
166
|
+
let result;
|
|
167
|
+
if (type === "vertex" || type === "edge" || type === "wire" || type === "face") result = linearOf(shape.wrapped);
|
|
168
|
+
else result = withSubShapes(shape, "edge", (edges) => edges.length === 0 ? {
|
|
169
|
+
mass: 0,
|
|
170
|
+
length: 0,
|
|
171
|
+
centerOfMass: [
|
|
172
|
+
0,
|
|
173
|
+
0,
|
|
174
|
+
0
|
|
175
|
+
]
|
|
176
|
+
} : withCompoundOf(edges, linearOf));
|
|
110
177
|
setCachedMeasurement(shape.wrapped, "linear", result);
|
|
111
178
|
return require_errors.ok(result);
|
|
112
179
|
}
|
|
@@ -22,8 +22,9 @@ export declare function measureSurfaceProps(shape: Face<Dimension> | Shape3D): R
|
|
|
22
22
|
/**
|
|
23
23
|
* Measure linear properties of any shape.
|
|
24
24
|
*
|
|
25
|
-
* For edges this is the arc length; for wires
|
|
26
|
-
*
|
|
25
|
+
* For edges this is the arc length; for wires and faces it is the total length
|
|
26
|
+
* of their edges; for shells, solids, and compounds it is the total length of
|
|
27
|
+
* their distinct edges, each counted once.
|
|
27
28
|
*
|
|
28
29
|
* @param shape - Any shape whose linear extent is to be measured.
|
|
29
30
|
* @returns `Result` containing length, center of mass, and raw mass property.
|
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-CuabRDRL.cjs");
|
|
3
|
+
const require_principalBoxFns = require("./principalBoxFns-DHh5_HCw.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-C94G0fH8.js";
|
|
2
|
+
import { t as principalBoundingBox } from "./principalBoxFns-DtI7tVuS.js";
|
|
3
3
|
export { createDistanceQuery, measureArea, measureDistance, measureDistanceProps, measureLength, measureLinearProps, measureSurfaceProps, measureVolume, measureVolumeProps, principalBoundingBox };
|