brepjs-bim 0.1.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.
Files changed (107) hide show
  1. package/LICENSE +191 -0
  2. package/README.md +100 -0
  3. package/dist/bcf/bcfRead.d.ts +11 -0
  4. package/dist/bcf/bcfTypes.d.ts +81 -0
  5. package/dist/bcf/bcfWrite.d.ts +14 -0
  6. package/dist/bcf/bcfXml.d.ts +34 -0
  7. package/dist/bcf/index.d.ts +3 -0
  8. package/dist/brepjs-bim.cjs +15935 -0
  9. package/dist/brepjs-bim.js +15822 -0
  10. package/dist/cobie/cobieExport.d.ts +20 -0
  11. package/dist/cobie/cobieTypes.d.ts +130 -0
  12. package/dist/cobie/index.d.ts +2 -0
  13. package/dist/elementFns/beamFns.d.ts +4 -0
  14. package/dist/elementFns/columnFns.d.ts +4 -0
  15. package/dist/elementFns/coveringFns.d.ts +4 -0
  16. package/dist/elementFns/curtainWallFns.d.ts +32 -0
  17. package/dist/elementFns/foundationFns.d.ts +5 -0
  18. package/dist/elementFns/openingFns.d.ts +4 -0
  19. package/dist/elementFns/profileFns.d.ts +5 -0
  20. package/dist/elementFns/railingFns.d.ts +4 -0
  21. package/dist/elementFns/rampFns.d.ts +14 -0
  22. package/dist/elementFns/roofFns.d.ts +4 -0
  23. package/dist/elementFns/slabFns.d.ts +4 -0
  24. package/dist/elementFns/slabOpeningFns.d.ts +4 -0
  25. package/dist/elementFns/spaceFns.d.ts +4 -0
  26. package/dist/elementFns/stairFns.d.ts +15 -0
  27. package/dist/elementFns/wallFns.d.ts +4 -0
  28. package/dist/errors/bimError.d.ts +39 -0
  29. package/dist/identity/guidDerivation.d.ts +25 -0
  30. package/dist/identity/ifcGuid.d.ts +7 -0
  31. package/dist/identity/localId.d.ts +10 -0
  32. package/dist/ids/idsCheck.d.ts +22 -0
  33. package/dist/ids/idsFacets.d.ts +21 -0
  34. package/dist/ids/idsParser.d.ts +20 -0
  35. package/dist/ids/idsTypes.d.ts +87 -0
  36. package/dist/ids/idsXml.d.ts +24 -0
  37. package/dist/ids/index.d.ts +3 -0
  38. package/dist/ifc-writer/assemblyWriter.d.ts +26 -0
  39. package/dist/ifc-writer/classificationWriter.d.ts +18 -0
  40. package/dist/ifc-writer/connectivityWriter.d.ts +16 -0
  41. package/dist/ifc-writer/coveringWriter.d.ts +12 -0
  42. package/dist/ifc-writer/curtainWallWriter.d.ts +23 -0
  43. package/dist/ifc-writer/entityWriter.d.ts +21 -0
  44. package/dist/ifc-writer/foundationWriter.d.ts +11 -0
  45. package/dist/ifc-writer/geometryWriter.d.ts +25 -0
  46. package/dist/ifc-writer/groupWriter.d.ts +19 -0
  47. package/dist/ifc-writer/headerWriter.d.ts +31 -0
  48. package/dist/ifc-writer/ifcWriter.d.ts +27 -0
  49. package/dist/ifc-writer/materialWriter.d.ts +39 -0
  50. package/dist/ifc-writer/openingWriter.d.ts +24 -0
  51. package/dist/ifc-writer/ownerHistoryWriter.d.ts +30 -0
  52. package/dist/ifc-writer/profileDefWriter.d.ts +3 -0
  53. package/dist/ifc-writer/proxyWriter.d.ts +17 -0
  54. package/dist/ifc-writer/psetWriter.d.ts +67 -0
  55. package/dist/ifc-writer/railingWriter.d.ts +11 -0
  56. package/dist/ifc-writer/relWriter.d.ts +4 -0
  57. package/dist/ifc-writer/roofWriter.d.ts +21 -0
  58. package/dist/ifc-writer/schemaVersion.d.ts +36 -0
  59. package/dist/ifc-writer/spaceWriter.d.ts +11 -0
  60. package/dist/ifc-writer/stairWriter.d.ts +49 -0
  61. package/dist/ifc-writer/styleWriter.d.ts +30 -0
  62. package/dist/ifc-writer/tessellationWriter.d.ts +42 -0
  63. package/dist/ifc-writer/typeWriter.d.ts +13 -0
  64. package/dist/import/dataRead.d.ts +65 -0
  65. package/dist/import/fromIfc.d.ts +24 -0
  66. package/dist/import/geometryRead.d.ts +41 -0
  67. package/dist/import/importedModel.d.ts +95 -0
  68. package/dist/import/placement.d.ts +89 -0
  69. package/dist/import/spatialTree.d.ts +35 -0
  70. package/dist/import/spfReader.d.ts +55 -0
  71. package/dist/index.d.ts +95 -0
  72. package/dist/model/bimModel.d.ts +151 -0
  73. package/dist/psets/psetTemplates.d.ts +41 -0
  74. package/dist/psets/qtoWeights.d.ts +32 -0
  75. package/dist/serialize/toIfc.d.ts +19 -0
  76. package/dist/specs/assemblySpec.d.ts +15 -0
  77. package/dist/specs/beamSpec.d.ts +34 -0
  78. package/dist/specs/columnSpec.d.ts +34 -0
  79. package/dist/specs/coveringSpec.d.ts +33 -0
  80. package/dist/specs/curtainWallSpec.d.ts +37 -0
  81. package/dist/specs/foundationSpec.d.ts +50 -0
  82. package/dist/specs/groupSpec.d.ts +27 -0
  83. package/dist/specs/materialSpec.d.ts +19 -0
  84. package/dist/specs/openingSpec.d.ts +42 -0
  85. package/dist/specs/profile.d.ts +108 -0
  86. package/dist/specs/profilesExtended.d.ts +86 -0
  87. package/dist/specs/proxySpec.d.ts +20 -0
  88. package/dist/specs/railingSpec.d.ts +32 -0
  89. package/dist/specs/rampSpec.d.ts +26 -0
  90. package/dist/specs/roofSpec.d.ts +32 -0
  91. package/dist/specs/slabSpec.d.ts +36 -0
  92. package/dist/specs/spaceSpec.d.ts +24 -0
  93. package/dist/specs/spatialSpec.d.ts +24 -0
  94. package/dist/specs/stairSpec.d.ts +24 -0
  95. package/dist/specs/styleSpec.d.ts +5 -0
  96. package/dist/specs/wallSpec.d.ts +33 -0
  97. package/dist/types/bimTypes.d.ts +49 -0
  98. package/dist/types/classificationTypes.d.ts +16 -0
  99. package/dist/types/materialTypes.d.ts +14 -0
  100. package/dist/types/relationships.d.ts +116 -0
  101. package/dist/units/units.d.ts +7 -0
  102. package/dist/validation/geometryValidity.d.ts +20 -0
  103. package/dist/validation/referentialIntegrity.d.ts +24 -0
  104. package/dist/validation/roundTrip.d.ts +36 -0
  105. package/dist/validation/schemaCheck.d.ts +14 -0
  106. package/dist/validation/severity.d.ts +18 -0
  107. package/package.json +42 -0
