brepjs 2.0.0 → 2.0.2
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/README.md +79 -20
- package/dist/brepjs.cjs +2013 -1860
- package/dist/brepjs.d.ts +175 -79
- package/dist/brepjs.js +2013 -1860
- package/package.json +4 -3
package/dist/brepjs.d.ts
CHANGED
|
@@ -73,6 +73,12 @@ export declare function andThen<T, U, E>(result: Result<T, E>, fn: (value: T) =>
|
|
|
73
73
|
|
|
74
74
|
export declare type AnyShape = Vertex | Edge | Wire | Face | Shell | Solid | CompSolid | Compound;
|
|
75
75
|
|
|
76
|
+
/**
|
|
77
|
+
* Applies glue optimization to a boolean operation.
|
|
78
|
+
*
|
|
79
|
+
* @param op - Boolean operation builder with SetGlue method
|
|
80
|
+
* @param optimisation - Optimization level: 'none', 'commonFace', or 'sameFace'
|
|
81
|
+
*/
|
|
76
82
|
export declare function applyGlue(op: {
|
|
77
83
|
SetGlue(glue: OcType): void;
|
|
78
84
|
}, optimisation: 'none' | 'commonFace' | 'sameFace'): void;
|
|
@@ -83,8 +89,16 @@ declare interface ApproximationOptions {
|
|
|
83
89
|
maxSegments?: number;
|
|
84
90
|
}
|
|
85
91
|
|
|
92
|
+
/**
|
|
93
|
+
* @deprecated Use toOcDir from occtBoundary.ts with Vec3 tuples instead.
|
|
94
|
+
* @see toOcDir
|
|
95
|
+
*/
|
|
86
96
|
export declare function asDir(coords: Point): OcType;
|
|
87
97
|
|
|
98
|
+
/**
|
|
99
|
+
* @deprecated Use toOcPnt from occtBoundary.ts with Vec3 tuples instead.
|
|
100
|
+
* @see toOcPnt
|
|
101
|
+
*/
|
|
88
102
|
export declare function asPnt(coords: Point): OcType;
|
|
89
103
|
|
|
90
104
|
export declare const assembleWire: (listOfEdges: (Edge | Wire)[]) => Result<Wire>;
|
|
@@ -277,6 +291,24 @@ export declare interface BooleanOptions {
|
|
|
277
291
|
strategy?: 'native' | 'pairwise';
|
|
278
292
|
}
|
|
279
293
|
|
|
294
|
+
/**
|
|
295
|
+
* @deprecated Use getBounds() from shapeFns.ts which returns a Bounds3D plain object.
|
|
296
|
+
* @example
|
|
297
|
+
* // Before (legacy):
|
|
298
|
+
* const bbox = shape.boundingBox;
|
|
299
|
+
* const center = bbox.center;
|
|
300
|
+
*
|
|
301
|
+
* // After (functional):
|
|
302
|
+
* import { getBounds, type Bounds3D } from 'brepjs';
|
|
303
|
+
* const bounds: Bounds3D = getBounds(shape);
|
|
304
|
+
* const center = [
|
|
305
|
+
* (bounds.xMin + bounds.xMax) / 2,
|
|
306
|
+
* (bounds.yMin + bounds.yMax) / 2,
|
|
307
|
+
* (bounds.zMin + bounds.zMax) / 2
|
|
308
|
+
* ];
|
|
309
|
+
*
|
|
310
|
+
* @see getBounds, Bounds3D
|
|
311
|
+
*/
|
|
280
312
|
export declare class BoundingBox extends WrappingObj<OcType> {
|
|
281
313
|
constructor(wrapped?: OcType);
|
|
282
314
|
get repr(): string;
|
|
@@ -343,6 +375,9 @@ export declare interface BSplineApproximationConfig {
|
|
|
343
375
|
*/
|
|
344
376
|
export declare function bug(location: string, message: string): never;
|
|
345
377
|
|
|
378
|
+
/**
|
|
379
|
+
* Builds a TopoDS_Compound from Shape3D instances.
|
|
380
|
+
*/
|
|
346
381
|
export declare function buildCompound(shapes: Shape3D[]): OcShape;
|
|
347
382
|
|
|
348
383
|
/**
|
|
@@ -391,7 +426,7 @@ export declare type ChamferRadius = number | {
|
|
|
391
426
|
};
|
|
392
427
|
|
|
393
428
|
/**
|
|
394
|
-
* Clear
|
|
429
|
+
* Clear all mesh caches. Call this after modifying shapes to avoid stale results.
|
|
395
430
|
*/
|
|
396
431
|
export declare function clearMeshCache(): void;
|
|
397
432
|
|
|
@@ -574,6 +609,10 @@ export declare function createDistanceQuery(referenceShape: FnAnyShape): {
|
|
|
574
609
|
/** Create a disposable shape handle. */
|
|
575
610
|
export declare function createHandle(ocShape: OcShape): ShapeHandle;
|
|
576
611
|
|
|
612
|
+
/**
|
|
613
|
+
* @deprecated Use createNamedPlane from planeOps.ts which returns a functional Plane.
|
|
614
|
+
* @see createNamedPlane from planeOps.ts (exported as fnCreateNamedPlane from brepjs)
|
|
615
|
+
*/
|
|
577
616
|
export declare const createNamedPlane: (plane: PlaneName, sourceOrigin?: Point | number) => Result<Plane>;
|
|
578
617
|
|
|
579
618
|
/** Create a disposable handle for any OCCT object. */
|
|
@@ -1101,8 +1140,8 @@ export declare function err<E>(error: E): Err<E>;
|
|
|
1101
1140
|
|
|
1102
1141
|
/** Create an XCAF document from shape configs and export as STEP blob. */
|
|
1103
1142
|
export declare function exportAssemblySTEP(shapes?: FnShapeConfig[], { unit, modelUnit }?: {
|
|
1104
|
-
unit?:
|
|
1105
|
-
modelUnit?:
|
|
1143
|
+
unit?: SupportedUnit;
|
|
1144
|
+
modelUnit?: SupportedUnit;
|
|
1106
1145
|
}): Result<Blob>;
|
|
1107
1146
|
|
|
1108
1147
|
export declare function exportSTEP(shapes?: ShapeConfig[], { unit, modelUnit }?: {
|
|
@@ -1113,10 +1152,15 @@ export declare function exportSTEP(shapes?: ShapeConfig[], { unit, modelUnit }?:
|
|
|
1113
1152
|
/** Extrude a face along a vector to produce a solid. */
|
|
1114
1153
|
export declare function extrudeFace(face: FnFace, extrusionVec: Vec3): FnSolid;
|
|
1115
1154
|
|
|
1116
|
-
|
|
1155
|
+
/** Configuration for extrusion profile scaling along the path. */
|
|
1156
|
+
declare interface ExtrusionProfile {
|
|
1157
|
+
/** Profile curve type: 's-curve' for smooth easing, 'linear' for constant scaling */
|
|
1117
1158
|
profile?: 's-curve' | 'linear';
|
|
1159
|
+
/** End scale factor (1 = same size, 0.5 = half size at end) */
|
|
1118
1160
|
endFactor?: number;
|
|
1119
1161
|
}
|
|
1162
|
+
export { ExtrusionProfile }
|
|
1163
|
+
export { ExtrusionProfile as FnExtrusionProfile }
|
|
1120
1164
|
|
|
1121
1165
|
export declare class Face extends Shape {
|
|
1122
1166
|
protected _geomAdaptor(): OcType;
|
|
@@ -1181,12 +1225,12 @@ export declare function faceFinder(): FaceFinderFn;
|
|
|
1181
1225
|
export declare interface FaceFinderFn extends ShapeFinder<FnFace> {
|
|
1182
1226
|
readonly inDirection: (dir?: 'X' | 'Y' | 'Z' | Vec3, angle?: number) => FaceFinderFn;
|
|
1183
1227
|
readonly parallelTo: (dir?: 'X' | 'Y' | 'Z' | Vec3) => FaceFinderFn;
|
|
1184
|
-
readonly ofSurfaceType: (surfaceType:
|
|
1228
|
+
readonly ofSurfaceType: (surfaceType: SurfaceType) => FaceFinderFn;
|
|
1185
1229
|
readonly atDistance: (distance: number, point?: Vec3) => FaceFinderFn;
|
|
1186
1230
|
}
|
|
1187
1231
|
|
|
1188
1232
|
/** Get the surface type of a face (unwrapped convenience). */
|
|
1189
|
-
export declare function faceGeomType(face: FnFace):
|
|
1233
|
+
export declare function faceGeomType(face: FnFace): SurfaceType;
|
|
1190
1234
|
|
|
1191
1235
|
declare type FaceOrEdge = Face | Edge;
|
|
1192
1236
|
|
|
@@ -1234,12 +1278,6 @@ export declare interface FaceTriangulation {
|
|
|
1234
1278
|
verticesNormals: number[];
|
|
1235
1279
|
}
|
|
1236
1280
|
|
|
1237
|
-
declare interface FaceTriangulation_2 {
|
|
1238
|
-
vertices: number[];
|
|
1239
|
-
trianglesIndexes: number[];
|
|
1240
|
-
verticesNormals: number[];
|
|
1241
|
-
}
|
|
1242
|
-
|
|
1243
1281
|
export declare type FilletRadius = number | [number, number];
|
|
1244
1282
|
|
|
1245
1283
|
export declare type FilterFcn<Type> = {
|
|
@@ -1384,7 +1422,7 @@ export declare type FnAnyShape = FnVertex | FnEdge | FnWire | FnFace | FnShell |
|
|
|
1384
1422
|
export declare function fnBuildCompound(shapes: FnAnyShape[]): FnCompound;
|
|
1385
1423
|
|
|
1386
1424
|
/** Extrude a wire along a normal with optional profile shaping. */
|
|
1387
|
-
export declare function fnComplexExtrude(wire: FnWire, center: Vec3, normal: Vec3, profileShape?:
|
|
1425
|
+
export declare function fnComplexExtrude(wire: FnWire, center: Vec3, normal: Vec3, profileShape?: ExtrusionProfile, shellMode?: boolean): Result<FnShape3D | [FnShape3D, FnWire, FnWire]>;
|
|
1388
1426
|
|
|
1389
1427
|
export declare type FnCompound = ShapeHandle & {
|
|
1390
1428
|
readonly [__brand]: 'compound';
|
|
@@ -1426,11 +1464,6 @@ export declare function fnExportSTL(shape: FnAnyShape, { tolerance, angularToler
|
|
|
1426
1464
|
binary?: boolean;
|
|
1427
1465
|
}): Result<Blob>;
|
|
1428
1466
|
|
|
1429
|
-
export declare interface FnExtrusionProfile {
|
|
1430
|
-
profile?: 's-curve' | 'linear';
|
|
1431
|
-
endFactor?: number;
|
|
1432
|
-
}
|
|
1433
|
-
|
|
1434
1467
|
export declare type FnFace = ShapeHandle & {
|
|
1435
1468
|
readonly [__brand]: 'face';
|
|
1436
1469
|
};
|
|
@@ -1515,17 +1548,6 @@ export declare interface FnShapeConfig {
|
|
|
1515
1548
|
name?: string;
|
|
1516
1549
|
}
|
|
1517
1550
|
|
|
1518
|
-
export declare interface FnShapeMesh {
|
|
1519
|
-
triangles: Uint32Array;
|
|
1520
|
-
vertices: Float32Array;
|
|
1521
|
-
normals: Float32Array;
|
|
1522
|
-
faceGroups: {
|
|
1523
|
-
start: number;
|
|
1524
|
-
count: number;
|
|
1525
|
-
faceId: number;
|
|
1526
|
-
}[];
|
|
1527
|
-
}
|
|
1528
|
-
|
|
1529
1551
|
export declare type FnShell = ShapeHandle & {
|
|
1530
1552
|
readonly [__brand]: 'shell';
|
|
1531
1553
|
};
|
|
@@ -1540,13 +1562,11 @@ export declare type FnSolid = ShapeHandle & {
|
|
|
1540
1562
|
readonly [__brand]: 'solid';
|
|
1541
1563
|
};
|
|
1542
1564
|
|
|
1543
|
-
export declare type FnSupportedUnit = 'M' | 'CM' | 'MM' | 'INCH' | 'FT' | 'm' | 'mm' | 'cm' | 'inch' | 'ft';
|
|
1544
|
-
|
|
1545
1565
|
/** Extrude a wire with support surface. */
|
|
1546
|
-
export declare function fnSupportExtrude(wire: FnWire, center: Vec3, normal: Vec3, support:
|
|
1566
|
+
export declare function fnSupportExtrude(wire: FnWire, center: Vec3, normal: Vec3, support: OcType_4): Result<FnShape3D>;
|
|
1547
1567
|
|
|
1548
1568
|
/** Extrude a wire with twist along a normal. Angle is in degrees. */
|
|
1549
|
-
export declare function fnTwistExtrude(wire: FnWire, angleDegrees: number, center: Vec3, normal: Vec3, profileShape?:
|
|
1569
|
+
export declare function fnTwistExtrude(wire: FnWire, angleDegrees: number, center: Vec3, normal: Vec3, profileShape?: ExtrusionProfile, shellMode?: boolean): Result<FnShape3D | [FnShape3D, FnWire, FnWire]>;
|
|
1550
1570
|
|
|
1551
1571
|
/** Get the UV coordinates on a face for a given 3D point. */
|
|
1552
1572
|
export declare function fnUvCoordinates(face: FnFace, point: PointInput): [number, number];
|
|
@@ -1560,13 +1580,13 @@ export declare type FnWire = ShapeHandle & {
|
|
|
1560
1580
|
};
|
|
1561
1581
|
|
|
1562
1582
|
/** Extract Vec3 from OCCT gp_Dir */
|
|
1563
|
-
export declare function fromOcDir(ocDir:
|
|
1583
|
+
export declare function fromOcDir(ocDir: OcType_3): Vec3;
|
|
1564
1584
|
|
|
1565
1585
|
/** Extract Vec3 from OCCT gp_Pnt */
|
|
1566
|
-
export declare function fromOcPnt(ocPnt:
|
|
1586
|
+
export declare function fromOcPnt(ocPnt: OcType_3): Vec3;
|
|
1567
1587
|
|
|
1568
1588
|
/** Extract Vec3 from OCCT gp_Vec */
|
|
1569
|
-
export declare function fromOcVec(ocVec:
|
|
1589
|
+
export declare function fromOcVec(ocVec: OcType_3): Vec3;
|
|
1570
1590
|
|
|
1571
1591
|
export declare const fuse2D: (first: Shape2D, second: Shape2D) => Blueprint | Blueprints | CompoundBlueprint | null;
|
|
1572
1592
|
|
|
@@ -1588,10 +1608,14 @@ export declare const fuseBlueprints: (first: Blueprint, second: Blueprint) => nu
|
|
|
1588
1608
|
export declare function fuseShapes(a: FnShape3D, b: FnShape3D, { optimisation, simplify }?: BooleanOptions): Result<FnShape3D>;
|
|
1589
1609
|
|
|
1590
1610
|
/** Register a deletable value for GC when the given object is collected. */
|
|
1591
|
-
|
|
1611
|
+
declare function gcWithObject(obj: any): <T extends Deletable>(value: T) => T;
|
|
1612
|
+
export { gcWithObject as GCWithObject }
|
|
1613
|
+
export { gcWithObject }
|
|
1592
1614
|
|
|
1593
1615
|
/** Register a deletable value for GC when the scope function is collected. */
|
|
1594
|
-
|
|
1616
|
+
declare function gcWithScope(): <T extends Deletable>(value: T) => T;
|
|
1617
|
+
export { gcWithScope as GCWithScope }
|
|
1618
|
+
export { gcWithScope }
|
|
1595
1619
|
|
|
1596
1620
|
/**
|
|
1597
1621
|
* Sketchers allow the user to draw a two dimensional shape using segments of
|
|
@@ -1884,14 +1908,10 @@ export declare function genericSweep(wire: Wire, spine: Wire, sweepConfig: Gener
|
|
|
1884
1908
|
|
|
1885
1909
|
export declare function genericSweep(wire: Wire, spine: Wire, sweepConfig: GenericSweepConfig, shellMode?: false): Result<Shape3D>;
|
|
1886
1910
|
|
|
1887
|
-
|
|
1888
|
-
|
|
1911
|
+
/** Configuration for sweep operations in the OO API. */
|
|
1912
|
+
export declare interface GenericSweepConfig extends Omit<SweepConfig, 'auxiliarySpine'> {
|
|
1913
|
+
/** Auxiliary spine for twist control (Wire or Edge in OO API) */
|
|
1889
1914
|
auxiliarySpine?: Wire | Edge;
|
|
1890
|
-
law?: OcType;
|
|
1891
|
-
transitionMode?: 'right' | 'transformed' | 'round';
|
|
1892
|
-
withContact?: boolean;
|
|
1893
|
-
support?: OcType;
|
|
1894
|
-
forceProfileSpineOthogonality?: boolean;
|
|
1895
1915
|
}
|
|
1896
1916
|
|
|
1897
1917
|
export declare type GenericTopo = OcShape;
|
|
@@ -1920,7 +1940,7 @@ export declare function getShapeKind(shape: FnAnyShape): ShapeKind;
|
|
|
1920
1940
|
export declare function getSingleFace(f: SingleFace, shape: AnyShape): Result<Face>;
|
|
1921
1941
|
|
|
1922
1942
|
/** Get the geometric surface type of a face. */
|
|
1923
|
-
export declare function getSurfaceType(face: FnFace): Result<
|
|
1943
|
+
export declare function getSurfaceType(face: FnFace): Result<SurfaceType>;
|
|
1924
1944
|
|
|
1925
1945
|
/** Get all wires of a shape as branded Wire handles. */
|
|
1926
1946
|
export declare function getWires(shape: FnAnyShape): FnWire[];
|
|
@@ -2006,10 +2026,22 @@ export declare function loftWires(wires: FnWire[], { ruled, startPoint, endPoint
|
|
|
2006
2026
|
|
|
2007
2027
|
export declare function lookFromPlane(projectionPlane: ProjectionPlane): ProjectionCamera;
|
|
2008
2028
|
|
|
2029
|
+
/**
|
|
2030
|
+
* @deprecated Use makeOcAx1 from occtBoundary.ts with Vec3 tuples instead.
|
|
2031
|
+
* @see makeOcAx1
|
|
2032
|
+
*/
|
|
2009
2033
|
export declare const makeAx1: (center: Point, dir: Point) => OcType;
|
|
2010
2034
|
|
|
2035
|
+
/**
|
|
2036
|
+
* @deprecated Use makeOcAx2 from occtBoundary.ts with Vec3 tuples instead.
|
|
2037
|
+
* @see makeOcAx2
|
|
2038
|
+
*/
|
|
2011
2039
|
export declare const makeAx2: (center: Point, dir: Point, xDir?: Point) => OcType;
|
|
2012
2040
|
|
|
2041
|
+
/**
|
|
2042
|
+
* @deprecated Use makeOcAx3 from occtBoundary.ts with Vec3 tuples instead.
|
|
2043
|
+
* @see makeOcAx3
|
|
2044
|
+
*/
|
|
2013
2045
|
export declare const makeAx3: (center: Point, dir: Point, xDir?: Point) => OcType;
|
|
2014
2046
|
|
|
2015
2047
|
export declare const makeBaseBox: (xLength: number, yLength: number, zLength: number) => Shape3D;
|
|
@@ -2144,10 +2176,12 @@ export declare interface MeshOptions {
|
|
|
2144
2176
|
export declare function meshShape(shape: FnAnyShape, { tolerance, angularTolerance, skipNormals, cache, }?: MeshOptions & {
|
|
2145
2177
|
skipNormals?: boolean;
|
|
2146
2178
|
cache?: boolean;
|
|
2147
|
-
}):
|
|
2179
|
+
}): ShapeMesh;
|
|
2148
2180
|
|
|
2149
2181
|
/** Mesh the edges of a shape as line segments for edge rendering. */
|
|
2150
|
-
export declare function meshShapeEdges(shape: FnAnyShape, { tolerance, angularTolerance }?: MeshOptions
|
|
2182
|
+
export declare function meshShapeEdges(shape: FnAnyShape, { tolerance, angularTolerance, cache }?: MeshOptions & {
|
|
2183
|
+
cache?: boolean;
|
|
2184
|
+
}): EdgeMesh;
|
|
2151
2185
|
|
|
2152
2186
|
export declare function mirror(shape: OcType, inputPlane?: Plane | PlaneName | Point, origin?: Point): OcType;
|
|
2153
2187
|
|
|
@@ -2175,13 +2209,19 @@ declare type OcShape = any;
|
|
|
2175
2209
|
|
|
2176
2210
|
declare type OcType = any;
|
|
2177
2211
|
|
|
2212
|
+
/**
|
|
2213
|
+
* Shared utilities for extrusion operations.
|
|
2214
|
+
* Used by both class-based (extrude.ts) and functional (extrudeFns.ts) APIs.
|
|
2215
|
+
*/
|
|
2178
2216
|
declare type OcType_2 = any;
|
|
2179
2217
|
|
|
2218
|
+
declare type OcType_3 = any;
|
|
2219
|
+
|
|
2180
2220
|
/**
|
|
2181
2221
|
* Functional extrusion operations using Vec3 tuples and branded shape types.
|
|
2182
2222
|
* Immutable: all functions return new shapes without disposing inputs.
|
|
2183
2223
|
*/
|
|
2184
|
-
declare type
|
|
2224
|
+
declare type OcType_4 = any;
|
|
2185
2225
|
|
|
2186
2226
|
declare interface Offset2DConfig {
|
|
2187
2227
|
lineJoinType?: 'miter' | 'bevel' | 'round';
|
|
@@ -2228,6 +2268,20 @@ export declare interface PhysicalProps {
|
|
|
2228
2268
|
/** Pivot plane by rotating around an axis. */
|
|
2229
2269
|
export declare function pivotPlane(plane: FnPlane, angleDeg: number, axis?: Vec3): FnPlane;
|
|
2230
2270
|
|
|
2271
|
+
/**
|
|
2272
|
+
* @deprecated Use the Plane interface from planeTypes.ts with planeOps functions instead.
|
|
2273
|
+
* @example
|
|
2274
|
+
* // Before (legacy):
|
|
2275
|
+
* const plane = new Plane([0, 0, 0], [1, 0, 0], [0, 0, 1]);
|
|
2276
|
+
* const moved = plane.translate([1, 0, 0]);
|
|
2277
|
+
*
|
|
2278
|
+
* // After (functional):
|
|
2279
|
+
* import { createPlane, translatePlane, type Plane as FnPlane } from 'brepjs';
|
|
2280
|
+
* const plane: FnPlane = createPlane([0, 0, 0], [1, 0, 0], [0, 0, 1]);
|
|
2281
|
+
* const moved = translatePlane(plane, [1, 0, 0]);
|
|
2282
|
+
*
|
|
2283
|
+
* @see createPlane, translatePlane, pivotPlane, rotatePlane2DAxes
|
|
2284
|
+
*/
|
|
2231
2285
|
export declare class Plane {
|
|
2232
2286
|
oc: OpenCascadeInstance;
|
|
2233
2287
|
xDir: Vector;
|
|
@@ -2381,9 +2435,11 @@ export declare function scaleShape<T extends FnAnyShape>(shape: T, factor: numbe
|
|
|
2381
2435
|
export declare function serializeShape(shape: FnAnyShape): string;
|
|
2382
2436
|
|
|
2383
2437
|
/**
|
|
2384
|
-
* Set the maximum cache size
|
|
2438
|
+
* Set the maximum cache size for the legacy cache.
|
|
2439
|
+
* Note: WeakMap caches are automatically managed by GC and don't have a size limit.
|
|
2440
|
+
* @deprecated The WeakMap-based cache doesn't use size limits
|
|
2385
2441
|
*/
|
|
2386
|
-
export declare function setMeshCacheSize(
|
|
2442
|
+
export declare function setMeshCacheSize(_size: number): void;
|
|
2387
2443
|
|
|
2388
2444
|
export declare const setOC: (oc: OpenCascadeInstance) => void;
|
|
2389
2445
|
|
|
@@ -2466,9 +2522,10 @@ export declare class Shape<Type extends Deletable = OcShape> extends WrappingObj
|
|
|
2466
2522
|
*
|
|
2467
2523
|
* @category Shape Export
|
|
2468
2524
|
*/
|
|
2469
|
-
meshEdges({ tolerance, angularTolerance }?: {
|
|
2470
|
-
tolerance?: number
|
|
2471
|
-
angularTolerance?: number
|
|
2525
|
+
meshEdges({ tolerance, angularTolerance, cache, }?: {
|
|
2526
|
+
tolerance?: number;
|
|
2527
|
+
angularTolerance?: number;
|
|
2528
|
+
cache?: boolean;
|
|
2472
2529
|
}): {
|
|
2473
2530
|
lines: number[];
|
|
2474
2531
|
edgeGroups: {
|
|
@@ -2537,7 +2594,7 @@ export declare interface ShapeHandle {
|
|
|
2537
2594
|
|
|
2538
2595
|
export declare type ShapeKind = 'vertex' | 'edge' | 'wire' | 'face' | 'shell' | 'solid' | 'compsolid' | 'compound';
|
|
2539
2596
|
|
|
2540
|
-
|
|
2597
|
+
declare interface ShapeMesh {
|
|
2541
2598
|
triangles: Uint32Array;
|
|
2542
2599
|
vertices: Float32Array;
|
|
2543
2600
|
normals: Float32Array;
|
|
@@ -2547,29 +2604,25 @@ export declare interface ShapeMesh {
|
|
|
2547
2604
|
faceId: number;
|
|
2548
2605
|
}[];
|
|
2549
2606
|
}
|
|
2607
|
+
export { ShapeMesh as FnShapeMesh }
|
|
2608
|
+
export { ShapeMesh }
|
|
2550
2609
|
|
|
2551
2610
|
declare namespace ShapesModule {
|
|
2552
2611
|
export {
|
|
2553
|
-
registerQueryModule,
|
|
2554
|
-
isNumber,
|
|
2555
|
-
isChamferRadius,
|
|
2556
|
-
isFilletRadius,
|
|
2557
2612
|
isShape3D_2 as isShape3D,
|
|
2558
|
-
buildCompoundOc,
|
|
2559
|
-
buildCompound,
|
|
2560
|
-
applyGlue,
|
|
2561
|
-
fuseAll,
|
|
2562
|
-
cutAll,
|
|
2563
2613
|
CurveType,
|
|
2564
2614
|
AnyShape,
|
|
2565
2615
|
Shape3D,
|
|
2566
2616
|
CurveLike,
|
|
2567
|
-
ChamferRadius,
|
|
2568
|
-
FilletRadius,
|
|
2569
|
-
RadiusConfig,
|
|
2570
2617
|
FaceTriangulation,
|
|
2571
2618
|
ShapeMesh,
|
|
2572
2619
|
SurfaceType,
|
|
2620
|
+
ChamferRadius,
|
|
2621
|
+
FilletRadius,
|
|
2622
|
+
RadiusConfig,
|
|
2623
|
+
isNumber,
|
|
2624
|
+
isChamferRadius,
|
|
2625
|
+
isFilletRadius,
|
|
2573
2626
|
BooleanOperationOptions,
|
|
2574
2627
|
Shape,
|
|
2575
2628
|
Vertex,
|
|
@@ -2583,7 +2636,13 @@ declare namespace ShapesModule {
|
|
|
2583
2636
|
Shell,
|
|
2584
2637
|
Solid,
|
|
2585
2638
|
CompSolid,
|
|
2586
|
-
Compound
|
|
2639
|
+
Compound,
|
|
2640
|
+
fuseAll,
|
|
2641
|
+
cutAll,
|
|
2642
|
+
buildCompound,
|
|
2643
|
+
buildCompoundOc,
|
|
2644
|
+
applyGlue,
|
|
2645
|
+
registerQueryModule
|
|
2587
2646
|
}
|
|
2588
2647
|
}
|
|
2589
2648
|
|
|
@@ -2941,7 +3000,10 @@ declare type StartSplineTangent = number | Point2D;
|
|
|
2941
3000
|
/** Stretch a blueprint. Returns a new Blueprint. */
|
|
2942
3001
|
export declare function stretchBlueprint(bp: Blueprint, ratio: number, direction: Point2D, origin?: Point2D): Blueprint;
|
|
2943
3002
|
|
|
2944
|
-
|
|
3003
|
+
/** Supported length units for STEP export. */
|
|
3004
|
+
declare type SupportedUnit = 'M' | 'CM' | 'MM' | 'INCH' | 'FT' | 'm' | 'mm' | 'cm' | 'inch' | 'ft';
|
|
3005
|
+
export { SupportedUnit as FnSupportedUnit }
|
|
3006
|
+
export { SupportedUnit }
|
|
2945
3007
|
|
|
2946
3008
|
export declare const supportExtrude: (wire: Wire, center: Point, normal: Point, support: OcType) => Result<Shape3D>;
|
|
2947
3009
|
|
|
@@ -2955,18 +3017,26 @@ export declare class SurfacePhysicalProperties extends PhysicalProperties {
|
|
|
2955
3017
|
|
|
2956
3018
|
export declare type SurfaceType = 'PLANE' | 'CYLINDRE' | 'CONE' | 'SPHERE' | 'TORUS' | 'BEZIER_SURFACE' | 'BSPLINE_SURFACE' | 'REVOLUTION_SURFACE' | 'EXTRUSION_SURFACE' | 'OFFSET_SURFACE' | 'OTHER_SURFACE';
|
|
2957
3019
|
|
|
2958
|
-
declare type SurfaceType_2 = 'PLANE' | 'CYLINDRE' | 'CONE' | 'SPHERE' | 'TORUS' | 'BEZIER_SURFACE' | 'BSPLINE_SURFACE' | 'REVOLUTION_SURFACE' | 'EXTRUSION_SURFACE' | 'OFFSET_SURFACE' | 'OTHER_SURFACE';
|
|
2959
|
-
|
|
2960
3020
|
/** Sweep a wire profile along a spine. Returns a solid or shell+wires. */
|
|
2961
3021
|
export declare function sweep(wire: FnWire, spine: FnWire, config?: SweepConfig, shellMode?: boolean): Result<FnShape3D | [FnShape3D, FnWire, FnWire]>;
|
|
2962
3022
|
|
|
3023
|
+
/** Configuration for sweep/pipe operations along a spine. */
|
|
2963
3024
|
export declare interface SweepConfig {
|
|
3025
|
+
/** Use Frenet trihedron for profile orientation */
|
|
2964
3026
|
frenet?: boolean;
|
|
2965
|
-
|
|
2966
|
-
|
|
3027
|
+
/** Auxiliary spine for twist control */
|
|
3028
|
+
auxiliarySpine?: {
|
|
3029
|
+
wrapped: OcType_2;
|
|
3030
|
+
};
|
|
3031
|
+
/** Scaling law along the path */
|
|
3032
|
+
law?: OcType_2;
|
|
3033
|
+
/** Transition mode at corners: 'right' (sharp), 'transformed', or 'round' */
|
|
2967
3034
|
transitionMode?: 'right' | 'transformed' | 'round';
|
|
3035
|
+
/** Enable contact detection */
|
|
2968
3036
|
withContact?: boolean;
|
|
2969
|
-
|
|
3037
|
+
/** Support surface for constrained sweeps */
|
|
3038
|
+
support?: OcType_2;
|
|
3039
|
+
/** Force profile to be orthogonal to spine */
|
|
2970
3040
|
forceProfileSpineOthogonality?: boolean;
|
|
2971
3041
|
}
|
|
2972
3042
|
|
|
@@ -2978,7 +3048,7 @@ export declare function textBlueprints(text: string, { startX, startY, fontSize,
|
|
|
2978
3048
|
}): Blueprints;
|
|
2979
3049
|
|
|
2980
3050
|
/** Convert Vec3 to OCCT gp_Vec. Caller must call .delete() when done. */
|
|
2981
|
-
export declare function toOcVec(v: Vec3):
|
|
3051
|
+
export declare function toOcVec(v: Vec3): OcType_3;
|
|
2982
3052
|
|
|
2983
3053
|
export declare type TopoEntity = 'vertex' | 'edge' | 'wire' | 'face' | 'shell' | 'solid' | 'solidCompound' | 'compound' | 'shape';
|
|
2984
3054
|
|
|
@@ -2988,6 +3058,20 @@ export declare function toVec2(p: PointInput): Vec2;
|
|
|
2988
3058
|
/** Normalize any point input to Vec3 */
|
|
2989
3059
|
export declare function toVec3(p: PointInput): Vec3;
|
|
2990
3060
|
|
|
3061
|
+
/**
|
|
3062
|
+
* @deprecated Use standalone transform functions instead.
|
|
3063
|
+
* @example
|
|
3064
|
+
* // Before (legacy):
|
|
3065
|
+
* const trsf = new Transformation();
|
|
3066
|
+
* trsf.translate([1, 0, 0]);
|
|
3067
|
+
* const newShape = trsf.transform(shape.wrapped);
|
|
3068
|
+
*
|
|
3069
|
+
* // After (functional):
|
|
3070
|
+
* import { translateShape } from 'brepjs';
|
|
3071
|
+
* const newShape = translateShape(shape, [1, 0, 0]);
|
|
3072
|
+
*
|
|
3073
|
+
* @see translateShape, rotateShape, mirrorShape, scaleShape
|
|
3074
|
+
*/
|
|
2991
3075
|
export declare class Transformation extends WrappingObj<OcType> {
|
|
2992
3076
|
constructor(transform?: OcType);
|
|
2993
3077
|
translate(xDist: number, yDist: number, zDist: number): Transformation;
|
|
@@ -3020,7 +3104,7 @@ export declare function translateShape<T extends FnAnyShape>(shape: T, v: Vec3):
|
|
|
3020
3104
|
* Triangulate a face. Returns triangulation data or null if unavailable.
|
|
3021
3105
|
* @deprecated Use meshShape() instead for better performance via bulk C++ extraction.
|
|
3022
3106
|
*/
|
|
3023
|
-
export declare function triangulateFace(face: FnFace, index0?: number, skipNormals?: boolean):
|
|
3107
|
+
export declare function triangulateFace(face: FnFace, index0?: number, skipNormals?: boolean): FaceTriangulation | null;
|
|
3024
3108
|
|
|
3025
3109
|
/**
|
|
3026
3110
|
* Wraps a throwing function into a Result.
|
|
@@ -3115,6 +3199,18 @@ export declare function vecScale(v: Vec3, s: number): Vec3;
|
|
|
3115
3199
|
|
|
3116
3200
|
export declare function vecSub(a: Vec3, b: Vec3): Vec3;
|
|
3117
3201
|
|
|
3202
|
+
/**
|
|
3203
|
+
* @deprecated Use Vec3 tuples with vecOps functions instead.
|
|
3204
|
+
* @example
|
|
3205
|
+
* // Before (legacy):
|
|
3206
|
+
* const v = new Vector([1, 2, 3]);
|
|
3207
|
+
* const result = v.add(new Vector([4, 5, 6]));
|
|
3208
|
+
*
|
|
3209
|
+
* // After (functional):
|
|
3210
|
+
* import { vecAdd, type Vec3 } from 'brepjs';
|
|
3211
|
+
* const v: Vec3 = [1, 2, 3];
|
|
3212
|
+
* const result = vecAdd(v, [4, 5, 6]);
|
|
3213
|
+
*/
|
|
3118
3214
|
export declare class Vector extends WrappingObj<OcType> {
|
|
3119
3215
|
constructor(vector?: Point);
|
|
3120
3216
|
get repr(): string;
|
|
@@ -3167,13 +3263,13 @@ export declare class Wire extends _1DShape {
|
|
|
3167
3263
|
}
|
|
3168
3264
|
|
|
3169
3265
|
/** Execute fn with a temporary OCCT gp_Dir, auto-deleted after. */
|
|
3170
|
-
export declare function withOcDir<T>(v: Vec3, fn: (ocDir:
|
|
3266
|
+
export declare function withOcDir<T>(v: Vec3, fn: (ocDir: OcType_3) => T): T;
|
|
3171
3267
|
|
|
3172
3268
|
/** Execute fn with a temporary OCCT gp_Pnt, auto-deleted after. */
|
|
3173
|
-
export declare function withOcPnt<T>(v: Vec3, fn: (ocPnt:
|
|
3269
|
+
export declare function withOcPnt<T>(v: Vec3, fn: (ocPnt: OcType_3) => T): T;
|
|
3174
3270
|
|
|
3175
3271
|
/** Execute fn with a temporary OCCT gp_Vec, auto-deleted after. */
|
|
3176
|
-
export declare function withOcVec<T>(v: Vec3, fn: (ocVec:
|
|
3272
|
+
export declare function withOcVec<T>(v: Vec3, fn: (ocVec: OcType_3) => T): T;
|
|
3177
3273
|
|
|
3178
3274
|
/** Execute a function with a disposal scope. Resources registered with the scope
|
|
3179
3275
|
* are automatically cleaned up when the function returns. */
|