brepjs-bim 0.20.0 → 0.22.0

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.
@@ -1,20 +1,31 @@
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 '../import/placement.js';
5
+ export interface PlacedSolidsOptions {
6
+ /**
7
+ * Cumulative frame of the element's containing spatial structure. Element
8
+ * specs and stored arbitrary bodies are relative to that structure; pass its
9
+ * frame here when world coordinates are required.
10
+ */
11
+ readonly parentFrame?: FrameInput | undefined;
12
+ }
4
13
  /**
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
14
+ * Returns each element's geometry transformed to its element-local placement,
15
+ * and optionally through the cumulative frame of its containing spatial
16
+ * structure, as fresh caller-owned solids. Pass `parentFrame` to obtain world
17
+ * coordinates for elements beneath a placed Site, Bridge, Bridge Part, or
18
+ * other spatial structure. **Dispose the returned solids** (e.g. via `using` /
19
+ * `[Symbol.dispose]`) when you own their lifetime — they are independent of the model
9
20
  * (`BimModel[Symbol.dispose]` frees only the stored, unplaced `.geometry`). On any
10
21
  * failure the solids already built for this call are disposed before the error is
11
22
  * returned, so no partial array is leaked.
12
23
  *
13
24
  * Stairs and ramps carry no element solid (`.geometry` is null), so flight
14
25
  * solids are built from `spec.flights` and placed per flight. Curtain walls
15
- * return placed panels + mullions. Proxies are authored in world coordinates
16
- * (no placement frame), so their solid is returned as a fresh identity-placed
17
- * copy. Elements with no solid geometry (doors/windows/groups/spatial) return
18
- * an empty array.
26
+ * return placed panels + mullions. Proxy and Earthworks Fill bodies are stored
27
+ * relative to their containing spatial structure, so their body is copied and
28
+ * then transformed by `parentFrame` when supplied. Elements with no solid geometry
29
+ * (doors/windows/groups/spatial) return an empty array.
19
30
  */
20
- export declare function placedSolids(el: AnyBimElement): Result<readonly ValidSolid[], BimError>;
31
+ export declare function placedSolids(el: AnyBimElement, options?: PlacedSolidsOptions): Result<readonly ValidSolid[], BimError>;
@@ -8,13 +8,20 @@ export interface FamiliesToBimOptions {
8
8
  readonly project: ProjectSpec;
9
9
  readonly siteName?: string | undefined;
10
10
  readonly buildingName?: string | undefined;
11
+ /**
12
+ * Materializes exact evaluated Product Bodies for supported typed routes
13
+ * such as Earthworks Fill. Supplying this option does not opt unsupported
14
+ * products into the proxy fallback.
15
+ */
16
+ readonly bodyEvaluator?: csg.Evaluator | undefined;
11
17
  /**
12
18
  * Enables the proxy route: an unrouted geometry-bearing element is
13
19
  * materialized through this evaluator and exported as an
14
- * IfcBuildingElementProxy (tessellated, world-frame body). Without it,
20
+ * IfcBuildingElementProxy (tessellated authoritative body). Without it,
15
21
  * unrouted types stay a hard FAMILIES_UNSUPPORTED_TYPE error. The
16
22
  * evaluator's handles stay borrowed; the adapter clones what it hands the
17
- * model.
23
+ * model. For backward compatibility it also supplies the body evaluator when
24
+ * `bodyEvaluator` is absent.
18
25
  */
19
26
  readonly proxyEvaluator?: csg.Evaluator | undefined;
20
27
  }
@@ -1,6 +1,11 @@
1
1
  import { IfcWriter } from './ifcWriter.js';
2
2
  import { IfcGuid } from '../identity/ifcGuid.js';
3
- /** IfcAssemblyPlaceEnum values; SITE for in-place assemblies, FACTORY for prefabricated. */
3
+ /**
4
+ * Enumeration literals transcribed verbatim from `IfcAssemblyPlaceEnum` in the
5
+ * buildingSMART IFC 4.3 ADD2 (`IFC4X3_ADD2`) EXPRESS schema:
6
+ * https://standards.buildingsmart.org/IFC/RELEASE/IFC4_3/HTML/IFC4X3_ADD2.exp
7
+ * SITE denotes in-place assemblies; FACTORY denotes prefabricated assemblies.
8
+ */
4
9
  export type AssemblyPlaceIfc = 'SITE' | 'FACTORY' | 'NOTDEFINED';
5
10
  /** IfcElementAssemblyTypeEnum values (IFC4). */
6
11
  export type ElementAssemblyPredefinedTypeIfc = 'ACCESSORY_ASSEMBLY' | 'ARCH' | 'BEAM_GRID' | 'BRACED_FRAME' | 'GIRDER' | 'REINFORCEMENT_UNIT' | 'RIGID_FRAME' | 'SLAB_FIELD' | 'TRUSS' | 'USERDEFINED' | 'NOTDEFINED';
@@ -1,6 +1,11 @@
1
1
  import { IfcWriter } from './ifcWriter.js';