@@ -0,0 +1,86 @@
1
+ import { OrientedFace, PlanarFace, Result } from 'brepjs';
2
+ import { BimError } from '../errors/bimError.js';
3
+ export type Pt2 = readonly [number, number];
4
+ export interface LShapeProfile {
5
+ readonly kind: 'L_SHAPE';
6
+ readonly depth: number;
7
+ readonly width: number;
8
+ readonly legThickness: number;
9
+ readonly filletRadius?: number | undefined;
10
+ }
11
+ export interface TShapeProfile {
12
+ readonly kind: 'T_SHAPE';
13
+ readonly depth: number;
14
+ readonly flangeWidth: number;
15
+ readonly webThickness: number;
16
+ readonly flangeThickness: number;
17
+ readonly filletRadius?: number | undefined;
18
+ }
19
+ export interface UShapeProfile {
20
+ readonly kind: 'U_SHAPE';
21
+ readonly depth: number;
22
+ readonly flangeWidth: number;
23
+ readonly webThickness: number;
24
+ readonly flangeThickness: number;
25
+ }
26
+ export interface ZShapeProfile {
27
+ readonly kind: 'Z_SHAPE';
28
+ readonly depth: number;
29
+ readonly flangeWidth: number;
30
+ readonly webThickness: number;
31
+ readonly flangeThickness: number;
32
+ }
33
+ export interface CShapeProfile {
34
+ readonly kind: 'C_SHAPE';
35
+ readonly depth: number;
36
+ readonly width: number;
37
+ readonly wallThickness: number;
38
+ readonly girth: number;
39
+ readonly internalFilletRadius?: number | undefined;
40
+ }
41
+ export interface AsymmetricIShapeProfile {
42
+ readonly kind: 'ASYMMETRIC_I';
43
+ readonly overallDepth: number;
44
+ readonly webThickness: number;
45
+ readonly topFlangeWidth: number;
46
+ readonly topFlangeThickness: number;
47
+ readonly bottomFlangeWidth: number;
48
+ readonly bottomFlangeThickness: number;
49
+ }
50
+ export interface EllipseProfile {
51
+ readonly kind: 'ELLIPSE';
52
+ readonly semiAxis1: number;
53
+ readonly semiAxis2: number;
54
+ }
55
+ export interface TrapeziumProfile {
56
+ readonly kind: 'TRAPEZIUM';
57
+ readonly bottomXDim: number;
58
+ readonly topXDim: number;
59
+ readonly yDim: number;
60
+ readonly topXOffset: number;
61
+ }
62
+ export interface RectangleHollowProfile {
63
+ readonly kind: 'RECTANGLE_HOLLOW';
64
+ readonly xDim: number;
65
+ readonly yDim: number;
66
+ readonly wallThickness: number;
67
+ readonly innerFilletRadius?: number | undefined;
68
+ readonly outerFilletRadius?: number | undefined;
69
+ }
70
+ export interface CircleHollowProfile {
71
+ readonly kind: 'CIRCLE_HOLLOW';
72
+ readonly radius: number;
73
+ readonly wallThickness: number;
74
+ }
75
+ export interface ArbitraryClosedProfile {
76
+ readonly kind: 'ARBITRARY_CLOSED';
77
+ readonly points: ReadonlyArray<Pt2>;
78
+ }
79
+ export interface ArbitraryProfileWithVoids {
80
+ readonly kind: 'ARBITRARY_WITH_VOIDS';
81
+ readonly outerPoints: ReadonlyArray<Pt2>;
82
+ readonly voids: ReadonlyArray<ReadonlyArray<Pt2>>;
83
+ }
84
+ export type ExtendedProfile = LShapeProfile | TShapeProfile | UShapeProfile | ZShapeProfile | CShapeProfile | AsymmetricIShapeProfile | EllipseProfile | TrapeziumProfile | RectangleHollowProfile | CircleHollowProfile | ArbitraryClosedProfile | ArbitraryProfileWithVoids;
85
+ export declare function extendedProfileArea(profile: ExtendedProfile): number;
86
+ export declare function extendedProfileToFace(profile: ExtendedProfile): Result<OrientedFace & PlanarFace, BimError>;
@@ -0,0 +1,20 @@
1
+ import { ValidSolid } from 'brepjs';
2
+ /**
3
+ * Specification for an IfcBuildingElementProxy — arbitrary geometry that does
4
+ * not map to a typed element (wall/slab/beam/column). The solid is exported via
5
+ * the tessellation path (IfcTriangulatedFaceSet). All custom-property values are
6
+ * grouped by pset name. The solid is a brepjs ValidSolid handle, so this spec is
7
+ * not a plain serializable object and is validated structurally, not via Zod.
8
+ */
9
+ export interface ProxySpec {
10
+ readonly name: string;
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.
15
+ */
16
+ readonly solid: ValidSolid;
17
+ readonly materialName?: string | undefined;
18
+ readonly predefinedType?: 'COMPLEX' | 'ELEMENT' | 'NOTDEFINED' | 'PARTIAL' | undefined;
19
+ readonly customProperties?: Readonly<Record<string, Readonly<Record<string, string | number | boolean>>>> | undefined;
20
+ }
@@ -0,0 +1,32 @@
1
+ import { BimError } from '../errors/bimError.js';
2
+ import { Result } from 'brepjs';
3
+ import { MaterialLayer } from '../types/materialTypes.js';
4
+ import { ClassificationRef } from '../types/classificationTypes.js';
5
+ export type RailingPredefinedType = 'BALUSTRADE' | 'GUARDRAIL' | 'HANDRAIL' | 'NOTDEFINED';
6
+ /**
7
+ * A straight railing run: a rail of rectangular cross-section (thickness × height)
8
+ * swept along the run length. All dimensions in mm. The cross-section profile lies
9
+ * in the local YZ plane and is swept along local +X by `length`.
10
+ * origin/axisX/axisZ position the railing in world space via IfcLocalPlacement.
11
+ */
12
+ export interface RailingSpec {
13
+ readonly length: number;
14
+ readonly height: number;
15
+ readonly thickness: number;
16
+ readonly origin: [number, number, number];
17
+ readonly axisX: [number, number, number];
18
+ readonly axisZ: [number, number, number];
19
+ readonly predefinedType?: RailingPredefinedType | undefined;
20
+ readonly materialName: string;
21
+ readonly isExternal?: boolean | undefined;
22
+ readonly fireRating?: string | undefined;
23
+ readonly status?: string | undefined;
24
+ readonly materialLayers?: readonly MaterialLayer[] | undefined;
25
+ readonly layerSetName?: string | undefined;
26
+ readonly classification?: ClassificationRef | undefined;
27
+ readonly manufacturerName?: string | undefined;
28
+ readonly manufacturerModel?: string | undefined;
29
+ readonly manufacturerProductionYear?: number | undefined;
30
+ readonly customProperties?: Readonly<Record<string, Readonly<Record<string, string | number | boolean>>>> | undefined;
31
+ }
32
+ export declare function parseRailingSpec(input: unknown): Result<RailingSpec, BimError>;
@@ -0,0 +1,26 @@
1
+ import { BimError } from '../errors/bimError.js';
2
+ import { Result } from 'brepjs';
3
+ import { ClassificationRef } from '../types/classificationTypes.js';
4
+ export type RampPredefinedType = 'STRAIGHT_RUN_RAMP' | 'TWO_STRAIGHT_RUN_RAMP' | 'QUARTER_TURN_RAMP' | 'TWO_QUARTER_TURN_RAMP' | 'HALF_TURN_RAMP' | 'SPIRAL_RAMP' | 'NOTDEFINED';
5
+ export type RampFlightPredefinedType = 'STRAIGHT' | 'SPIRAL' | 'NOTDEFINED';
6
+ export interface RampFlightSpec {
7
+ readonly width: number;
8
+ readonly length: number;
9
+ readonly slope: number;
10
+ readonly thickness: number;
11
+ readonly origin: [number, number, number];
12
+ readonly axisX: [number, number, number];
13
+ readonly axisZ: [number, number, number];
14
+ readonly materialName: string;
15
+ readonly predefinedType?: RampFlightPredefinedType | undefined;
16
+ }
17
+ export interface RampSpec {
18
+ readonly name?: string | undefined;
19
+ readonly predefinedType?: RampPredefinedType | undefined;
20
+ readonly flights: readonly RampFlightSpec[];
21
+ readonly materialName: string;
22
+ readonly status?: string | undefined;
23
+ readonly classification?: ClassificationRef | undefined;
24
+ }
25
+ export declare function parseRampFlightSpec(input: unknown): Result<RampFlightSpec, BimError>;
26
+ export declare function parseRampSpec(input: unknown): Result<RampSpec, BimError>;
@@ -0,0 +1,32 @@
1
+ import { BimError } from '../errors/bimError.js';
2
+ import { Result } from 'brepjs';
3
+ import { MaterialLayer } from '../types/materialTypes.js';
4
+ import { ClassificationRef } from '../types/classificationTypes.js';
5
+ export type RoofPredefinedType = 'FLAT_ROOF' | 'SHED_ROOF' | 'GABLE_ROOF' | 'HIP_ROOF' | 'HIPPED_GABLE_ROOF' | 'GAMBREL_ROOF' | 'MANSARD_ROOF' | 'BARREL_ROOF' | 'RAINBOW_ROOF' | 'BUTTERFLY_ROOF' | 'PAVILION_ROOF' | 'DOME_ROOF' | 'FREEFORM' | 'NOTDEFINED';
6
+ export interface RoofSpec {
7
+ readonly length: number;
8
+ readonly width: number;
9
+ readonly thickness: number;
10
+ readonly origin: [number, number, number];
11
+ readonly axisX: [number, number, number];
12
+ readonly axisZ: [number, number, number];
13
+ readonly predefinedType: RoofPredefinedType;
14
+ readonly materialName: string;
15
+ readonly isExternal?: boolean | undefined;
16
+ readonly fireRating?: string | undefined;
17
+ readonly thermalTransmittance?: number | undefined;
18
+ readonly status?: string | undefined;
19
+ /**
20
+ * When present, the roof is associated via a layered IfcMaterialLayerSet built
21
+ * from these layers instead of the bare `materialName` IfcMaterial.
22
+ */
23
+ readonly materialLayers?: readonly MaterialLayer[] | undefined;
24
+ readonly layerSetName?: string | undefined;
25
+ /** When present, associates the roof with an external classification code. */
26
+ readonly classification?: ClassificationRef | undefined;
27
+ readonly manufacturerName?: string | undefined;
28
+ readonly manufacturerModel?: string | undefined;
29
+ readonly manufacturerProductionYear?: number | undefined;
30
+ readonly customProperties?: Readonly<Record<string, Readonly<Record<string, string | number | boolean>>>> | undefined;
31
+ }
32
+ export declare function parseRoofSpec(input: unknown): Result<RoofSpec, BimError>;
@@ -0,0 +1,36 @@
1
+ import { BimError } from '../errors/bimError.js';
2
+ import { Result } from 'brepjs';
3
+ import { MaterialLayer } from '../types/materialTypes.js';
4
+ import { ClassificationRef } from '../types/classificationTypes.js';
5
+ export type SlabPredefinedType = 'FLOOR' | 'ROOF' | 'LANDING' | 'BASESLAB';
6
+ export interface SlabSpec {
7
+ readonly length: number;
8
+ readonly width: number;
9
+ readonly thickness: number;
10
+ readonly origin: [number, number, number];
11
+ readonly axisX: [number, number, number];
12
+ readonly axisZ: [number, number, number];
13
+ readonly predefinedType: SlabPredefinedType;
14
+ readonly materialName: string;
15
+ readonly isExternal?: boolean | undefined;
16
+ readonly fireRating?: string | undefined;
17
+ readonly acousticRating?: string | undefined;
18
+ readonly thermalTransmittance?: number | undefined;
19
+ readonly loadBearing?: boolean | undefined;
20
+ readonly combustible?: boolean | undefined;
21
+ readonly compartmentation?: boolean | undefined;
22
+ readonly status?: string | undefined;
23
+ /**
24
+ * When present, the slab is associated via a layered IfcMaterialLayerSet built
25
+ * from these layers instead of the bare `materialName` IfcMaterial.
26
+ */
27
+ readonly materialLayers?: readonly MaterialLayer[] | undefined;
28
+ readonly layerSetName?: string | undefined;
29
+ /** When present, associates the slab with an external classification code. */
30
+ readonly classification?: ClassificationRef | undefined;
31
+ readonly manufacturerName?: string | undefined;
32
+ readonly manufacturerModel?: string | undefined;
33
+ readonly manufacturerProductionYear?: number | undefined;
34
+ readonly customProperties?: Readonly<Record<string, Readonly<Record<string, string | number | boolean>>>> | undefined;
35
+ }
36
+ export declare function parseSlabSpec(input: unknown): Result<SlabSpec, BimError>;
@@ -0,0 +1,24 @@
1
+ import { BimError } from '../errors/bimError.js';
2
+ import { Result } from 'brepjs';
3
+ import { ClassificationRef } from '../types/classificationTypes.js';
4
+ export type SpacePredefinedType = 'SPACE' | 'PARKING' | 'GFA' | 'INTERNAL' | 'EXTERNAL' | 'NOTDEFINED';
5
+ export interface SpaceSpec {
6
+ readonly name: string;
7
+ readonly length: number;
8
+ readonly width: number;
9
+ readonly height: number;
10
+ readonly origin: [number, number, number];
11
+ readonly axisX: [number, number, number];
12
+ readonly axisZ: [number, number, number];
13
+ readonly materialName: string;
14
+ readonly predefinedType?: SpacePredefinedType | undefined;
15
+ readonly longName?: string | undefined;
16
+ readonly isExternal?: boolean | undefined;
17
+ readonly status?: string | undefined;
18
+ readonly finishCeiling?: string | undefined;
19
+ readonly finishFloor?: string | undefined;
20
+ /** When present, associates the space with an external classification code. */
21
+ readonly classification?: ClassificationRef | undefined;
22
+ readonly customProperties?: Readonly<Record<string, Readonly<Record<string, string | number | boolean>>>> | undefined;
23
+ }
24
+ export declare function parseSpaceSpec(input: unknown): Result<SpaceSpec, BimError>;
@@ -0,0 +1,24 @@
1
+ export interface ProjectSpec {
2
+ readonly name: string;
3
+ readonly description?: string;
4
+ /**
5
+ * Optional stable, globally-unique project identifier used to scope all derived
6
+ * GlobalIds. Supply a UUID (or any stable unique string) when the model will be
7
+ * federated/diffed/exported to COBie/BCF so its GlobalIds are unique across
8
+ * models. When omitted, the scope falls back to the project name+description
9
+ * (stable, but unique only per distinct name).
10
+ */
11
+ readonly projectId?: string;
12
+ }
13
+ export interface SiteSpec {
14
+ readonly name: string;
15
+ readonly description?: string;
16
+ }
17
+ export interface BuildingSpec {
18
+ readonly name: string;
19
+ readonly description?: string;
20
+ }
21
+ export interface StoreySpec {
22
+ readonly name: string;
23
+ readonly elevation: number;
24
+ }
@@ -0,0 +1,24 @@
1
+ import { BimError } from '../errors/bimError.js';
2
+ import { Result } from 'brepjs';
3
+ import { ClassificationRef } from '../types/classificationTypes.js';
4
+ export type StairPredefinedType = 'STRAIGHT_RUN_STAIR' | 'TWO_STRAIGHT_RUN_STAIR' | 'QUARTER_WINDING_STAIR' | 'QUARTER_TURN_STAIR' | 'HALF_WINDING_STAIR' | 'HALF_TURN_STAIR' | 'TWO_QUARTER_WINDING_STAIR' | 'TWO_QUARTER_TURN_STAIR' | 'THREE_QUARTER_WINDING_STAIR' | 'THREE_QUARTER_TURN_STAIR' | 'SPIRAL_STAIR' | 'DOUBLE_RETURN_STAIR' | 'CURVED_RUN_STAIR' | 'TWO_CURVED_RUN_STAIR' | 'NOTDEFINED';
5
+ export interface StairFlightSpec {
6
+ readonly width: number;
7
+ readonly riserHeight: number;
8
+ readonly treadLength: number;
9
+ readonly numberOfRisers: number;
10
+ readonly origin: [number, number, number];
11
+ readonly axisX: [number, number, number];
12
+ readonly axisZ: [number, number, number];
13
+ readonly materialName: string;
14
+ }
15
+ export interface StairSpec {
16
+ readonly name?: string | undefined;
17
+ readonly predefinedType?: StairPredefinedType | undefined;
18
+ readonly flights: readonly StairFlightSpec[];
19
+ readonly materialName: string;
20
+ readonly status?: string | undefined;
21
+ readonly classification?: ClassificationRef | undefined;
22
+ }
23
+ export declare function parseStairFlightSpec(input: unknown): Result<StairFlightSpec, BimError>;
24
+ export declare function parseStairSpec(input: unknown): Result<StairSpec, BimError>;
@@ -0,0 +1,5 @@
1
+ import { BimError } from '../errors/bimError.js';
2
+ import { Result } from 'brepjs';
3
+ import { SurfaceStyleSpec } from '../ifc-writer/styleWriter.js';
4
+ export declare function parseSurfaceStyleSpec(input: unknown): Result<SurfaceStyleSpec, BimError>;
5
+ export type { SurfaceStyleSpec } from '../ifc-writer/styleWriter.js';
@@ -0,0 +1,33 @@
1
+ import { BimError } from '../errors/bimError.js';
2
+ import { Result } from 'brepjs';
3
+ import { MaterialLayer } from '../types/materialTypes.js';
4
+ import { ClassificationRef } from '../types/classificationTypes.js';
5
+ /** A straight wall aligned along an arbitrary axis in 3D. All dimensions in mm. */
6
+ export interface WallSpec {
7
+ readonly length: number;
8
+ readonly height: number;
9
+ readonly thickness: number;
10
+ readonly origin: [number, number, number];
11
+ readonly axisX: [number, number, number];
12
+ readonly axisZ: [number, number, number];
13
+ readonly materialName: string;
14
+ readonly isExternal?: boolean | undefined;
15
+ readonly fireRating?: string | undefined;
16
+ readonly acousticRating?: string | undefined;
17
+ readonly thermalTransmittance?: number | undefined;
18
+ readonly loadBearing?: boolean | undefined;
19
+ readonly status?: string | undefined;
20
+ /**
21
+ * When present, the wall is associated via a layered IfcMaterialLayerSet built
22
+ * from these layers instead of the bare `materialName` IfcMaterial.
23
+ */
24
+ readonly materialLayers?: readonly MaterialLayer[] | undefined;
25
+ readonly layerSetName?: string | undefined;
26
+ /** When present, associates the wall with an external classification code. */
27
+ readonly classification?: ClassificationRef | undefined;
28
+ readonly manufacturerName?: string | undefined;
29
+ readonly manufacturerModel?: string | undefined;
30
+ readonly manufacturerProductionYear?: number | undefined;
31
+ readonly customProperties?: Readonly<Record<string, Readonly<Record<string, string | number | boolean>>>> | undefined;
32
+ }
33
+ export declare function parseWallSpec(input: unknown): Result<WallSpec, BimError>;
@@ -0,0 +1,49 @@
1
+ import { ValidSolid } from 'brepjs';
2
+ import { IfcGuid } from '../identity/ifcGuid.js';
3
+ import { LocalId } from '../identity/localId.js';
4
+ import { WallSpec } from '../specs/wallSpec.js';
5
+ import { SlabSpec } from '../specs/slabSpec.js';
6
+ import { BeamSpec } from '../specs/beamSpec.js';
7
+ import { ColumnSpec } from '../specs/columnSpec.js';
8
+ import { DoorSpec, WindowSpec } from '../specs/openingSpec.js';
9
+ import { ProxySpec } from '../specs/proxySpec.js';
10
+ import { SpaceSpec } from '../specs/spaceSpec.js';
11
+ import { RoofSpec } from '../specs/roofSpec.js';
12
+ import { CurtainWallSpec } from '../specs/curtainWallSpec.js';
13
+ import { CurtainWallGrid } from '../elementFns/curtainWallFns.js';
14
+ import { FootingSpec, PileSpec } from '../specs/foundationSpec.js';
15
+ import { StairSpec } from '../specs/stairSpec.js';
16
+ import { RampSpec } from '../specs/rampSpec.js';
17
+ import { RailingSpec } from '../specs/railingSpec.js';
18
+ import { CoveringSpec } from '../specs/coveringSpec.js';
19
+ import { ElementAssemblySpec } from '../specs/assemblySpec.js';
20
+ import { ZoneSpec, SystemSpec } from '../specs/groupSpec.js';
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';
23
+ export type WallOpeningSpec = {
24
+ readonly kind: 'WALL_OPENING';
25
+ readonly width: number;
26
+ readonly height: number;
27
+ readonly offsetAlongWall: number;
28
+ readonly offsetFromFloor: number;
29
+ };
30
+ export type SlabOpeningSpec = {
31
+ readonly kind: 'SLAB_OPENING';
32
+ readonly sizeX: number;
33
+ readonly sizeY: number;
34
+ readonly offsetX: number;
35
+ readonly offsetY: number;
36
+ };
37
+ export type OpeningSpec = WallOpeningSpec | SlabOpeningSpec;
38
+ export declare function isWallOpening(spec: OpeningSpec): spec is WallOpeningSpec;
39
+ 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;
42
+ export interface BimElement<C extends BimCategory> {
43
+ readonly guid: IfcGuid;
44
+ readonly localId: LocalId;
45
+ readonly category: C;
46
+ readonly spec: BimSpecFor<C>;
47
+ readonly geometry: BimGeometryFor<C>;
48
+ }
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'>;
@@ -0,0 +1,16 @@
1
+ /**
2
+ * A reference into an external classification system (e.g. Uniclass 2015 or
3
+ * OmniClass). Pure data, no imports, so it is safe to import from any layer.
4
+ */
5
+ export interface ClassificationRef {
6
+ /** Classification system name, e.g. 'Uniclass2015'. */
7
+ readonly system: string;
8
+ /** Edition of the system, e.g. '2015'. */
9
+ readonly edition?: string | undefined;
10
+ /** URL locating the system or table. */
11
+ readonly location?: string | undefined;
12
+ /** The classification code, e.g. 'Ss_15_10_30_14'. */
13
+ readonly code: string;
14
+ /** Human-readable label for the referenced code. */
15
+ readonly description?: string | undefined;
16
+ }
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Shared material-association value types. Pure data, no imports, so they are
3
+ * safe to reference from both the type layer (relationships, specs) and the
4
+ * ifc-writer layer without risking a circular import.
5
+ */
6
+ /** One physical layer in a layered material set (e.g. a wall build-up). */
7
+ export interface MaterialLayer {
8
+ readonly name: string;
9
+ readonly thicknessMm: number;
10
+ readonly isVentilated?: boolean | undefined;
11
+ readonly priority?: number | undefined;
12
+ /** Bulk density (kg/m³) for analytic weight quantities; nominal lookup used when absent. */
13
+ readonly densityKgM3?: number | undefined;
14
+ }
@@ -0,0 +1,116 @@
1
+ import { IfcGuid } from '../identity/ifcGuid.js';
2
+ import { LocalId } from '../identity/localId.js';
3
+ import { MaterialLayer } from './materialTypes.js';
4
+ import { ClassificationRef } from './classificationTypes.js';
5
+ export interface AggregatesRel {
6
+ readonly kind: 'AGGREGATES';
7
+ readonly guid: IfcGuid;
8
+ readonly localId: LocalId;
9
+ readonly relatingObject: LocalId;
10
+ readonly relatedObjects: readonly LocalId[];
11
+ }
12
+ export interface ContainedInRel {
13
+ readonly kind: 'CONTAINED_IN';
14
+ readonly guid: IfcGuid;
15
+ readonly localId: LocalId;
16
+ readonly relatingStructure: LocalId;
17
+ readonly relatedElements: readonly LocalId[];
18
+ }
19
+ export interface AssociatesMaterialRel {
20
+ readonly kind: 'ASSOCIATES_MATERIAL';
21
+ readonly guid: IfcGuid;
22
+ readonly localId: LocalId;
23
+ readonly materialName: string;
24
+ readonly relatedObjects: readonly LocalId[];
25
+ /**
26
+ * When present, the element is associated via an IfcMaterialLayerSet built from
27
+ * these layers instead of the bare `materialName` IfcMaterial.
28
+ */
29
+ readonly materialLayers?: readonly MaterialLayer[] | undefined;
30
+ readonly layerSetName?: string | undefined;
31
+ }
32
+ export interface AssociatesClassificationRel {
33
+ readonly kind: 'ASSOCIATES_CLASSIFICATION';
34
+ readonly guid: IfcGuid;
35
+ readonly localId: LocalId;
36
+ readonly ref: ClassificationRef;
37
+ readonly relatedObjects: readonly LocalId[];
38
+ }
39
+ export interface VoidsWallRel {
40
+ readonly kind: 'VOIDS_WALL';
41
+ readonly guid: IfcGuid;
42
+ readonly localId: LocalId;
43
+ readonly wallLocalId: LocalId;
44
+ readonly openingLocalId: LocalId;
45
+ }
46
+ export interface VoidsSlabRel {
47
+ readonly kind: 'VOIDS_SLAB';
48
+ readonly guid: IfcGuid;
49
+ readonly localId: LocalId;
50
+ readonly slabLocalId: LocalId;
51
+ readonly openingLocalId: LocalId;
52
+ }
53
+ export interface FillsOpeningRel {
54
+ readonly kind: 'FILLS_OPENING';
55
+ readonly guid: IfcGuid;
56
+ readonly localId: LocalId;
57
+ readonly openingLocalId: LocalId;
58
+ readonly fillerLocalId: LocalId;
59
+ }
60
+ export interface SpaceBoundaryRel {
61
+ readonly kind: 'SPACE_BOUNDARY';
62
+ readonly guid: IfcGuid;
63
+ readonly localId: LocalId;
64
+ readonly spaceLocalId: LocalId;
65
+ readonly elementLocalId: LocalId;
66
+ readonly connectionType: 'PHYSICAL' | 'VIRTUAL' | 'NOTDEFINED';
67
+ }
68
+ /** Element-level decomposition of an IfcElementAssembly into its parts. */
69
+ export interface NestsRel {
70
+ readonly kind: 'NESTS';
71
+ readonly guid: IfcGuid;
72
+ readonly localId: LocalId;
73
+ readonly relatingObject: LocalId;
74
+ readonly relatedObjects: readonly LocalId[];
75
+ }
76
+ /** Logical connection between two elements (IfcRelConnectsElements). */
77
+ export interface ConnectsElementsRel {
78
+ readonly kind: 'CONNECTS_ELEMENTS';
79
+ readonly guid: IfcGuid;
80
+ readonly localId: LocalId;
81
+ readonly relatingElementLocalId: LocalId;
82
+ readonly relatedElementLocalId: LocalId;
83
+ readonly description?: string | undefined;
84
+ }
85
+ /** Connection between two path-based elements at specified ends (IfcRelConnectsPathElements). */
86
+ export interface ConnectsPathElementsRel {
87
+ readonly kind: 'CONNECTS_PATH_ELEMENTS';
88
+ readonly guid: IfcGuid;
89
+ readonly localId: LocalId;
90
+ readonly relatingElementLocalId: LocalId;
91
+ readonly relatedElementLocalId: LocalId;
92
+ readonly relatingConnectionType: 'ATSTART' | 'ATEND' | 'ATPATH' | 'NOTDEFINED';
93
+ readonly relatedConnectionType: 'ATSTART' | 'ATEND' | 'ATPATH' | 'NOTDEFINED';
94
+ readonly description?: string | undefined;
95
+ }
96
+ /** Links a covering to the building element it covers (IfcRelCoversBldgElements). */
97
+ export interface CoversElementRel {
98
+ readonly kind: 'COVERS_ELEMENT';
99
+ readonly guid: IfcGuid;
100
+ readonly localId: LocalId;
101
+ readonly hostLocalId: LocalId;
102
+ readonly coveringLocalId: LocalId;
103
+ }
104
+ /**
105
+ * Assigns members to a grouping object — a zone or system (IfcRelAssignsToGroup).
106
+ * `groupLocalId` is the IfcZone/IfcSystem; `memberLocalIds` are the assigned
107
+ * spaces or elements.
108
+ */
109
+ export interface AssignsToGroupRel {
110
+ readonly kind: 'ASSIGNS_TO_GROUP';
111
+ readonly guid: IfcGuid;
112
+ readonly localId: LocalId;
113
+ readonly groupLocalId: LocalId;
114
+ readonly memberLocalIds: readonly LocalId[];
115
+ }
116
+ export type BimRelationship = AggregatesRel | ContainedInRel | AssociatesMaterialRel | AssociatesClassificationRel | VoidsWallRel | VoidsSlabRel | FillsOpeningRel | SpaceBoundaryRel | NestsRel | ConnectsElementsRel | ConnectsPathElementsRel | CoversElementRel | AssignsToGroupRel;
@@ -0,0 +1,7 @@
1
+ export type LengthUnit = 'mm' | 'm' | 'in' | 'ft';
2
+ export interface UnitSystem {
3
+ readonly length: LengthUnit;
4
+ }
5
+ export declare const DEFAULT_UNITS: UnitSystem;
6
+ export declare function toLengthMm(value: number, unit: LengthUnit): number;
7
+ export declare function toIfcLengthM(mm: number): number;
@@ -0,0 +1,20 @@
1
+ import { ValidSolid } from 'brepjs';
2
+ import { ValidationReport } from './severity.js';
3
+ /**
4
+ * GEOMETRY-VALIDITY gate.
5
+ *
6
+ * Validates one or more brepjs ValidSolids for IFC export readiness:
7
+ * - BRepCheck validity (isValid). Invalid topology that autoHeal cannot
8
+ * repair is an error; geometry that only became valid after healing is a
9
+ * warning (the exported solid differs from the authored one).
10
+ * - Non-zero volume (measureVolume > MIN_VOLUME_MM3). Zero/negative volume
11
+ * is an error — such a solid carries no usable geometry.
12
+ *
13
+ * The brand `ValidSolid` only asserts validity at construction time; transforms
14
+ * (scaling, boolean ops, sweeps) can still yield degenerate or invalid results,
15
+ * so the runtime checks here are not redundant with the type.
16
+ *
17
+ * `entity` is the human-readable identifier surfaced on each ValidationIssue.
18
+ * When validating a list it is appended with the element index.
19
+ */
20
+ export declare function checkGeometryValidity(solids: ValidSolid | readonly ValidSolid[], entity?: string): ValidationReport;
@@ -0,0 +1,24 @@
1
+ import { AnyBimElement } from '../types/bimTypes.js';
2
+ import { BimRelationship } from '../types/relationships.js';
3
+ import { ValidationReport } from './severity.js';
4
+ export interface ModelGraph {
5
+ readonly elements: readonly AnyBimElement[];
6
+ readonly relationships: readonly BimRelationship[];
7
+ }
8
+ interface ModelAccessor {
9
+ getAllElements(): readonly AnyBimElement[];
10
+ getAllRelationships(): readonly BimRelationship[];
11
+ }
12
+ export type IntegrityInput = ModelGraph | ModelAccessor;
13
+ /**
14
+ * Validates the in-memory model graph for referential integrity and spatial
15
+ * containment completeness, returning a ValidationReport. Flags:
16
+ *
17
+ * - orphaned physical elements (not contained in any spatial structure),
18
+ * - elements contained in more than one structure,
19
+ * - voids/fills inconsistencies (a void referencing a missing host or opening,
20
+ * a fill referencing a missing opening or filler),
21
+ * - openings referenced by no void rel (warning).
22
+ */
23
+ export declare function checkReferentialIntegrity(input: IntegrityInput): ValidationReport;
24
+ export {};
@@ -0,0 +1,36 @@
1
+ import { ValidationIssue, ValidationReport } from './severity.js';
2
+ /**
3
+ * Human-readable names of the key entities whose per-type counts are compared
4
+ * across a write→read→re-write round-trip. The keys double as `typeCounts` map
5
+ * keys so callers can assert on stable names rather than numeric web-ifc codes.
6
+ */
7
+ export declare const KEY_ENTITY_NAMES: readonly ["IfcProject", "IfcWall", "IfcSlab", "IfcBeam", "IfcColumn", "IfcRelContainedInSpatialStructure", "IfcRelAggregates", "IfcPropertySet"];
8
+ export type KeyEntityName = (typeof KEY_ENTITY_NAMES)[number];
9
+ export interface EntityCounts {
10
+ /** Total number of entity lines in the model. */
11
+ readonly totalCount: number;
12
+ /** Count per key entity, keyed by IFC entity name. */
13
+ readonly typeCounts: Readonly<Record<string, number>>;
14
+ }
15
+ export interface RoundTripReport extends ValidationReport {
16
+ readonly firstPass: EntityCounts;
17
+ readonly secondPass: EntityCounts;
18
+ }
19
+ /**
20
+ * Open the given IFC bytes with web-ifc and count the total entity lines plus
21
+ * the per-type counts for the key entities. The model is always closed before
22
+ * returning, even if reading throws.
23
+ */
24
+ export declare function firstPassCounts(bytes: Uint8Array): Promise<EntityCounts>;
25
+ /**
26
+ * Compare two count snapshots and report any delta. A difference in the total
27
+ * entity-line count or in any key per-type count is an error: a stable model
28
+ * must round-trip without gaining or losing entities.
29
+ */
30
+ export declare function compareCounts(first: EntityCounts, second: EntityCounts): ValidationIssue[];
31
+ /**
32
+ * Write→read→re-write round-trip self-check. Opens the produced IFC bytes,
33
+ * re-saves them, re-opens the re-saved bytes, and reports any count delta in the
34
+ * total entity-line count or the key per-type counts (per the severity model).
35
+ */
36
+ export declare function checkRoundTrip(bytes: Uint8Array): Promise<RoundTripReport>;