brepjs-bim 0.3.1 → 0.5.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.
@@ -0,0 +1,22 @@
1
+ import { Result } from 'brepjs';
2
+ import { ResolvedElement } from 'brepjs-families';
3
+ import { BimModel } from './model/bimModel.js';
4
+ import { LocalId } from './identity/localId.js';
5
+ import { ProjectSpec } from './specs/spatialSpec.js';
6
+ import { BimError } from './errors/bimError.js';
7
+ export interface FamiliesToBimOptions {
8
+ readonly project: ProjectSpec;
9
+ readonly siteName?: string | undefined;
10
+ readonly buildingName?: string | undefined;
11
+ }
12
+ export interface FamiliesBimResult {
13
+ readonly model: BimModel;
14
+ /** LocalId per geometry-bearing families key path. */
15
+ readonly idByKeyPath: ReadonlyMap<string, LocalId>;
16
+ }
17
+ /**
18
+ * Project a resolved families tree into an eager BimModel. The caller owns
19
+ * the returned model (`using`); families stays domain-neutral — this adapter
20
+ * is where families types meet the IFC vocabulary.
21
+ */
22
+ export declare function familiesToBim(root: ResolvedElement, options: FamiliesToBimOptions): Result<FamiliesBimResult, BimError>;
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export { BimModel } from './model/bimModel.js';
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
4
  export { toIfc, toIfcValidated } from './serialize/toIfc.js';
@@ -96,3 +96,4 @@ export type { IdsDocument, IdsSpecification, IdsFacet, IdsRestriction, IdsCardin
96
96
  export { serializeBcfFiles, parseBcfFiles } from './bcf/index.js';
97
97
  export type { BcfColoring, BcfComment, BcfComponent, BcfComponents, BcfContainerData, BcfFiles, BcfProject, BcfTopic, BcfVersion, BcfViewpoint, BcfVisibility, } from './bcf/index.js';
98
98
  export { bcfError, idsError } from './errors/bimError.js';
99
+ export { familiesToBim, type FamiliesToBimOptions, type FamiliesBimResult, } from './familiesAdapter.js';
@@ -23,15 +23,25 @@ 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
+ /** Optional identity override for created elements: a stable key (e.g. a
27
+ * families key path) that replaces the positional GlobalId derivation. */
28
+ export interface ElementIdentityOptions {
29
+ readonly stableKey?: string | undefined;
30
+ }
31
+ /** Identity options for adders that create TWO elements: `stableKey` names
32
+ * the filler (door/window), `openingStableKey` the synthesized opening. */
33
+ export interface OpeningIdentityOptions extends ElementIdentityOptions {
34
+ readonly openingStableKey?: string | undefined;
35
+ }
26
36
  export declare class BimModel {
27
37
  #private;
28
38
  init(spec: ProjectSpec): Result<LocalId, BimError>;
29
39
  [Symbol.dispose](): void;
30
40
  addSite(spec: SiteSpec): LocalId;
31
- addBuilding(spec: BuildingSpec): LocalId;
32
- addStorey(spec: StoreySpec): LocalId;
33
- addWall(spec: WallSpec): Result<LocalId, BimError>;
34
- addSlab(spec: SlabSpec): Result<LocalId, BimError>;
41
+ addBuilding(spec: BuildingSpec, options?: ElementIdentityOptions): LocalId;
42
+ addStorey(spec: StoreySpec, options?: ElementIdentityOptions): LocalId;
43
+ addWall(spec: WallSpec, options?: ElementIdentityOptions): Result<LocalId, BimError>;
44
+ addSlab(spec: SlabSpec, options?: ElementIdentityOptions): Result<LocalId, BimError>;
35
45
  addBeam(spec: BeamSpec): Result<LocalId, BimError>;
36
46
  addColumn(spec: ColumnSpec): Result<LocalId, BimError>;
37
47
  addSpace(spec: SpaceSpec): Result<LocalId, BimError>;
@@ -121,9 +131,9 @@ export declare class BimModel {
121
131
  * {@link ProxySpec.solid}).
122
132
  */
123
133
  addProxy(spec: ProxySpec): Result<LocalId, BimError>;
124
- addDoor(spec: DoorSpec): Result<LocalId, BimError>;
125
- addWindow(spec: WindowSpec): Result<LocalId, BimError>;
126
- addSlabOpening(input: SlabOpeningInput): Result<LocalId, BimError>;
134
+ addDoor(spec: DoorSpec, options?: OpeningIdentityOptions): Result<LocalId, BimError>;
135
+ addWindow(spec: WindowSpec, options?: OpeningIdentityOptions): Result<LocalId, BimError>;
136
+ addSlabOpening(input: SlabOpeningInput, options?: ElementIdentityOptions): Result<LocalId, BimError>;
127
137
  getDoors(): BimElement<'DOOR'>[];
128
138
  getWindows(): BimElement<'WINDOW'>[];
129
139
  aggregate(parentId: LocalId, childId: LocalId): void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "brepjs-bim",
3
- "version": "0.3.1",
3
+ "version": "0.5.0",
4
4
  "description": "BIM layer for brepjs — IFC4-aligned parametric building elements",
5
5
  "keywords": [
6
6
  "bim",
@@ -41,7 +41,7 @@
41
41
  ],
42
42
  "scripts": {
43
43
  "build": "vite build",
44
- "typecheck": "tsc --noEmit",
44
+ "typecheck": "tsgo --noEmit",
45
45
  "test": "vitest run",
46
46
  "lint": "eslint src tests"
47
47
  },
@@ -59,5 +59,8 @@
59
59
  "vitest": "^4.0.0",
60
60
  "web-ifc": "^0.0.77",
61
61
  "zod": "^4.4.3"
62
+ },
63
+ "dependencies": {
64
+ "brepjs-families": "^0.1.0"
62
65
  }
63
66
  }