brepjs-bim 0.2.0 → 0.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +8 -1
- package/dist/bcf/bcfXml.d.ts +9 -3
- package/dist/brepjs-bim.cjs +792 -309
- package/dist/brepjs-bim.js +793 -311
- package/dist/elementFns/placedGeometry.d.ts +18 -0
- package/dist/ifc-writer/geometryWriter.d.ts +4 -1
- package/dist/ifc-writer/railingWriter.d.ts +9 -3
- package/dist/import/placement.d.ts +18 -0
- package/dist/index.d.ts +1 -0
- package/dist/specs/railingSpec.d.ts +6 -0
- package/dist/specs/roofSpec.d.ts +7 -0
- package/package.json +6 -2
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { ValidSolid, Result } from 'brepjs';
|
|
2
|
+
import { AnyBimElement } from '../types/bimTypes.js';
|
|
3
|
+
import { BimError } from '../errors/bimError.js';
|
|
4
|
+
/**
|
|
5
|
+
* Returns each element's geometry transformed to its world placement, as fresh
|
|
6
|
+
* caller-owned solids, wrapped in a `Result` (Layer-2 code prefers `Result` over
|
|
7
|
+
* throwing). **Dispose the returned solids** (e.g. via `using` / `[Symbol.dispose]`)
|
|
8
|
+
* when you own their lifetime — they are independent of the model
|
|
9
|
+
* (`BimModel[Symbol.dispose]` frees only the stored, unplaced `.geometry`). On any
|
|
10
|
+
* failure the solids already built for this call are disposed before the error is
|
|
11
|
+
* returned, so no partial array is leaked.
|
|
12
|
+
*
|
|
13
|
+
* Stairs carry no element solid (`.geometry` is null), so flight solids are built
|
|
14
|
+
* from `spec.flights` and placed per flight. Curtain walls return placed panels +
|
|
15
|
+
* mullions. Elements with no solid geometry (doors/windows/ramps/groups/spatial)
|
|
16
|
+
* return an empty array.
|
|
17
|
+
*/
|
|
18
|
+
export declare function placedSolids(el: AnyBimElement): Result<readonly ValidSolid[], BimError>;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { ValidSolid } from 'brepjs';
|
|
1
2
|
import { IfcWriter } from './ifcWriter.js';
|
|
2
3
|
import { WallSpec } from '../specs/wallSpec.js';
|
|
3
4
|
import { SlabSpec } from '../specs/slabSpec.js';
|
|
@@ -19,7 +20,9 @@ export interface LinearElementRepresentationIds {
|
|
|
19
20
|
}
|
|
20
21
|
export declare function writeWallGeometry(w: IfcWriter, spec: WallSpec, geomSubContextId: number, parentPlacementId: number | null): WallRepresentationIds;
|
|
21
22
|
export declare function writeSlabGeometry(w: IfcWriter, spec: SlabSpec, geomSubContextId: number, parentPlacementId: number | null): SlabRepresentationIds;
|
|
22
|
-
export declare function writeRoofGeometry(w: IfcWriter, spec: RoofSpec, geomSubContextId: number, parentPlacementId: number | null): SlabRepresentationIds
|
|
23
|
+
export declare function writeRoofGeometry(w: IfcWriter, spec: RoofSpec, solid: ValidSolid, geomSubContextId: number, parentPlacementId: number | null): SlabRepresentationIds & {
|
|
24
|
+
usedFallback: boolean;
|
|
25
|
+
};
|
|
23
26
|
export declare function writeProfile(w: IfcWriter, profile: Profile): number;
|
|
24
27
|
export declare function writeBeamGeometry(w: IfcWriter, spec: BeamSpec, geomSubContextId: number, parentPlacementId: number | null): LinearElementRepresentationIds;
|
|
25
28
|
export declare function writeColumnGeometry(w: IfcWriter, spec: ColumnSpec, geomSubContextId: number, parentPlacementId: number | null): LinearElementRepresentationIds;
|
|
@@ -1,11 +1,17 @@
|
|
|
1
|
+
import { ValidSolid } from 'brepjs';
|
|
1
2
|
import { IfcWriter } from './ifcWriter.js';
|
|
2
3
|
import { IfcGuid } from '../identity/ifcGuid.js';
|
|
3
4
|
import { RailingSpec, RailingPredefinedType } from '../specs/railingSpec.js';
|
|
4
5
|
export interface RailingRepresentationIds {
|
|
5
6
|
localPlacementId: number;
|
|
6
7
|
productDefinitionShapeId: number;
|
|
7
|
-
/**
|
|
8
|
-
|
|
8
|
+
/**
|
|
9
|
+
* Express ID of the body representation item (the swept extrusion) for surface
|
|
10
|
+
* styling, or null for a tessellated POSTED railing (no single styleable item).
|
|
11
|
+
*/
|
|
12
|
+
bodyItemId: number | null;
|
|
13
|
+
/** True when tessellation fell back to a degenerate brep. */
|
|
14
|
+
usedFallback: boolean;
|
|
9
15
|
}
|
|
10
|
-
export declare function writeRailingGeometry(w: IfcWriter, spec: RailingSpec, geomSubContextId: number, parentPlacementId: number | null): RailingRepresentationIds;
|
|
16
|
+
export declare function writeRailingGeometry(w: IfcWriter, spec: RailingSpec, solid: ValidSolid, geomSubContextId: number, parentPlacementId: number | null): RailingRepresentationIds;
|
|
11
17
|
export declare function writeRailingEntity(w: IfcWriter, guid: IfcGuid, name: string, predefinedType: RailingPredefinedType, ownerHistoryId: number, localPlacementId: number, productDefinitionShapeId: number): number;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { MatrixTransform } from 'brepjs';
|
|
1
2
|
import { SpfReader } from './spfReader.js';
|
|
2
3
|
/**
|
|
3
4
|
* Column-major 4x4 transform, matching the layout web-ifc and OCCT use:
|
|
@@ -77,6 +78,23 @@ export declare function composeWorldPlacement(reader: SpfReader, placementExpres
|
|
|
77
78
|
* always a proper rotation.
|
|
78
79
|
*/
|
|
79
80
|
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;
|
|
80
98
|
/** Decomposes a column-major matrix into origin (mm) + IFC axes (Z, X). */
|
|
81
99
|
export declare function decomposePlacement(m: Mat4x4): WorldPlacement;
|
|
82
100
|
export declare function identityMatrix(): Mat4x4;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export { BimModel } from './model/bimModel.js';
|
|
2
2
|
export type { BimTreeNode, BimTreeSummary } from './model/treeSummary.js';
|
|
3
|
+
export { placedSolids } from './elementFns/placedGeometry.js';
|
|
3
4
|
export { toIfc, toIfcValidated } from './serialize/toIfc.js';
|
|
4
5
|
export type { ValidatedIfcResult } from './serialize/toIfc.js';
|
|
5
6
|
export { setIfcWasmLocateFile } from './ifcRuntime.js';
|
|
@@ -18,6 +18,12 @@ export interface RailingSpec {
|
|
|
18
18
|
readonly axisZ: [number, number, number];
|
|
19
19
|
readonly predefinedType?: RailingPredefinedType | undefined;
|
|
20
20
|
readonly materialName: string;
|
|
21
|
+
/**
|
|
22
|
+
* Geometric infill style. 'PANEL' (default) is a single swept panel; 'POSTED'
|
|
23
|
+
* is vertical posts plus top & bottom rails. Orthogonal to `predefinedType`
|
|
24
|
+
* (which is the IFC usage role, not a geometry descriptor).
|
|
25
|
+
*/
|
|
26
|
+
readonly infill?: 'PANEL' | 'POSTED' | undefined;
|
|
21
27
|
readonly isExternal?: boolean | undefined;
|
|
22
28
|
readonly fireRating?: string | undefined;
|
|
23
29
|
readonly status?: string | undefined;
|
package/dist/specs/roofSpec.d.ts
CHANGED
|
@@ -16,6 +16,13 @@ export interface RoofSpec {
|
|
|
16
16
|
readonly fireRating?: string | undefined;
|
|
17
17
|
readonly thermalTransmittance?: number | undefined;
|
|
18
18
|
readonly status?: string | undefined;
|
|
19
|
+
/**
|
|
20
|
+
* Optional roof slope in degrees (0 < pitch < 90). Its PRESENCE opts the roof
|
|
21
|
+
* into shaped geometry built for `predefinedType` (shed/gable/hip/dome); when
|
|
22
|
+
* absent the roof is a flat slab regardless of predefinedType (backward-
|
|
23
|
+
* compatible). Ignored geometrically for DOME_ROOF (a hemisphere).
|
|
24
|
+
*/
|
|
25
|
+
readonly pitch?: number | undefined;
|
|
19
26
|
/**
|
|
20
27
|
* When present, the roof is associated via a layered IfcMaterialLayerSet built
|
|
21
28
|
* from these layers instead of the bare `materialName` IfcMaterial.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "brepjs-bim",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.1",
|
|
4
4
|
"description": "BIM layer for brepjs — IFC4-aligned parametric building elements",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"bim",
|
|
@@ -10,7 +10,11 @@
|
|
|
10
10
|
],
|
|
11
11
|
"author": "Andy Aragon",
|
|
12
12
|
"license": "Apache-2.0",
|
|
13
|
-
"repository": {
|
|
13
|
+
"repository": {
|
|
14
|
+
"type": "git",
|
|
15
|
+
"url": "https://github.com/andymai/brepjs",
|
|
16
|
+
"directory": "packages/brepjs-bim"
|
|
17
|
+
},
|
|
14
18
|
"type": "module",
|
|
15
19
|
"sideEffects": false,
|
|
16
20
|
"engines": {
|