2
2
  import { IfcGuid } from '../identity/ifcGuid.js';
3
- /** IfcConnectionTypeEnum values used by IfcRelConnectsPathElements path ends. */
3
+ /**
4
+ * Enumeration literals transcribed verbatim from `IfcConnectionTypeEnum` in
5
+ * the buildingSMART IFC 4.3 ADD2 (`IFC4X3_ADD2`) EXPRESS schema:
6
+ * https://standards.buildingsmart.org/IFC/RELEASE/IFC4_3/HTML/IFC4X3_ADD2.exp
7
+ * These values identify the path ends used by `IfcRelConnectsPathElements`.
8
+ */
4
9
  export type PathConnectionTypeIfc = 'ATSTART' | 'ATEND' | 'ATPATH' | 'NOTDEFINED';
5
10
  /**
6
11
  * Emits an IfcRelConnectsElements recording a physical connection between two
@@ -1,10 +1,12 @@
1
1
  import { IfcWriter } from './ifcWriter.js';
2
2
  import { IfcGuid } from '../identity/ifcGuid.js';
3
+ import { SiteSpec, SpatialPlacementSpec } from '../specs/spatialSpec.js';
3
4
  export declare function writeProject(w: IfcWriter, guid: IfcGuid, name: string, ownerHistoryId: number, unitAssignmentId: number, geomContextId: number): number;
4
- export declare function writeSite(w: IfcWriter, guid: IfcGuid, name: string, ownerHistoryId: number): {
5
+ export declare function writeSite(w: IfcWriter, guid: IfcGuid, spec: SiteSpec, ownerHistoryId: number, parentPlacementId?: number | null): {
5
6
  entityId: number;
6
7
  placementId: number;
7
8
  };
9
+ export declare function writeSpatialLocalPlacement(w: IfcWriter, spec: SpatialPlacementSpec, parentPlacementId: number | null): number;
8
10
  export declare function writeBuilding(w: IfcWriter, guid: IfcGuid, name: string, ownerHistoryId: number, parentPlacementId: number | null): {
9
11
  entityId: number;
10
12
  placementId: number;
@@ -0,0 +1,12 @@
1
+ import { IfcGuid } from '../identity/ifcGuid.js';
2
+ import { BridgePartSpec, BridgeSpec, EarthworksFillSpec } from '../specs/infrastructureSpec.js';
3
+ import { IfcWriter } from './ifcWriter.js';
4
+ export declare function writeBridge(w: IfcWriter, guid: IfcGuid, spec: BridgeSpec, ownerHistoryId: number, parentPlacementId: number | null): {
5
+ entityId: number;
6
+ placementId: number;
7
+ };
8
+ export declare function writeBridgePart(w: IfcWriter, guid: IfcGuid, spec: BridgePartSpec, ownerHistoryId: number, parentPlacementId: number | null): {
9
+ entityId: number;
10
+ placementId: number;
11
+ };
12
+ export declare function writeEarthworksFillEntity(w: IfcWriter, guid: IfcGuid, spec: EarthworksFillSpec, ownerHistoryId: number, localPlacementId: number, productDefinitionShapeId: number): number;
@@ -1,17 +1,13 @@
1
1
  import { IfcWriter } from './ifcWriter.js';
2
- import { TessellationOutput } from './tessellationWriter.js';
3
2
  import { IfcGuid } from '../identity/ifcGuid.js';
4
3
  import { ProxySpec } from '../specs/proxySpec.js';
5
- export interface ProxyRepresentationIds {
6
- readonly localPlacementId: number;
7
- readonly productDefinitionShapeId: number;
8
- readonly tessellation: TessellationOutput;
9
- }
4
+ import { TessellatedProductRepresentationIds } from './tessellatedProductWriter.js';
5
+ export type ProxyRepresentationIds = TessellatedProductRepresentationIds;
10
6
  /**
11
7
  * Writes the IfcLocalPlacement (at origin, relative to parentPlacementId) and a
12
- * tessellated body (IfcTriangulatedFaceSet) for a proxy's solid. The solid is
13
- * exported in its authored coordinate frame; placement is identity because proxy
14
- * solids carry their own world positions in the brepjs geometry.
8
+ * tessellated body (IfcTriangulatedFaceSet) for a proxy's solid. Solid
9
+ * coordinates are emitted as supplied; the caller is responsible for matching
10
+ * them to the containing spatial structure's frame.
15
11
  */
16
12
  export declare function writeProxyGeometry(w: IfcWriter, spec: ProxySpec, geomSubContextId: number, parentPlacementId: number | null): ProxyRepresentationIds;
17
13
  export declare function writeProxyEntity(w: IfcWriter, guid: IfcGuid, name: string, predefinedType: string, ownerHistoryId: number, localPlacementId: number, productDefinitionShapeId: number): number;
@@ -7,5 +7,10 @@ export interface SpaceRepresentationIds {
7
7
  }
8
8
  export declare function writeSpaceGeometry(w: IfcWriter, spec: SpaceSpec, geomSubContextId: number, parentPlacementId: number | null): SpaceRepresentationIds;
