brepjs-bim 0.24.0 → 0.24.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 +12 -3
- package/dist/brepjs-bim.cjs +3734 -2007
- package/dist/brepjs-bim.js +3732 -2005
- package/dist/elementFns/placedGeometry.d.ts +1 -1
- package/dist/familiesAdapter.d.ts +15 -3
- package/dist/familiesFrame.d.ts +11 -0
- package/dist/familiesProductBody.d.ts +40 -0
- package/dist/ifc-writer/tessellationWriter.d.ts +1 -1
- package/dist/import/placement.d.ts +1 -46
- package/dist/import/spfReader.d.ts +3 -3
- package/dist/index.d.ts +1 -1
- package/dist/placementFrame.d.ts +47 -36
- package/dist/rigidPlacement.d.ts +2 -2
- package/package.json +3 -3
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ValidSolid, Result } from 'brepjs';
|
|
2
2
|
import { AnyBimElement } from '../types/bimTypes.js';
|
|
3
3
|
import { BimError } from '../errors/bimError.js';
|
|
4
|
-
import { FrameInput } from '../
|
|
4
|
+
import { FrameInput } from '../placementFrame.js';
|
|
5
5
|
export interface PlacedGeometryTestHooks {
|
|
6
6
|
readonly afterPlaced?: ((solid: ValidSolid) => void) | undefined;
|
|
7
7
|
}
|
|
@@ -9,9 +9,16 @@ export interface FamiliesToBimOptions {
|
|
|
9
9
|
readonly siteName?: string | undefined;
|
|
10
10
|
readonly buildingName?: string | undefined;
|
|
11
11
|
/**
|
|
12
|
-
* Materializes exact evaluated Product Bodies for supported typed routes
|
|
13
|
-
*
|
|
14
|
-
*
|
|
12
|
+
* Materializes exact evaluated Product Bodies for supported typed routes.
|
|
13
|
+
* Earthworks Fill always retains that Body. Civil-semantic walls and railings
|
|
14
|
+
* require this evaluator (or `proxyEvaluator`) before projection: absence
|
|
15
|
+
* returns FAMILIES_PRODUCT_BODY_EVALUATOR_REQUIRED with the element path and
|
|
16
|
+
* mapped category, and does not fall back to a parametric envelope.
|
|
17
|
+
* Conventional archetype walls and railings stay specification-authoritative
|
|
18
|
+
* and do not require an evaluator. When present, civil walls and railings
|
|
19
|
+
* compare the evaluated Body with their post-opening parametric Body and
|
|
20
|
+
* retain the authored Body when they differ. Supplying this option does not
|
|
21
|
+
* opt unsupported products into the proxy fallback.
|
|
15
22
|
*/
|
|
16
23
|
readonly bodyEvaluator?: csg.Evaluator | undefined;
|
|
17
24
|
/**
|
|
@@ -44,6 +51,11 @@ export interface FamiliesBimResult {
|
|
|
44
51
|
*/
|
|
45
52
|
readonly proxied: readonly ProxiedElement[];
|
|
46
53
|
}
|
|
54
|
+
export interface FamiliesAdapterTestHooks {
|
|
55
|
+
readonly afterCivilProductBody?: ((model: BimModel, localId: LocalId, element: ResolvedElement) => void) | undefined;
|
|
56
|
+
}
|
|
57
|
+
/** Package-internal deterministic failure seam for projection ownership tests. */
|
|
58
|
+
export declare function setFamiliesAdapterTestHooksForTesting(hooks: FamiliesAdapterTestHooks | null): void;
|
|
47
59
|
/**
|
|
48
60
|
* Project a resolved families tree into an eager BimModel. The caller owns
|
|
49
61
|
* the returned model (`using`); families stays domain-neutral — this adapter
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Result } from 'brepjs';
|
|
2
|
+
import { TransformOp } from 'brepjs-families';
|
|
3
|
+
import { BimError } from './errors/bimError.js';
|
|
4
|
+
import { RigidFrame } from './placementFrame.js';
|
|
5
|
+
export declare function frameFromOps(ops: readonly TransformOp[]): Result<RigidFrame, BimError>;
|
|
6
|
+
/** Private projection control flow: the outer adapter converts this back to Result. */
|
|
7
|
+
export declare class FrameProjectionError extends Error {
|
|
8
|
+
readonly error: BimError;
|
|
9
|
+
constructor(error: BimError);
|
|
10
|
+
}
|
|
11
|
+
export declare function requireFrame(result: Result<RigidFrame, BimError>): RigidFrame;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { Result, Solid, ValidSolid, csg } from 'brepjs';
|
|
2
|
+
import { ResolvedElement } from 'brepjs-families';
|
|
3
|
+
import { BimError } from './errors/bimError.js';
|
|
4
|
+
import { ProductBody } from './types/productBody.js';
|
|
5
|
+
import { RigidFrame } from './placementFrame.js';
|
|
6
|
+
type ExactProductBody = Extract<ProductBody, {
|
|
7
|
+
readonly kind: 'EXACT';
|
|
8
|
+
}>;
|
|
9
|
+
type ParametricProductBody = Extract<ProductBody, {
|
|
10
|
+
readonly kind: 'PARAMETRIC';
|
|
11
|
+
}>;
|
|
12
|
+
export type CivilProductBodySelection = {
|
|
13
|
+
readonly kind: 'PARAMETRIC';
|
|
14
|
+
} | {
|
|
15
|
+
readonly kind: 'EXACT';
|
|
16
|
+
readonly body: ExactProductBody;
|
|
17
|
+
};
|
|
18
|
+
export interface CivilProductBodyInput {
|
|
19
|
+
readonly element: ResolvedElement;
|
|
20
|
+
readonly category: 'WALL' | 'RAILING';
|
|
21
|
+
readonly evaluator: csg.Evaluator;
|
|
22
|
+
readonly productWorldFrame: RigidFrame;
|
|
23
|
+
/** Borrowed model-owned comparison candidate after registered openings. */
|
|
24
|
+
readonly parametricBody: ParametricProductBody;
|
|
25
|
+
}
|
|
26
|
+
export interface FamiliesProductBodyTestHooks {
|
|
27
|
+
readonly afterCopy?: ((itemIndex: number, solid: Solid, source: Solid) => void) | undefined;
|
|
28
|
+
readonly beforeLocalize?: ((itemIndex: number, solid: ValidSolid) => void) | undefined;
|
|
29
|
+
readonly afterLocalized?: ((itemIndex: number, solid: ValidSolid) => void) | undefined;
|
|
30
|
+
readonly beforeCoincidence?: ((exact: ExactProductBody, parametric: ParametricProductBody) => void) | undefined;
|
|
31
|
+
}
|
|
32
|
+
/** Package-internal deterministic failure seams for exact ownership tests. */
|
|
33
|
+
export declare function setFamiliesProductBodyTestHooksForTesting(hooks: FamiliesProductBodyTestHooks | null): void;
|
|
34
|
+
/**
|
|
35
|
+
* Evaluates a civil Product Body, clones and localizes every borrowed source,
|
|
36
|
+
* then proves whether the registered-opening parametric Body is coincident.
|
|
37
|
+
* An EXACT result is caller-owned until takeExactProductBody() succeeds.
|
|
38
|
+
*/
|
|
39
|
+
export declare function selectCivilProductBody(input: CivilProductBodyInput): Result<CivilProductBodySelection, BimError>;
|
|
40
|
+
export {};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ValidSolid } from 'brepjs';
|
|
2
2
|
import { IfcWriter } from './ifcWriter.js';
|
|
3
|
-
import { FrameInput } from '../
|
|
3
|
+
import { FrameInput } from '../placementFrame.js';
|
|
4
4
|
import { NonEmpty } from '../types/productBody.js';
|
|
5
5
|
export interface TessellationResult {
|
|
6
6
|
readonly productDefinitionShapeId: number;
|
|
@@ -1,30 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Mat4x4, Vec3 } from '../placementFrame.js';
|
|
2
2
|
import { SpfReader } from './spfReader.js';
|
|
3
|
-
/**
|
|
4
|
-
* Column-major 4x4 transform, matching the layout web-ifc and OCCT use:
|
|
5
|
-
* column c, row r lives at index c*4 + r. Columns 0-2 are the basis vectors
|
|
6
|
-
* (axisX, axisY, axisZ); column 3 is the translation; the bottom row is
|
|
7
|
-
* [0,0,0,1].
|
|
8
|
-
*/
|
|
9
|
-
export type Mat4x4 = readonly [
|
|
10
|
-
number,
|
|
11
|
-
number,
|
|
12
|
-
number,
|
|
13
|
-
number,
|
|
14
|
-
number,
|
|
15
|
-
number,
|
|
16
|
-
number,
|
|
17
|
-
number,
|
|
18
|
-
number,
|
|
19
|
-
number,
|
|
20
|
-
number,
|
|
21
|
-
number,
|
|
22
|
-
number,
|
|
23
|
-
number,
|
|
24
|
-
number,
|
|
25
|
-
number
|
|
26
|
-
];
|
|
27
|
-
export type Vec3 = readonly [number, number, number];
|
|
28
3
|
/** A placement decomposed into origin + the two stored IFC axes (Z, X). */
|
|
29
4
|
export interface WorldPlacement {
|
|
30
5
|
/** Translation in millimetres (file units scaled to mm). */
|
|
@@ -78,26 +53,6 @@ export declare function composeWorldPlacement(reader: SpfReader, placementExpres
|
|
|
78
53
|
* always a proper rotation.
|
|
79
54
|
*/
|
|
80
55
|
export declare function readAxis2Placement3D(reader: SpfReader, placementExpressId: number, scale: number): Mat4x4 | null;
|
|
81
|
-
/** An (origin, axisX, axisZ) frame in mm — the authoring/display side of a placement. */
|
|
82
|
-
export interface FrameInput {
|
|
83
|
-
readonly origin: Vec3;
|
|
84
|
-
readonly axisX: Vec3;
|
|
85
|
-
readonly axisZ: Vec3;
|
|
86
|
-
}
|
|
87
|
-
/**
|
|
88
|
-
* Builds a row-major MatrixTransform (for brepjs `applyMatrix`) from an
|
|
89
|
-
* (origin, axisX, axisZ) frame, using the SAME IFC orthonormalization as
|
|
90
|
-
* {@link readAxis2Placement3D}: z = normalize(axisZ); x = normalize(axisX
|
|
91
|
-
* projected onto the plane ⊥ z); y = z × x. The basis vectors are the matrix
|
|
92
|
-
* columns, so the row-major linear array is [Xx,Yx,Zx, Xy,Yy,Zy, Xz,Yz,Zz];
|
|
93
|
-
* translation = origin (mm). This is the display-side counterpart to the IFC
|
|
94
|
-
* writer's Axis2Placement3D (Axis=Z, RefDirection=X) so on-screen placement and
|
|
95
|
-
* the IFC export agree.
|
|
96
|
-
*/
|
|
97
|
-
export declare function placementToMatrix(f: FrameInput): MatrixTransform;
|
|
98
|
-
/** Decomposes a column-major matrix into origin (mm) + IFC axes (Z, X). */
|
|
99
|
-
export declare function decomposePlacement(m: Mat4x4): WorldPlacement;
|
|
100
|
-
export declare function identityMatrix(): Mat4x4;
|
|
101
56
|
/**
|
|
102
57
|
* Reads the IfcMapConversion georeferencing offset (Eastings/Northings/
|
|
103
58
|
* OrthogonalHeight, scaled to mm) and true-north rotation. Returns null when
|
|
@@ -33,11 +33,11 @@ export declare class SpfReader {
|
|
|
33
33
|
/** Uppercased IFC entity name of the instance (e.g. `IFCWALL`). */
|
|
34
34
|
typeNameOf(expressId: number): string;
|
|
35
35
|
getLineType(expressId: number): number;
|
|
36
|
-
/** Builds web-ifc's
|
|
36
|
+
/** Builds a JS-owned index without web-ifc's unreleased per-type native vectors. */
|
|
37
37
|
buildGuidMap(): void;
|
|
38
|
-
/** expressId for a GlobalId, or undefined.
|
|
38
|
+
/** expressId for a GlobalId, or undefined. Builds the index on first lookup. */
|
|
39
39
|
expressIdFromGuid(guid: string): number | undefined;
|
|
40
|
-
/** GlobalId for an express id, or undefined.
|
|
40
|
+
/** GlobalId for an express id, or undefined. Builds the index on first lookup. */
|
|
41
41
|
guidFromExpressId(expressId: number): string | undefined;
|
|
42
42
|
/**
|
|
43
43
|
* Composed world transform (column-major 16-float matrix) for a placement
|
package/dist/index.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ export { placedSolids } from './elementFns/placedGeometry.js';
|
|
|
4
4
|
export { bodySolids } from './types/productBody.js';
|
|
5
5
|
export type { NonEmpty, ProductBody } from './types/productBody.js';
|
|
6
6
|
export type { PlacedSolidsOptions } from './elementFns/placedGeometry.js';
|
|
7
|
-
export type { FrameInput } from './
|
|
7
|
+
export type { FrameInput } from './placementFrame.js';
|
|
8
8
|
export { toIfc, toIfcValidated } from './serialize/toIfc.js';
|
|
9
9
|
export type { ValidatedIfcResult } from './serialize/toIfc.js';
|
|
10
10
|
export { setIfcWasmLocateFile } from './ifcRuntime.js';
|
package/dist/placementFrame.d.ts
CHANGED
|
@@ -1,36 +1,47 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
export type
|
|
4
|
-
export
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
export declare function
|
|
1
|
+
import { Result, MatrixTransform } from 'brepjs';
|
|
2
|
+
import { BimError } from './errors/bimError.js';
|
|
3
|
+
export type Vec3 = readonly [number, number, number];
|
|
4
|
+
export type Mat4x4 = readonly [
|
|
5
|
+
number,
|
|
6
|
+
number,
|
|
7
|
+
number,
|
|
8
|
+
number,
|
|
9
|
+
number,
|
|
10
|
+
number,
|
|
11
|
+
number,
|
|
12
|
+
number,
|
|
13
|
+
number,
|
|
14
|
+
number,
|
|
15
|
+
number,
|
|
16
|
+
number,
|
|
17
|
+
number,
|
|
18
|
+
number,
|
|
19
|
+
number,
|
|
20
|
+
number
|
|
21
|
+
];
|
|
22
|
+
export interface FrameInput {
|
|
23
|
+
readonly origin: Vec3;
|
|
24
|
+
readonly axisX: Vec3;
|
|
25
|
+
readonly axisZ: Vec3;
|
|
26
|
+
}
|
|
27
|
+
/** Construction is private; every exposed matrix is an immutable snapshot. */
|
|
28
|
+
declare class RigidFrame {
|
|
29
|
+
#private;
|
|
30
|
+
private constructor();
|
|
31
|
+
get matrix(): Mat4x4;
|
|
32
|
+
static fromMatrix(input: unknown): Result<RigidFrame, BimError>;
|
|
33
|
+
}
|
|
34
|
+
export type { RigidFrame };
|
|
35
|
+
export declare function frameFromMatrix(input: unknown): Result<RigidFrame, BimError>;
|
|
36
|
+
export declare function frameFromPlacement(input: unknown): Result<RigidFrame, BimError>;
|
|
37
|
+
export declare function decomposeFrame(frame: RigidFrame): FrameInput;
|
|
38
|
+
export declare function rotationFrame(angleDeg: number, axis?: unknown, at?: unknown): Result<RigidFrame, BimError>;
|
|
39
|
+
export declare const IDENTITY_FRAME: RigidFrame;
|
|
40
|
+
export declare function translationFrame(v: unknown): Result<RigidFrame, BimError>;
|
|
41
|
+
/** Right operand acts first. Revalidate the result, including translation overflow. */
|
|
42
|
+
export declare function frameMul(a: RigidFrame, b: RigidFrame): Result<RigidFrame, BimError>;
|
|
43
|
+
export declare function frameInverse(frame: RigidFrame): Result<RigidFrame, BimError>;
|
|
44
|
+
export declare function frameOrigin(frame: RigidFrame): Vec3;
|
|
45
|
+
export declare function isPureTranslation(frame: RigidFrame): boolean;
|
|
46
|
+
/** Row-major linear transform for native geometry consumers of a validated frame. */
|
|
47
|
+
export declare function frameToMatrix(frame: RigidFrame): MatrixTransform;
|
package/dist/rigidPlacement.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { AnyShape, Dimension } from 'brepjs';
|
|
2
|
-
import {
|
|
2
|
+
import { RigidFrame } from './placementFrame.js';
|
|
3
3
|
/** Applies a rigid placement as a location so the source BRep is not rebuilt. */
|
|
4
|
-
export declare function locateShapeInFrame<T extends AnyShape<Dimension>>(shape: T, frame:
|
|
4
|
+
export declare function locateShapeInFrame<T extends AnyShape<Dimension>>(shape: T, frame: RigidFrame): T;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "brepjs-bim",
|
|
3
|
-
"version": "0.24.
|
|
3
|
+
"version": "0.24.2",
|
|
4
4
|
"description": "BIM layer for brepjs — IFC4-aligned parametric building elements",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"bim",
|
|
@@ -57,9 +57,9 @@
|
|
|
57
57
|
"typescript-eslint": "*",
|
|
58
58
|
"vite": "^8.0.0",
|
|
59
59
|
"vite-plugin-dts": "^5.0.0",
|
|
60
|
-
"vitest": "^
|
|
60
|
+
"vitest": "^5.0.0",
|
|
61
61
|
"web-ifc": "^0.0.77",
|
|
62
|
-
"zod": "
|
|
62
|
+
"zod": "4.6.4"
|
|
63
63
|
},
|
|
64
64
|
"dependencies": {
|
|
65
65
|
"brepjs-families": ">=0.1.0 <1.0.0"
|