brepjs-bim 0.23.0 → 0.23.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 +8 -0
- package/dist/brepjs-bim.cjs +525 -128
- package/dist/brepjs-bim.js +517 -120
- package/dist/import/fromIfc.d.ts +7 -1
- package/dist/import/geometryRead.d.ts +13 -1
- package/dist/import/importedModel.d.ts +17 -8
- package/dist/index.d.ts +1 -1
- package/package.json +1 -1
package/dist/import/fromIfc.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Result } from 'brepjs';
|
|
2
2
|
import { BimError } from '../errors/bimError.js';
|
|
3
|
-
import { ImportedModel } from './importedModel.js';
|
|
3
|
+
import { ImportedModel, ImportedElement, ImportedGeometry } from './importedModel.js';
|
|
4
4
|
export type { ImportedModel } from './importedModel.js';
|
|
5
5
|
export interface FromIfcOptions {
|
|
6
6
|
/** Activate web-ifc's large-coordinate recentering on open. Default false. */
|
|
@@ -8,6 +8,12 @@ export interface FromIfcOptions {
|
|
|
8
8
|
/** Skip body-geometry reconstruction for fast metadata-only reads. Default false. */
|
|
9
9
|
readonly skipGeometry?: boolean | undefined;
|
|
10
10
|
}
|
|
11
|
+
export interface FromIfcTestHooks {
|
|
12
|
+
readonly afterGeometry?: ((expressId: number, geometry: ImportedGeometry) => void) | undefined;
|
|
13
|
+
readonly afterElement?: ((element: ImportedElement, accumulatedCount: number) => void) | undefined;
|
|
14
|
+
}
|
|
15
|
+
/** Package-internal deterministic failure seam for import ownership tests. */
|
|
16
|
+
export declare function setFromIfcTestHooksForTesting(hooks: FromIfcTestHooks | null): void;
|
|
11
17
|
/**
|
|
12
18
|
* Reads an IFC STEP-SPF byte buffer into an {@link ImportedModel}: schema, unit
|
|
13
19
|
* scale, spatial tree, and one {@link ImportedElement} per physical product
|
|
@@ -7,7 +7,7 @@ import { SpfReader } from './spfReader.js';
|
|
|
7
7
|
* Outcome of reconstructing a single product's body geometry.
|
|
8
8
|
*
|
|
9
9
|
* - `SOLID` — a brepjs ValidSolid was rebuilt (parametrically from a swept
|
|
10
|
-
* solid, or by a manifold
|
|
10
|
+
* solid, or by sewing a manifold tessellated mesh).
|
|
11
11
|
* - `MESH` — geometry exists but could not be turned into a closed solid;
|
|
12
12
|
* raw triangle data is returned and flagged lossy via `diagnostic`.
|
|
13
13
|
* - `NONE` — the product carries no recognised body representation.
|
|
@@ -24,6 +24,16 @@ export type GeometryResult = {
|
|
|
24
24
|
} | {
|
|
25
25
|
readonly kind: 'NONE';
|
|
26
26
|
};
|
|
27
|
+
export interface BodyGeometryItems {
|
|
28
|
+
readonly hasBody: boolean;
|
|
29
|
+
readonly itemCount: number;
|
|
30
|
+
readonly items: readonly GeometryResult[];
|
|
31
|
+
}
|
|
32
|
+
export interface GeometryReadTestHooks {
|
|
33
|
+
readonly afterItemSolid?: ((itemExpressId: number, solid: ValidSolid) => void) | undefined;
|
|
34
|
+
}
|
|
35
|
+
/** Package-internal deterministic failure seam for import ownership tests. */
|
|
36
|
+
export declare function setGeometryReadTestHooksForTesting(hooks: GeometryReadTestHooks | null): void;
|
|
27
37
|
/**
|
|
28
38
|
* Reconstructs the `Body` (SweptSolid) representation of a product into a brepjs
|
|
29
39
|
* solid, falling back to tessellated mesh import when no parametric path exists.
|
|
@@ -34,6 +44,8 @@ export type GeometryResult = {
|
|
|
34
44
|
* single bad element never aborts a model import.
|
|
35
45
|
*/
|
|
36
46
|
export declare function readBodyGeometry(reader: SpfReader, productExpressId: number, scale: number, diagnostics: ValidationIssue[]): GeometryResult;
|
|
47
|
+
/** Reconstructs each supported IFC Body item independently in representation order. */
|
|
48
|
+
export declare function readBodyItems(reader: SpfReader, productExpressId: number, scale: number, diagnostics: ValidationIssue[]): BodyGeometryItems;
|
|
37
49
|
/**
|
|
38
50
|
* Reads an IfcProfileDef into a brepjs Profile (mm). Mirrors the writer's
|
|
39
51
|
* profile-def emission (geometryWriter.writeProfile / profileDefWriter).
|
|
@@ -1,25 +1,34 @@
|
|
|
1
|
-
import { ValidSolid } from 'brepjs';
|
|
1
|
+
import { Bounds3D, ValidSolid } from 'brepjs';
|
|
2
2
|
import { ValidationReport } from '../validation/severity.js';
|
|
3
3
|
import { IfcGuid } from '../identity/ifcGuid.js';
|
|
4
4
|
import { ImportedSchema } from './spfReader.js';
|
|
5
5
|
export type { ImportedSchema } from './spfReader.js';
|
|
6
6
|
/**
|
|
7
|
-
* How faithfully
|
|
7
|
+
* How faithfully the least faithful retained Body item was reconstructed:
|
|
8
8
|
* - `PARAMETRIC` — rebuilt losslessly from a swept solid (extrude/revolve).
|
|
9
9
|
* - `TESSELLATED_MANIFOLD` — a tessellated mesh was recovered as a closed solid
|
|
10
|
-
*
|
|
11
|
-
* - `TESSELLATED_LOSSY` —
|
|
12
|
-
* close into a solid
|
|
10
|
+
* by sewing its triangles; geometrically faithful but topology was re-derived.
|
|
11
|
+
* - `TESSELLATED_LOSSY` — at least one item exists only as raw triangles because
|
|
12
|
+
* its mesh did not close into a solid. More faithful siblings may remain in `solids`.
|
|
13
13
|
* - `NONE` — no recognised body representation was found.
|
|
14
14
|
*/
|
|
15
15
|
export type GeometryFidelity = 'PARAMETRIC' | 'TESSELLATED_MANIFOLD' | 'TESSELLATED_LOSSY' | 'NONE';
|
|
16
|
+
export type ImportedBodyCompleteness = 'COMPLETE' | 'PARTIAL' | 'NONE';
|
|
16
17
|
export interface ImportedGeometry {
|
|
17
18
|
readonly fidelity: GeometryFidelity;
|
|
18
|
-
/**
|
|
19
|
+
/** Whether every IFC Body item reconstructed into an owned solid. */
|
|
20
|
+
readonly completeness: ImportedBodyCompleteness;
|
|
21
|
+
/** Owned World-placed reconstructed handles. Dispose them through disposeImportedModel(). */
|
|
22
|
+
readonly solids: readonly ValidSolid[];
|
|
23
|
+
/** Borrowed alias for a COMPLETE one-solid Body. Otherwise null. */
|
|
19
24
|
readonly solid: ValidSolid | null;
|
|
20
|
-
/**
|
|
25
|
+
/** Component-wise union of all item bounds for a COMPLETE Body. Null if measurement fails. */
|
|
26
|
+
readonly bounds: Bounds3D | null;
|
|
27
|
+
/** Sum of item volumes in mm³ for a COMPLETE Body. Null if measurement fails. */
|
|
28
|
+
readonly volumeMm3: number | null;
|
|
29
|
+
/** Combined raw triangle vertices (interleaved xyz), present for `TESSELLATED_LOSSY`. */
|
|
21
30
|
readonly meshVertices?: Float32Array | undefined;
|
|
22
|
-
/**
|
|
31
|
+
/** Combined raw triangle indices, present for `TESSELLATED_LOSSY`. */
|
|
23
32
|
readonly meshIndices?: Uint32Array | undefined;
|
|
24
33
|
}
|
|
25
34
|
export interface ImportedPset {
|
package/dist/index.d.ts
CHANGED
|
@@ -83,7 +83,7 @@ export type { ClassificationRef } from './types/classificationTypes.js';
|
|
|
83
83
|
export type { PsetCategory, PsetMeasureType, PsetTemplate, PsetPropertyTemplate, } from './psets/psetTemplates.js';
|
|
84
84
|
export { importError } from './errors/bimError.js';
|
|
85
85
|
export type { BimError, BimErrorKind } from './errors/bimError.js';
|
|
86
|
-
export type { ImportedModel, ImportedSchema, ImportedElement, ImportedElementCategory, ImportedGeometry, GeometryFidelity, ImportedPset, ImportedMaterial, ImportedClassification, ImportedSpatialNode, } from './import/importedModel.js';
|
|
86
|
+
export type { ImportedModel, ImportedSchema, ImportedElement, ImportedElementCategory, ImportedGeometry, ImportedBodyCompleteness, GeometryFidelity, ImportedPset, ImportedMaterial, ImportedClassification, ImportedSpatialNode, } from './import/importedModel.js';
|
|
87
87
|
export type { IfcGuid } from './identity/ifcGuid.js';
|
|
88
88
|
export type { LocalId, LocalIdCounter } from './identity/localId.js';
|
|
89
89
|
export type { UnitSystem, LengthUnit } from './units/units.js';
|