9
9
  export declare function writeSpaceEntity(w: IfcWriter, guid: IfcGuid, name: string, longName: string | null, _predefinedType: SpacePredefinedType, ownerHistoryId: number, localPlacementId: number, productDefinitionShapeId: number): number;
10
+ /**
11
+ * Enumeration literals transcribed verbatim from `IfcPhysicalOrVirtualEnum` in
12
+ * the buildingSMART IFC 4.3 ADD2 (`IFC4X3_ADD2`) EXPRESS schema:
13
+ * https://standards.buildingsmart.org/IFC/RELEASE/IFC4_3/HTML/IFC4X3_ADD2.exp
14
+ */
10
15
  export type SpaceBoundaryConnectionType = 'PHYSICAL' | 'VIRTUAL' | 'NOTDEFINED';
11
16
  export declare function writeRelSpaceBoundary(w: IfcWriter, guid: IfcGuid, ownerHistoryId: number, spaceExpressId: number, elementExpressId: number, connectionType: SpaceBoundaryConnectionType): void;
@@ -0,0 +1,10 @@
1
+ import { ValidSolid } from 'brepjs';
2
+ import { IfcWriter } from './ifcWriter.js';
3
+ import { TessellationOutput } from './tessellationWriter.js';
4
+ export interface TessellatedProductRepresentationIds {
5
+ readonly localPlacementId: number;
6
+ readonly productDefinitionShapeId: number;
7
+ readonly tessellation: TessellationOutput;
8
+ }
9
+ /** Write a tessellated body in the coordinate frame supplied by the caller. */
10
+ export declare function writeTessellatedProductGeometry(w: IfcWriter, solid: ValidSolid, geomSubContextId: number, parentPlacementId: number | null): TessellatedProductRepresentationIds;
@@ -48,13 +48,16 @@ export interface ImportedClassification {
48
48
  readonly code: string;
49
49
  readonly description?: string | undefined;
50
50
  }
51
- export type ImportedElementCategory = 'WALL' | 'SLAB' | 'BEAM' | 'COLUMN' | 'DOOR' | 'WINDOW' | 'OPENING' | 'SPACE' | 'ROOF' | 'CURTAIN_WALL' | 'FOOTING' | 'PILE' | 'STAIR' | 'RAMP' | 'RAILING' | 'COVERING' | 'ELEMENT_ASSEMBLY' | 'PROXY';
51
+ export type ImportedElementCategory = 'WALL' | 'SLAB' | 'BEAM' | 'COLUMN' | 'DOOR' | 'WINDOW' | 'OPENING' | 'SPACE' | 'ROOF' | 'CURTAIN_WALL' | 'FOOTING' | 'PILE' | 'STAIR' | 'RAMP' | 'RAILING' | 'COVERING' | 'ELEMENT_ASSEMBLY' | 'EARTHWORKS_FILL' | 'PROXY';
52
52
  export interface ImportedElement {
53
53
  readonly expressId: number;
54
54
  readonly guid: IfcGuid;
55
55
  readonly name: string;
56
56
  readonly category: ImportedElementCategory;
57
57
  readonly predefinedType?: string | undefined;
58
+ /** Express id of the directly containing spatial structure. */
59
+ readonly spatialStructureExpressId?: number | undefined;
60
+ /** @deprecated Use `spatialStructureExpressId`; retained as a compatibility alias. */
58
61
  readonly storeyExpressId?: number | undefined;
59
62
  readonly geometry: ImportedGeometry;
60
63
  readonly psets: readonly ImportedPset[];
@@ -69,7 +72,7 @@ export interface ImportedSpatialNode {
69
72
  readonly expressId: number;
70
73
  readonly guid: IfcGuid;
71
74
  readonly name: string;
72
- readonly category: 'PROJECT' | 'SITE' | 'BUILDING' | 'STOREY';
75
+ readonly category: 'PROJECT' | 'SITE' | 'BUILDING' | 'STOREY' | 'BRIDGE' | 'BRIDGE_PART';
73
76
  readonly elevationMm?: number | undefined;
74
77
  readonly children: readonly ImportedSpatialNode[];
75
78
  readonly containedElements: readonly number[];
@@ -1,9 +1,9 @@
1
1
  import { SpfReader } from './spfReader.js';
2
2
  /**
3
3
  * A reconstructed spatial-structure node. The tree mirrors the IFC spatial
4
- * containment hierarchy (`IfcProject → IfcSite → IfcBuilding → IfcBuildingStorey`)
4
+ * containment hierarchy (including building and IFC4X3 civil spatial nodes)
5
5
  * rebuilt from `IfcRelAggregates`, with physical elements attached to their
6
- * storey via `IfcRelContainedInSpatialStructure`.
6
+ * direct spatial structure via `IfcRelContainedInSpatialStructure`.
7
7
  *
8
8
  * Nodes are addressable by {@link SpatialNode.guid} (the IFC `GlobalId`).
9
9
  */
@@ -11,7 +11,7 @@ export interface SpatialNode {
11
11
  readonly expressId: number;
12
12
  readonly guid: string;
13
13
  readonly name: string;
14
- readonly category: 'PROJECT' | 'SITE' | 'BUILDING' | 'STOREY';
14
+ readonly category: 'PROJECT' | 'SITE' | 'BUILDING' | 'STOREY' | 'BRIDGE' | 'BRIDGE_PART';
15
15
  /** Storey elevation in mm; present on `STOREY` nodes only. */
16
16
  readonly elevation?: number | undefined;
17
17
  readonly children: readonly SpatialNode[];
package/dist/index.d.ts CHANGED
@@ -1,6 +1,8 @@
1
1
  export { BimModel, type ElementIdentityOptions, type OpeningIdentityOptions, } from './model/bimModel.js';
2
2
  export type { BimTreeNode, BimTreeSummary } from './model/treeSummary.js';
3
3
  export { placedSolids } from './elementFns/placedGeometry.js';
4
+ export type { PlacedSolidsOptions } from './elementFns/placedGeometry.js';
5
+ export type { FrameInput } from './import/placement.js';
4
6
  export { toIfc, toIfcValidated } from './serialize/toIfc.js';
5
7
  export type { ValidatedIfcResult } from './serialize/toIfc.js';
6
8
  export { setIfcWasmLocateFile } from './ifcRuntime.js';
@@ -27,6 +29,7 @@ export { parseElementAssemblySpec } from './specs/assemblySpec.js';
27
29
  export { parseZoneSpec, parseSystemSpec } from './specs/groupSpec.js';
28
30
  export { parseSurfaceStyleSpec } from './specs/styleSpec.js';
29
31
  export { parseDoorSpec, parseWindowSpec, parseSlabOpeningInput } from './specs/openingSpec.js';
32
+ export { parseBridgeSpec, parseBridgePartSpec } from './specs/infrastructureSpec.js';
30
33
  export { newIfcGuid, isValidIfcGuid } from './identity/ifcGuid.js';
31
34
  export { deriveIfcGuid, deriveIfcGuidSync } from './identity/guidDerivation.js';
32
35
  export { makeLocalIdCounter } from './identity/localId.js';
@@ -69,7 +72,8 @@ export type { AssemblyPlaceIfc, ElementAssemblyPredefinedTypeIfc, } from './ifc-
69
72
  export type { PathConnectionTypeIfc } from './ifc-writer/connectivityWriter.js';
70
73
  export type { DoorSpec, WindowSpec, SlabOpeningInput } from './specs/openingSpec.js';
71
74
  export type { ProxySpec } from './specs/proxySpec.js';
72
- export type { ProjectSpec, ProjectCrs, SiteSpec, BuildingSpec, StoreySpec, } from './specs/spatialSpec.js';
75
+ export type { BridgeSpec, BridgePartSpec, CivilSpatialSpec, BridgePredefinedType, BridgePartPredefinedType, EarthworksFillSpec, EarthworksFillPredefinedType, FacilityUsageType, } from './specs/infrastructureSpec.js';
76
+ export type { ProjectSpec, ProjectCrs, IfcElementCompositionType, SpatialPlacementSpec, SiteSpec, BuildingSpec, StoreySpec, } from './specs/spatialSpec.js';
73
77
  export type { BimCategory, BimElement, AnyBimElement, OpeningSpec, WallOpeningSpec, SlabOpeningSpec, } from './types/bimTypes.js';
74
78
  export { isWallOpening, isSlabOpening } from './types/bimTypes.js';
75
79
  export type { BimRelationship, AssociatesMaterialRel, AssociatesClassificationRel, VoidsWallRel, VoidsSlabRel, FillsOpeningRel, SpaceBoundaryRel, NestsRel, ConnectsElementsRel, ConnectsPathElementsRel, CoversElementRel, AssignsToGroupRel, } from './types/relationships.js';
@@ -23,6 +23,7 @@ import { ElementAssemblySpec } from '../specs/assemblySpec.js';
23
23
  import { ZoneSpec, SystemSpec } from '../specs/groupSpec.js';
24
24
  import { SurfaceStyleSpec } from '../ifc-writer/styleWriter.js';
25
25
  import { ProjectSpec, SiteSpec, BuildingSpec, StoreySpec } from '../specs/spatialSpec.js';
26
+ import { BridgePartSpec, BridgeSpec, EarthworksFillSpec } from '../specs/infrastructureSpec.js';
26
27
  /** Optional identity override for created elements: a stable key (e.g. a
27
28
  * families key path) that replaces the positional GlobalId derivation. */
28
29
  export interface ElementIdentityOptions {
@@ -35,9 +36,14 @@ export interface OpeningIdentityOptions extends ElementIdentityOptions {
35
36
  }
36
37
  export declare class BimModel {
37
38
  #private;
38
- init(spec: ProjectSpec): Result<LocalId, BimError>;
39
+ init(spec: ProjectSpec, options?: ElementIdentityOptions): Result<LocalId, BimError>;
39
40
  [Symbol.dispose](): void;
40
41
  addSite(spec: SiteSpec, options?: ElementIdentityOptions): Result<LocalId, BimError>;
42
+ addBridge(spec: BridgeSpec, options?: ElementIdentityOptions): Result<LocalId, BimError>;
43
+ addBridgePart(spec: BridgePartSpec, options?: ElementIdentityOptions): Result<LocalId, BimError>;
44
+ /** Adds a typed IfcEarthworksFill body. Ownership of `spec.solid` transfers
45
+ * to the model only when this call succeeds. */
46
+ addEarthworksFill(spec: EarthworksFillSpec, options?: ElementIdentityOptions): Result<LocalId, BimError>;
41
47
  addBuilding(spec: BuildingSpec, options?: ElementIdentityOptions): Result<LocalId, BimError>;
42
48
  addStorey(spec: StoreySpec, options?: ElementIdentityOptions): Result<LocalId, BimError>;
43
49
  addWall(spec: WallSpec, options?: ElementIdentityOptions): Result<LocalId, BimError>;
@@ -150,6 +156,9 @@ export declare class BimModel {
150
156
  getWalls(): BimElement<'WALL'>[];
151
157
  getSlabs(): BimElement<'SLAB'>[];
152
158
  getBeams(): BimElement<'BEAM'>[];
159
+ getBridges(): BimElement<'BRIDGE'>[];
160
+ getBridgeParts(): BimElement<'BRIDGE_PART'>[];
161
+ getEarthworksFills(): BimElement<'EARTHWORKS_FILL'>[];
153
162
  getColumns(): BimElement<'COLUMN'>[];
154
163
  getProxies(): BimElement<'PROXY'>[];
155
164
  getSpaces(): BimElement<'SPACE'>[];
@@ -1,6 +1,11 @@
1
1
  import { BimError } from '../errors/bimError.js';
2
2
  import { Result } from 'brepjs';
3
3
  export type AssemblyPredefinedType = 'ACCESSORY_ASSEMBLY' | 'ARCH' | 'BEAM_GRID' | 'BRACED_FRAME' | 'GIRDER' | 'REINFORCEMENT_UNIT' | 'RIGID_FRAME' | 'SLAB_FIELD' | 'TRUSS' | 'USERDEFINED' | 'NOTDEFINED';
4
+ /**
5
+ * Enumeration literals transcribed verbatim from `IfcAssemblyPlaceEnum` in the
6
+ * buildingSMART IFC 4.3 ADD2 (`IFC4X3_ADD2`) EXPRESS schema:
7
+ * https://standards.buildingsmart.org/IFC/RELEASE/IFC4_3/HTML/IFC4X3_ADD2.exp
8
+ */
4
9
  export type AssemblyPlace = 'SITE' | 'FACTORY' | 'NOTDEFINED';
5
10
  /**
6
11
  * A grouping container (IfcElementAssembly). Carries no geometry of its own;
@@ -1,6 +1,11 @@
1
1
  import { BimError } from '../errors/bimError.js';
2
2
  import { Result } from 'brepjs';
3
3
  import { ClassificationRef } from '../types/classificationTypes.js';
4
+ /**
5
+ * Enumeration literals transcribed verbatim from `IfcCurtainWallTypeEnum` in
6
+ * the buildingSMART IFC 4.3 ADD2 (`IFC4X3_ADD2`) EXPRESS schema:
7
+ * https://standards.buildingsmart.org/IFC/RELEASE/IFC4_3/HTML/IFC4X3_ADD2.exp
8
+ */
4
9
  export type CurtainWallPredefinedType = 'NOTDEFINED' | 'USERDEFINED';
5
10
  /**
6
11
  * A planar curtain wall, modelled as a rectangular grid of glazing panels
@@ -0,0 +1,40 @@
1
+ import { Result, ValidSolid } from 'brepjs';
2
+ import { BimError } from '../errors/bimError.js';
3
+ import { IfcElementCompositionType, SpatialPlacementSpec } from './spatialSpec.js';
4
+ /**
5
+ * IFC enumeration literals in this module are transcribed verbatim from the
6
+ * buildingSMART IFC 4.3 ADD2 (`IFC4X3_ADD2`) EXPRESS schema, specifically
7
+ * `IfcBridgeTypeEnum`, `IfcBridgePartTypeEnum`, `IfcFacilityUsageEnum`, and
8
+ * `IfcEarthworksFillTypeEnum`:
9
+ * https://standards.buildingsmart.org/IFC/RELEASE/IFC4_3/HTML/IFC4X3_ADD2.exp
10
+ *
11
+ * The Families-facing civil vocabulary stays target-independent; projection
12
+ * into these IFC-owned keywords occurs in `familiesAdapter.ts`.
13
+ */
14
+ export type BridgePredefinedType = 'ARCHED' | 'CABLE_STAYED' | 'CANTILEVER' | 'CULVERT' | 'FRAMEWORK' | 'GIRDER' | 'SUSPENSION' | 'TRUSS' | 'USERDEFINED' | 'NOTDEFINED';
15
+ export type BridgePartPredefinedType = 'ABUTMENT' | 'DECK' | 'DECK_SEGMENT' | 'FOUNDATION' | 'PIER' | 'PIER_SEGMENT' | 'PYLON' | 'SUBSTRUCTURE' | 'SUPERSTRUCTURE' | 'SURFACESTRUCTURE' | 'USERDEFINED' | 'NOTDEFINED';
16
+ export type FacilityUsageType = 'LATERAL' | 'LONGITUDINAL' | 'REGION' | 'VERTICAL' | 'USERDEFINED' | 'NOTDEFINED';
17
+ export type EarthworksFillPredefinedType = 'BACKFILL' | 'COUNTERWEIGHT' | 'EMBANKMENT' | 'SLOPEFILL' | 'SUBGRADE' | 'SUBGRADEBED' | 'TRANSITIONSECTION' | 'USERDEFINED' | 'NOTDEFINED';
18
+ export interface CivilSpatialSpec extends SpatialPlacementSpec {
19
+ readonly name: string;
20
+ readonly description?: string | undefined;
21
+ readonly compositionType?: IfcElementCompositionType | undefined;
22
+ }
23
+ export interface BridgeSpec extends CivilSpatialSpec {
24
+ readonly predefinedType?: BridgePredefinedType | undefined;
25
+ }
26
+ export interface BridgePartSpec extends CivilSpatialSpec {
27
+ readonly usageType: FacilityUsageType;
28
+ readonly predefinedType?: BridgePartPredefinedType | undefined;
29
+ }
30
+ /** Typed arbitrary body for IfcEarthworksFill. The model takes ownership of
31
+ * `solid` on a successful add and disposes it with the model. */
32
+ export interface EarthworksFillSpec {
33
+ readonly name: string;
34
+ readonly solid: ValidSolid;
35
+ readonly materialName: string;
36
+ readonly predefinedType?: EarthworksFillPredefinedType | undefined;
37
+ readonly customProperties?: Readonly<Record<string, Readonly<Record<string, string | number | boolean>>>> | undefined;
38
+ }
39
+ export declare function parseBridgeSpec(input: unknown): Result<BridgeSpec, BimError>;
40
+ export declare function parseBridgePartSpec(input: unknown): Result<BridgePartSpec, BimError>;
@@ -9,9 +9,11 @@ import { ValidSolid } from 'brepjs';
9
9
  export interface ProxySpec {
10
10
  readonly name: string;
11
11
  /**
12
- * The proxy body. OWNERSHIP TRANSFERS to the BimModel on addProxy(): the model
13
- * disposes this handle when it is disposed, so the caller MUST NOT dispose it
14
- * itself (no `using`) — doing so double-frees the underlying WASM shape.
12
+ * The proxy body. Its coordinates are written as supplied under an identity
13
+ * placement relative to its containing spatial structure. OWNERSHIP TRANSFERS
14
+ * to the BimModel on addProxy(): the model disposes this handle when it is
15
+ * disposed, so the caller MUST NOT dispose it itself (no `using`) — doing so
16
+ * double-frees the underlying WASM shape.
15
17
  */
16
18
  readonly solid: ValidSolid;
17
19
  readonly materialName?: string | undefined;
@@ -1,3 +1,6 @@
1
+ import { Result } from 'brepjs';
2
+ import { z, RefinementCtx } from 'zod';
3
+ import { BimError } from '../errors/bimError.js';
1
4
  export interface ProjectSpec {
2
5
  readonly name: string;
3
6
  readonly description?: string;
@@ -34,10 +37,29 @@ export interface ProjectCrs {
34
37
  readonly xAxisOrdinate?: number | undefined;
35
38
  readonly scale?: number | undefined;
36
39
  }
37
- export interface SiteSpec {
40
+ /**
41
+ * Enumeration literals transcribed verbatim from `IfcElementCompositionEnum`
42
+ * in the buildingSMART IFC 4.3 ADD2 (`IFC4X3_ADD2`) EXPRESS schema:
43
+ * https://standards.buildingsmart.org/IFC/RELEASE/IFC4_3/HTML/IFC4X3_ADD2.exp
44
+ */
45
+ export type IfcElementCompositionType = 'COMPLEX' | 'ELEMENT' | 'PARTIAL';
46
+ export interface SpatialPlacementSpec {
47
+ readonly origin?: [number, number, number] | undefined;
48
+ readonly axisX?: [number, number, number] | undefined;
49
+ readonly axisZ?: [number, number, number] | undefined;
50
+ }
51
+ export interface SiteSpec extends SpatialPlacementSpec {
38
52
  readonly name: string;
39
53
  readonly description?: string;
54
+ readonly compositionType?: IfcElementCompositionType | undefined;
40
55
  }
56
+ export declare const spatialPlacementFields: {
57
+ origin: z.ZodOptional<z.ZodTuple<[z.ZodNumber, z.ZodNumber, z.ZodNumber], null>>;
58
+ axisX: z.ZodOptional<z.ZodTuple<[z.ZodNumber, z.ZodNumber, z.ZodNumber], null>>;
59
+ axisZ: z.ZodOptional<z.ZodTuple<[z.ZodNumber, z.ZodNumber, z.ZodNumber], null>>;
60
+ };
61
+ export declare function validateSpatialAxes(data: SpatialPlacementSpec, ctx: RefinementCtx): void;
62
+ export declare function parseSiteSpec(input: unknown): Result<SiteSpec, BimError>;
41
63
  export interface BuildingSpec {
42
64
  readonly name: string;
43
65
  readonly description?: string;
@@ -19,7 +19,8 @@ import { CoveringSpec } from '../specs/coveringSpec.js';
19
19
  import { ElementAssemblySpec } from '../specs/assemblySpec.js';
20
20
  import { ZoneSpec, SystemSpec } from '../specs/groupSpec.js';
21
21
  import { ProjectSpec, SiteSpec, BuildingSpec, StoreySpec } from '../specs/spatialSpec.js';
22
- export type BimCategory = 'WALL' | 'SLAB' | 'BEAM' | 'COLUMN' | 'OPENING' | 'DOOR' | 'WINDOW' | 'PROXY' | 'SPACE' | 'ROOF' | 'CURTAIN_WALL' | 'FOOTING' | 'PILE' | 'STAIR' | 'RAMP' | 'RAILING' | 'COVERING' | 'ELEMENT_ASSEMBLY' | 'ZONE' | 'SYSTEM' | 'PROJECT' | 'SITE' | 'BUILDING' | 'STOREY';
22
+ import { BridgePartSpec, BridgeSpec, EarthworksFillSpec } from '../specs/infrastructureSpec.js';
23
+ export type BimCategory = 'WALL' | 'SLAB' | 'BEAM' | 'COLUMN' | 'OPENING' | 'DOOR' | 'WINDOW' | 'PROXY' | 'SPACE' | 'ROOF' | 'CURTAIN_WALL' | 'FOOTING' | 'PILE' | 'STAIR' | 'RAMP' | 'RAILING' | 'COVERING' | 'ELEMENT_ASSEMBLY' | 'ZONE' | 'SYSTEM' | 'PROJECT' | 'SITE' | 'BRIDGE' | 'BRIDGE_PART' | 'EARTHWORKS_FILL' | 'BUILDING' | 'STOREY';
23
24
  export type WallOpeningSpec = {
24
25
  readonly kind: 'WALL_OPENING';
25
26
  readonly width: number;
@@ -37,8 +38,8 @@ export type SlabOpeningSpec = {
37
38
  export type OpeningSpec = WallOpeningSpec | SlabOpeningSpec;
38
39
  export declare function isWallOpening(spec: OpeningSpec): spec is WallOpeningSpec;
39
40
  export declare function isSlabOpening(spec: OpeningSpec): spec is SlabOpeningSpec;
40
- export type BimSpecFor<C extends BimCategory> = C extends 'WALL' ? WallSpec : C extends 'SLAB' ? SlabSpec : C extends 'BEAM' ? BeamSpec : C extends 'COLUMN' ? ColumnSpec : C extends 'OPENING' ? OpeningSpec : C extends 'DOOR' ? DoorSpec : C extends 'WINDOW' ? WindowSpec : C extends 'PROXY' ? ProxySpec : C extends 'SPACE' ? SpaceSpec : C extends 'ROOF' ? RoofSpec : C extends 'CURTAIN_WALL' ? CurtainWallSpec : C extends 'FOOTING' ? FootingSpec : C extends 'PILE' ? PileSpec : C extends 'STAIR' ? StairSpec : C extends 'RAMP' ? RampSpec : C extends 'RAILING' ? RailingSpec : C extends 'COVERING' ? CoveringSpec : C extends 'ELEMENT_ASSEMBLY' ? ElementAssemblySpec : C extends 'ZONE' ? ZoneSpec : C extends 'SYSTEM' ? SystemSpec : C extends 'PROJECT' ? ProjectSpec : C extends 'SITE' ? SiteSpec : C extends 'BUILDING' ? BuildingSpec : C extends 'STOREY' ? StoreySpec : never;
41
- export type BimGeometryFor<C extends BimCategory> = C extends 'CURTAIN_WALL' ? CurtainWallGrid : C extends 'WALL' | 'SLAB' | 'BEAM' | 'COLUMN' | 'PROXY' | 'SPACE' | 'ROOF' | 'FOOTING' | 'PILE' | 'RAILING' | 'COVERING' ? ValidSolid : null;
41
+ export type BimSpecFor<C extends BimCategory> = C extends 'WALL' ? WallSpec : C extends 'SLAB' ? SlabSpec : C extends 'BEAM' ? BeamSpec : C extends 'COLUMN' ? ColumnSpec : C extends 'OPENING' ? OpeningSpec : C extends 'DOOR' ? DoorSpec : C extends 'WINDOW' ? WindowSpec : C extends 'PROXY' ? ProxySpec : C extends 'SPACE' ? SpaceSpec : C extends 'ROOF' ? RoofSpec : C extends 'CURTAIN_WALL' ? CurtainWallSpec : C extends 'FOOTING' ? FootingSpec : C extends 'PILE' ? PileSpec : C extends 'STAIR' ? StairSpec : C extends 'RAMP' ? RampSpec : C extends 'RAILING' ? RailingSpec : C extends 'COVERING' ? CoveringSpec : C extends 'ELEMENT_ASSEMBLY' ? ElementAssemblySpec : C extends 'ZONE' ? ZoneSpec : C extends 'SYSTEM' ? SystemSpec : C extends 'PROJECT' ? ProjectSpec : C extends 'SITE' ? SiteSpec : C extends 'BRIDGE' ? BridgeSpec : C extends 'BRIDGE_PART' ? BridgePartSpec : C extends 'EARTHWORKS_FILL' ? EarthworksFillSpec : C extends 'BUILDING' ? BuildingSpec : C extends 'STOREY' ? StoreySpec : never;
42
+ export type BimGeometryFor<C extends BimCategory> = C extends 'CURTAIN_WALL' ? CurtainWallGrid : C extends 'WALL' | 'SLAB' | 'BEAM' | 'COLUMN' | 'PROXY' | 'EARTHWORKS_FILL' | 'SPACE' | 'ROOF' | 'FOOTING' | 'PILE' | 'RAILING' | 'COVERING' ? ValidSolid : null;
42
43
  export interface BimElement<C extends BimCategory> {
43
44
  readonly guid: IfcGuid;
44
45
  readonly localId: LocalId;
@@ -46,4 +47,4 @@ export interface BimElement<C extends BimCategory> {
46
47
  readonly spec: BimSpecFor<C>;
47
48
  readonly geometry: BimGeometryFor<C>;
48
49
  }
49
- export type AnyBimElement = BimElement<'WALL'> | BimElement<'SLAB'> | BimElement<'BEAM'> | BimElement<'COLUMN'> | BimElement<'OPENING'> | BimElement<'DOOR'> | BimElement<'WINDOW'> | BimElement<'PROXY'> | BimElement<'SPACE'> | BimElement<'ROOF'> | BimElement<'CURTAIN_WALL'> | BimElement<'FOOTING'> | BimElement<'PILE'> | BimElement<'STAIR'> | BimElement<'RAMP'> | BimElement<'RAILING'> | BimElement<'COVERING'> | BimElement<'ELEMENT_ASSEMBLY'> | BimElement<'ZONE'> | BimElement<'SYSTEM'> | BimElement<'PROJECT'> | BimElement<'SITE'> | BimElement<'BUILDING'> | BimElement<'STOREY'>;
50
+ export type AnyBimElement = BimElement<'WALL'> | BimElement<'SLAB'> | BimElement<'BEAM'> | BimElement<'COLUMN'> | BimElement<'OPENING'> | BimElement<'DOOR'> | BimElement<'WINDOW'> | BimElement<'PROXY'> | BimElement<'SPACE'> | BimElement<'ROOF'> | BimElement<'CURTAIN_WALL'> | BimElement<'FOOTING'> | BimElement<'PILE'> | BimElement<'STAIR'> | BimElement<'RAMP'> | BimElement<'RAILING'> | BimElement<'COVERING'> | BimElement<'ELEMENT_ASSEMBLY'> | BimElement<'ZONE'> | BimElement<'SYSTEM'> | BimElement<'PROJECT'> | BimElement<'SITE'> | BimElement<'BRIDGE'> | BimElement<'BRIDGE_PART'> | BimElement<'EARTHWORKS_FILL'> | BimElement<'BUILDING'> | BimElement<'STOREY'>;
@@ -4,7 +4,7 @@ import { ValidationIssue, ValidationReport } from './severity.js';
4
4
  * across a write→read→re-write round-trip. The keys double as `typeCounts` map
5
5
  * keys so callers can assert on stable names rather than numeric web-ifc codes.
6
6
  */
7
- export declare const KEY_ENTITY_NAMES: readonly ["IfcProject", "IfcWall", "IfcSlab", "IfcBeam", "IfcColumn", "IfcRelContainedInSpatialStructure", "IfcRelAggregates", "IfcPropertySet"];
7
+ export declare const KEY_ENTITY_NAMES: readonly ["IfcProject", "IfcWall", "IfcSlab", "IfcBeam", "IfcColumn", "IfcEarthworksFill", "IfcRelContainedInSpatialStructure", "IfcRelAggregates", "IfcPropertySet"];
8
8
  export type KeyEntityName = (typeof KEY_ENTITY_NAMES)[number];
9
9
  export interface EntityCounts {
10
10
  /** Total number of entity lines in the model. */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "brepjs-bim",
3
- "version": "0.20.0",
3
+ "version": "0.22.0",
4
4
  "description": "BIM layer for brepjs — IFC4-aligned parametric building elements",
5
5
  "keywords": [
6
6
  "bim",