@ifc-lite/create 2.5.0 → 2.7.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 (51) hide show
  1. package/README.md +8 -0
  2. package/dist/cost-authoring-rules.d.ts +70 -0
  3. package/dist/cost-authoring-rules.d.ts.map +1 -0
  4. package/dist/cost-authoring-rules.js +118 -0
  5. package/dist/cost-authoring-rules.js.map +1 -0
  6. package/dist/ifc-creator-cost.d.ts +107 -0
  7. package/dist/ifc-creator-cost.d.ts.map +1 -0
  8. package/dist/ifc-creator-cost.js +279 -0
  9. package/dist/ifc-creator-cost.js.map +1 -0
  10. package/dist/ifc-creator-definitions.d.ts +21 -0
  11. package/dist/ifc-creator-definitions.d.ts.map +1 -0
  12. package/dist/ifc-creator-definitions.js +56 -0
  13. package/dist/ifc-creator-definitions.js.map +1 -0
  14. package/dist/ifc-creator-math.d.ts +15 -1
  15. package/dist/ifc-creator-math.d.ts.map +1 -1
  16. package/dist/ifc-creator-math.js +42 -0
  17. package/dist/ifc-creator-math.js.map +1 -1
  18. package/dist/ifc-creator.d.ts +23 -2
  19. package/dist/ifc-creator.d.ts.map +1 -1
  20. package/dist/ifc-creator.js +82 -67
  21. package/dist/ifc-creator.js.map +1 -1
  22. package/dist/in-store/cost-nesting-cycle.d.ts +8 -0
  23. package/dist/in-store/cost-nesting-cycle.d.ts.map +1 -0
  24. package/dist/in-store/cost-nesting-cycle.js +28 -0
  25. package/dist/in-store/cost-nesting-cycle.js.map +1 -0
  26. package/dist/in-store/cost-reference-validation.d.ts +13 -0
  27. package/dist/in-store/cost-reference-validation.d.ts.map +1 -0
  28. package/dist/in-store/cost-reference-validation.js +49 -0
  29. package/dist/in-store/cost-reference-validation.js.map +1 -0
  30. package/dist/in-store/cost-removal.d.ts +40 -0
  31. package/dist/in-store/cost-removal.d.ts.map +1 -0
  32. package/dist/in-store/cost-removal.js +107 -0
  33. package/dist/in-store/cost-removal.js.map +1 -0
  34. package/dist/in-store/cost.d.ts +109 -0
  35. package/dist/in-store/cost.d.ts.map +1 -0
  36. package/dist/in-store/cost.js +323 -0
  37. package/dist/in-store/cost.js.map +1 -0
  38. package/dist/in-store/resolve-source.d.ts.map +1 -1
  39. package/dist/in-store/resolve-source.js +11 -8
  40. package/dist/in-store/resolve-source.js.map +1 -1
  41. package/dist/index.d.ts +3 -0
  42. package/dist/index.d.ts.map +1 -1
  43. package/dist/index.js +2 -0
  44. package/dist/index.js.map +1 -1
  45. package/dist/types-cost.d.ts +134 -0
  46. package/dist/types-cost.d.ts.map +1 -0
  47. package/dist/types-cost.js +5 -0
  48. package/dist/types-cost.js.map +1 -0
  49. package/dist/types.d.ts +7 -0
  50. package/dist/types.d.ts.map +1 -1
  51. package/package.json +5 -4
package/README.md CHANGED
@@ -29,6 +29,14 @@ const { content } = creator.toIfc(); // IFC STEP text
29
29
  - Property sets, element quantities, materials, and colors
30
30
  - 4D scheduling entities: IfcWorkSchedule, IfcTask, IfcRelSequence
31
31
  - In-store builders (`addWallToStore`, `addSlabToStore`, ...) that emit elements into an existing parsed model
32
+ - Loaded-model cost builders (`addCostScheduleToStore`, `addCostItemToStore`, `addCostValueToStore`,
33
+ `addCostQuantityToStore`) plus relationship helpers for nesting, schedule/object assignment, value lists,
34
+ and safe removal. They require a `CostAnchor` for schema/owner-history/GUID allocation, accept existing
35
+ relationship maps from the host, reject IFC2X3 authoring, and make destructive removal explicit with
36
+ `{ detach: true }` when surviving references must be rewritten. Removal referrer data distinguishes
37
+ required relationship endpoints (whose relationship is deleted) from optional scalar and list
38
+ attributes on non-relationship owners. Optional scalars are rewritten to `$`; optional lists retain
39
+ their surviving members, or become `$` when emptied, so detaching a cost value never deletes its owner.
32
40
  - Space generation: `generateSpacesFromWalls` and `detectEnclosedAreas` derive IfcSpace footprints from wall layouts
33
41
  - Fully typed parameter objects for every element
34
42
 
@@ -0,0 +1,70 @@
1
+ /**
2
+ * Schema-free validation shared by both cost-entity emitters (#4857 PR A):
3
+ * the STEP-TEXT emitter `ifc-creator-cost.ts` (`IfcCreator`, building a file
4
+ * from scratch) and the in-store builder `in-store/cost.ts`
5
+ * (`bim.store.addCost*`, authoring into an already-loaded model). Neither
6
+ * caller's serialization concern lives here — `ifc-creator-cost.ts` writes a
7
+ * raw STEP argument string, `in-store/cost.ts` writes a `StoreEditor`
8
+ * attribute array — only WHETHER an authored value is legal, decided once, so
9
+ * the same typo or out-of-range value is rejected identically from either
10
+ * entry point rather than by two allow-lists that can drift.
11
+ */
12
+ /** The schemas cost entities can be authored in (IFC2X3 is refused up front). */
13
+ export type CostSchema = 'IFC2X3' | 'IFC4' | 'IFC4X3';
14
+ /** A typed IFC value: the SELECT branch name plus its numeric value. */
15
+ export interface CostTypedValueInput {
16
+ Type: string;
17
+ Value: number;
18
+ }
19
+ /**
20
+ * Runtime allow-lists for every closed vocabulary a cost method writes. The
21
+ * TypeScript unions at the call sites only bind typed callers; the sandbox
22
+ * hands these methods untyped script input, and an unchecked string becomes
23
+ * `IFCBOGUSMEASURE(1.)` or `.BOGUS.` — well-formed STEP naming nothing in the
24
+ * schema.
25
+ */
26
+ export declare const MEASURE_TYPES: ReadonlySet<string>;
27
+ export declare const QUANTITY_KINDS: ReadonlySet<string>;
28
+ export declare const ARITHMETIC_OPERATORS: ReadonlySet<string>;
29
+ export declare const COST_SCHEDULE_TYPES: ReadonlySet<string>;
30
+ export declare const COST_ITEM_TYPES: ReadonlySet<string>;
31
+ /** Validate a loaded model's schema at the untyped runtime boundary. */
32
+ export declare function requireCostSchema(schema: unknown): CostSchema;
33
+ /** Refuse a value outside its closed vocabulary; `undefined` (absent) passes. */
34
+ export declare function assertOneOf(value: unknown, allowed: ReadonlySet<string>, what: string, context: string): void;
35
+ /** Validate IfcArithmeticOperatorEnum, whose MODULO member exists only in IFC4X3. */
36
+ export declare function validateArithmeticOperator(value: unknown, schema: CostSchema, context: string): void;
37
+ /** EXPRESS INTEGER-valued measures: IfcInteger always, IfcCountMeasure from IFC4X3 on. */
38
+ export declare function isIntegerMeasure(type: string, schema: CostSchema): boolean;
39
+ /**
40
+ * Refuse IFC2X3 cost authoring by name, loudly.
41
+ *
42
+ * IFC2X3 lays IfcCostSchedule / IfcCostItem / IfcCostValue out differently
43
+ * (IfcCostSchedule carries an `ID` and IfcDateAndTime references where IFC4
44
+ * carries `Identification` and IfcDateTime strings; IfcCostValue has
45
+ * `CostType` where IFC4 has `Category`, and no `Components` at all). Writing
46
+ * the IFC4 layout into an IFC2X3 file would produce records that parse and are
47
+ * wrong. A no-op — or a method that returned an id having written nothing —
48
+ * would look like success at the call site, so this throws instead.
49
+ */
50
+ export declare function assertCostSchema(schema: string, method: string): void;
51
+ /**
52
+ * Validate a typed IFC value (`IfcCostValue.AppliedValue`,
53
+ * `IfcMeasureWithUnit.ValueComponent` — both `IfcValue`/SELECT-typed
54
+ * attributes). Does not serialize: the caller picks the STEP form (a named
55
+ * SELECT branch as raw text, or a `{ typed: { type, value } }` overlay
56
+ * marker) once this passes.
57
+ */
58
+ export declare function validateTypedValue(value: CostTypedValueInput | undefined, schema: CostSchema, context: string): void;
59
+ /**
60
+ * Validate an optional LIST-of-reference attribute.
61
+ *
62
+ * `undefined` is absent. An empty array is NOT absent: the EXPRESS
63
+ * declaration is `[1:?]`, so `()` would be a malformed list that the reader
64
+ * reports as INVALID_LIST. Refusing here keeps the two states distinct end to
65
+ * end, for both emitters.
66
+ */
67
+ export declare function validateRefList(ids: number[] | undefined, attribute: string, context: string): void;
68
+ /** Require a positive integer express id for a single-reference attribute. */
69
+ export declare function requireRef(id: number, attribute: string, context: string): void;
70
+ //# sourceMappingURL=cost-authoring-rules.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cost-authoring-rules.d.ts","sourceRoot":"","sources":["../src/cost-authoring-rules.ts"],"names":[],"mappings":"AAIA;;;;;;;;;;GAUG;AAEH,iFAAiF;AACjF,MAAM,MAAM,UAAU,GAAG,QAAQ,GAAG,MAAM,GAAG,QAAQ,CAAC;AAE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AAG,SAAS,EAAE,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,IAAI,CAYnG;AAED,8EAA8E;AAC9E,wBAAgB,UAAU,CAAC,EAAE,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,IAAI,CAI/E"}
@@ -0,0 +1,118 @@
1
+ /* This Source Code Form is subject to the terms of the Mozilla Public
2
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
3
+ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */
4
+ /**
5
+ * Runtime allow-lists for every closed vocabulary a cost method writes. The
6
+ * TypeScript unions at the call sites only bind typed callers; the sandbox
7
+ * hands these methods untyped script input, and an unchecked string becomes
8
+ * `IFCBOGUSMEASURE(1.)` or `.BOGUS.` — well-formed STEP naming nothing in the
9
+ * schema.
10
+ */
11
+ export const MEASURE_TYPES = new Set([
12
+ 'IfcMonetaryMeasure', 'IfcAreaMeasure', 'IfcVolumeMeasure', 'IfcLengthMeasure',
13
+ 'IfcMassMeasure', 'IfcTimeMeasure', 'IfcCountMeasure', 'IfcNumericMeasure',
14
+ 'IfcRatioMeasure', 'IfcReal', 'IfcInteger',
15
+ ]);
16
+ export const QUANTITY_KINDS = new Set([
17
+ 'IfcQuantityLength', 'IfcQuantityArea', 'IfcQuantityVolume', 'IfcQuantityWeight',
18
+ 'IfcQuantityTime', 'IfcQuantityCount', 'IfcQuantityNumber',
19
+ ]);
20
+ export const ARITHMETIC_OPERATORS = new Set(['ADD', 'DIVIDE', 'MODULO', 'MULTIPLY', 'SUBTRACT']);
21
+ export const COST_SCHEDULE_TYPES = new Set([
22
+ 'BUDGET', 'COSTPLAN', 'ESTIMATE', 'TENDER', 'PRICEDBILLOFQUANTITIES',
23
+ 'UNPRICEDBILLOFQUANTITIES', 'SCHEDULEOFRATES', 'USERDEFINED', 'NOTDEFINED',
24
+ ]);
25
+ export const COST_ITEM_TYPES = new Set(['USERDEFINED', 'NOTDEFINED']);
26
+ /** Validate a loaded model's schema at the untyped runtime boundary. */
27
+ export function requireCostSchema(schema) {
28
+ if (schema !== 'IFC2X3' && schema !== 'IFC4' && schema !== 'IFC4X3') {
29
+ throw new Error('CostAnchor.schema is required and must match the loaded model schema');
30
+ }
31
+ return schema;
32
+ }
33
+ /** Refuse a value outside its closed vocabulary; `undefined` (absent) passes. */
34
+ export function assertOneOf(value, allowed, what, context) {
35
+ if (value === undefined)
36
+ return;
37
+ if (typeof value !== 'string' || !allowed.has(value)) {
38
+ throw new Error(`${context}: ${what} '${String(value)}' is not one of ${[...allowed].join(', ')}`);
39
+ }
40
+ }
41
+ /** Validate IfcArithmeticOperatorEnum, whose MODULO member exists only in IFC4X3. */
42
+ export function validateArithmeticOperator(value, schema, context) {
43
+ assertOneOf(value, ARITHMETIC_OPERATORS, 'ArithmeticOperator', context);
44
+ if (value === 'MODULO' && schema !== 'IFC4X3') {
45
+ throw new Error(`${context}: ArithmeticOperator 'MODULO' is only valid in IFC4X3`);
46
+ }
47
+ }
48
+ /** EXPRESS INTEGER-valued measures: IfcInteger always, IfcCountMeasure from IFC4X3 on. */
49
+ export function isIntegerMeasure(type, schema) {
50
+ return type === 'IfcInteger' || (type === 'IfcCountMeasure' && schema === 'IFC4X3');
51
+ }
52
+ /**
53
+ * Refuse IFC2X3 cost authoring by name, loudly.
54
+ *
55
+ * IFC2X3 lays IfcCostSchedule / IfcCostItem / IfcCostValue out differently
56
+ * (IfcCostSchedule carries an `ID` and IfcDateAndTime references where IFC4
57
+ * carries `Identification` and IfcDateTime strings; IfcCostValue has
58
+ * `CostType` where IFC4 has `Category`, and no `Components` at all). Writing
59
+ * the IFC4 layout into an IFC2X3 file would produce records that parse and are
60
+ * wrong. A no-op — or a method that returned an id having written nothing —
61
+ * would look like success at the call site, so this throws instead.
62
+ */
63
+ export function assertCostSchema(schema, method) {
64
+ if (schema === 'IFC2X3') {
65
+ throw new Error(`${method} is not supported for IFC2X3: the IFC2X3 cost entities have a different `
66
+ + 'attribute layout. Create or load the model as IFC4 or IFC4X3.');
67
+ }
68
+ }
69
+ /**
70
+ * Validate a typed IFC value (`IfcCostValue.AppliedValue`,
71
+ * `IfcMeasureWithUnit.ValueComponent` — both `IfcValue`/SELECT-typed
72
+ * attributes). Does not serialize: the caller picks the STEP form (a named
73
+ * SELECT branch as raw text, or a `{ typed: { type, value } }` overlay
74
+ * marker) once this passes.
75
+ */
76
+ export function validateTypedValue(value, schema, context) {
77
+ if (value === undefined || value === null)
78
+ throw new Error(`${context}: a typed value is required`);
79
+ if (value.Type === undefined)
80
+ throw new Error(`${context}: Type is required on a typed value`);
81
+ assertOneOf(value.Type, MEASURE_TYPES, 'Type', context);
82
+ if (!Number.isFinite(value.Value)) {
83
+ throw new Error(`${context}: ${value.Type} value must be a finite number`);
84
+ }
85
+ // Rounding would silently change the caller's number: an INTEGER measure
86
+ // given a fraction is a caller error, not something to fix up.
87
+ if (isIntegerMeasure(value.Type, schema) && !Number.isInteger(value.Value)) {
88
+ throw new Error(`${context}: ${value.Type} value must be an integer in ${schema}, got ${value.Value}`);
89
+ }
90
+ }
91
+ /**
92
+ * Validate an optional LIST-of-reference attribute.
93
+ *
94
+ * `undefined` is absent. An empty array is NOT absent: the EXPRESS
95
+ * declaration is `[1:?]`, so `()` would be a malformed list that the reader
96
+ * reports as INVALID_LIST. Refusing here keeps the two states distinct end to
97
+ * end, for both emitters.
98
+ */
99
+ export function validateRefList(ids, attribute, context) {
100
+ if (ids === undefined)
101
+ return;
102
+ if (ids.length === 0) {
103
+ throw new Error(`${context}: ${attribute} must name at least one entity. Omit the field entirely `
104
+ + 'to write it as absent — an empty list is a malformed IFC list, not "no value".');
105
+ }
106
+ for (const id of ids) {
107
+ if (!Number.isInteger(id) || id <= 0) {
108
+ throw new Error(`${context}: ${attribute} contains '${id}', which is not an express id`);
109
+ }
110
+ }
111
+ }
112
+ /** Require a positive integer express id for a single-reference attribute. */
113
+ export function requireRef(id, attribute, context) {
114
+ if (!Number.isInteger(id) || id <= 0) {
115
+ throw new Error(`${context}: ${attribute} must be an express id, got '${id}'`);
116
+ }
117
+ }
118
+ //# sourceMappingURL=cost-authoring-rules.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cost-authoring-rules.js","sourceRoot":"","sources":["../src/cost-authoring-rules.ts"],"names":[],"mappings":"AAAA;;+DAE+D;AAuB/D;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,aAAa,GAAwB,IAAI,GAAG,CAAS;IAChE,oBAAoB,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,kBAAkB;IAC9E,gBAAgB,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,mBAAmB;IAC1E,iBAAiB,EAAE,SAAS,EAAE,YAAY;CAC3C,CAAC,CAAC;AACH,MAAM,CAAC,MAAM,cAAc,GAAwB,IAAI,GAAG,CAAS;IACjE,mBAAmB,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,mBAAmB;IAChF,iBAAiB,EAAE,kBAAkB,EAAE,mBAAmB;CAC3D,CAAC,CAAC;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAwB,IAAI,GAAG,CAAS,CAAC,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAE,UAAU,EAAE,UAAU,CAAC,CAAC,CAAC;AAC9H,MAAM,CAAC,MAAM,mBAAmB,GAAwB,IAAI,GAAG,CAAS;IACtE,QAAQ,EAAE,UAAU,EAAE,UAAU,EAAE,QAAQ,EAAE,wBAAwB;IACpE,0BAA0B,EAAE,iBAAiB,EAAE,aAAa,EAAE,YAAY;CAC3E,CAAC,CAAC;AACH,MAAM,CAAC,MAAM,eAAe,GAAwB,IAAI,GAAG,CAAS,CAAC,aAAa,EAAE,YAAY,CAAC,CAAC,CAAC;AAEnG,wEAAwE;AACxE,MAAM,UAAU,iBAAiB,CAAC,MAAe;IAC/C,IAAI,MAAM,KAAK,QAAQ,IAAI,MAAM,KAAK,MAAM,IAAI,MAAM,KAAK,QAAQ,EAAE,CAAC;QACpE,MAAM,IA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,EAAE,IAAI,CAAC,EAAE,CAAC;YACrC,MAAM,IAAI,KAAK,CAAC,GAAG,OAAO,KAAK,SAAS,cAAc,EAAE,+BAA+B,CAAC,CAAC;QAC3F,CAAC;IACH,CAAC;AACH,CAAC;AAED,8EAA8E;AAC9E,MAAM,UAAU,UAAU,CAAC,EAAU,EAAE,SAAiB,EAAE,OAAe;IACvE,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,EAAE,CAAC,IAAI,EAAE,IAAI,CAAC,EAAE,CAAC;QACrC,MAAM,IAAI,KAAK,CAAC,GAAG,OAAO,KAAK,SAAS,gCAAgC,EAAE,GAAG,CAAC,CAAC;IACjF,CAAC;AACH,CAAC"}
@@ -0,0 +1,107 @@
1
+ import { type CostSchema } from './cost-authoring-rules.js';
2
+ import type { CostItemParams, CostQuantityParams, CostScheduleParams, CostTypedValue, CostValueParams, SIUnitParams } from './types-cost.js';
3
+ export type { CostSchema };
4
+ /** Allocate an express id, emit `#id=TYPE(attrs);`, and return the id. */
5
+ export type EmitEntity = (type: string, attrs: string) => number;
6
+ /**
7
+ * Serialize a finite number as an exact STEP REAL.
8
+ *
9
+ * The shared `num()` expands exponent notation through `toFixed(10)`, which
10
+ * is fine for geometry but turns 1e-11 into 0 and leaves 1e21 in JS exponent
11
+ * form. A cost amount has no tolerance for either, and ISO 10303-21 REAL
12
+ * allows an exponent (`1.E-11`), so the shortest round-trip digits from
13
+ * `toString()` are kept and only rewritten into STEP's spelling.
14
+ */
15
+ export declare function stepReal(v: number): string;
16
+ export { assertCostSchema } from './cost-authoring-rules.js';
17
+ /**
18
+ * Serialize a typed IFC value as a named SELECT branch.
19
+ *
20
+ * The branch comes from the caller, never from the shape of the number: 12 is
21
+ * a valid IfcMonetaryMeasure, IfcAreaMeasure, IfcCountMeasure and IfcInteger,
22
+ * and picking one by inspecting the value would silently retype the file.
23
+ */
24
+ export declare function typedValue(value: CostTypedValue, schema: CostSchema, context: string): string;
25
+ /**
26
+ * Emit an IfcMonetaryUnit.
27
+ *
28
+ * The currency is written exactly as given. There is no default and no
29
+ * normalisation: an unstated currency must stay unstated, so callers that have
30
+ * none simply do not call this.
31
+ */
32
+ export declare function emitMonetaryUnit(currency: string, emit: EmitEntity): number;
33
+ /**
34
+ * Emit an IfcSIUnit. [0] Dimensions, [1] UnitType, [2] Prefix, [3] Name.
35
+ *
36
+ * All three are ENUMERATION literals and `Name` is mandatory, so an unknown or
37
+ * empty string is refused rather than written as `.WHATEVER.` or `$` (the
38
+ * sandbox passes these straight through from untyped script input).
39
+ */
40
+ export declare function emitSIUnit(params: SIUnitParams, emit: EmitEntity): number;
41
+ /**
42
+ * Emit an IfcMeasureWithUnit — the value/unit pair behind a cost rate's
43
+ * UnitBasis and behind an AppliedValue expressed as an entity rather than a
44
+ * literal. [0] ValueComponent (IfcValue SELECT), [1] UnitComponent.
45
+ */
46
+ export declare function emitMeasureWithUnit(value: CostTypedValue, unitId: number, schema: CostSchema, emit: EmitEntity): number;
47
+ /**
48
+ * Emit an IfcPhysicalSimpleQuantity.
49
+ *
50
+ * The value attribute is a DEFINED TYPE (`IfcQuantityArea.AreaValue` is an
51
+ * `IfcAreaMeasure`), not a SELECT, so it is written as a bare number — the
52
+ * opposite of `IfcCostValue.AppliedValue`. Naming a branch here would be as
53
+ * wrong as omitting one there.
54
+ *
55
+ * The rules are schema-dependent: IfcCountMeasure is NUMBER in IFC4 but
56
+ * INTEGER in IFC4X3, IfcQuantityNumber only exists from IFC4X3, and every kind
57
+ * except IfcQuantityNumber carries a `WR: <Value> >= 0` rule.
58
+ *
59
+ * [0] Name, [1] Description, [2] Unit, [3] <Kind>Value, [4] Formula.
60
+ */
61
+ export declare function emitPhysicalQuantity(params: CostQuantityParams, schema: CostSchema, emit: EmitEntity): number;
62
+ /**
63
+ * Emit an IfcCostValue.
64
+ *
65
+ * `AppliedValue` (a literal typed measure) and `AppliedValueRef` (an
66
+ * IfcMeasureWithUnit) are the two branches of one SELECT, so at most one may
67
+ * be given. Neither is synthesised from `Components`, and `Components` is
68
+ * never synthesised from either: which form the source used is part of what
69
+ * the file says.
70
+ *
71
+ * [0] Name, [1] Description, [2] AppliedValue, [3] UnitBasis,
72
+ * [4] ApplicableDate, [5] FixedUntilDate, [6] Category, [7] Condition,
73
+ * [8] ArithmeticOperator, [9] Components.
74
+ */
75
+ export declare function emitCostValue(params: CostValueParams, schema: CostSchema, emit: EmitEntity): number;
76
+ /**
77
+ * Emit an IfcCostItem.
78
+ *
79
+ * [0] GlobalId, [1] OwnerHistory, [2] Name, [3] Description, [4] ObjectType,
80
+ * [5] Identification, [6] PredefinedType, [7] CostValues, [8] CostQuantities.
81
+ */
82
+ export declare function emitCostItem(params: CostItemParams, globalId: string, ownerRef: string, emit: EmitEntity): number;
83
+ /**
84
+ * Emit an IfcRelAssignsToProduct — binds objects (here, IfcCostItems) to the
85
+ * product they price.
86
+ *
87
+ * DIRECTION IS NOT SYMMETRIC. The PRODUCT is `RelatingProduct` (index 6) and
88
+ * the cost items are `RelatedObjects` (index 4). Swapping them yields a
89
+ * relationship that is still well-formed STEP and says the opposite thing —
90
+ * which is why the cost read model type-checks both ends and flags
91
+ * `InvalidReferences` rather than trusting the shape.
92
+ *
93
+ * [0] GlobalId, [1] OwnerHistory, [2] Name, [3] Description,
94
+ * [4] RelatedObjects, [5] RelatedObjectsType, [6] RelatingProduct.
95
+ */
96
+ export declare function emitRelAssignsToProduct(relatingProductId: number, relatedObjectIds: number[], newGlobalId: () => string, ownerRef: string, emit: EmitEntity): number;
97
+ /**
98
+ * Emit an IfcCostSchedule.
99
+ *
100
+ * [0] GlobalId, [1] OwnerHistory, [2] Name, [3] Description, [4] ObjectType,
101
+ * [5] Identification, [6] PredefinedType, [7] Status, [8] SubmittedOn,
102
+ * [9] UpdateDate. SubmittedOn / UpdateDate are IfcDateTime STRINGS in IFC4 —
103
+ * the IFC2X3 IfcDateAndTime entity references live at different indices, which
104
+ * is one of the reasons `assertCostSchema` refuses that schema outright.
105
+ */
106
+ export declare function emitCostSchedule(params: CostScheduleParams, globalId: string, ownerRef: string, emit: EmitEntity): number;
107
+ //# sourceMappingURL=ifc-creator-cost.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ifc-creator-cost.d.ts","sourceRoot":"","sources":["../src/ifc-creator-cost.ts"],"names":[],"mappings":"AA0CA,OAAO,EAGL,KAAK,UAAU,EAChB,MAAM,2BAA2B,CAAC;AACnC,OAAO,KAAK,EACV,cAAc,EACd,kBAAkB,EAClB,kBAAkB,EAClB,cAAc,EACd,eAAe,EACf,YAAY,EACb,MAAM,iBAAiB,CAAC;AAEzB,YAAY,EAAE,UAAU,EAAE,CAAC;AAE3B,0EAA0E;AAC1E,MAAM,MAAM,UAAU,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,KAAK,MAAM,CAAC;AAEjE;;;;;;;;GAQG;AACH,wBAAgB,QAAQ,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,CAO1C;AAED,OAAO,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAE7D;;;;;;GAMG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,cAAc,EAAE,MAAM,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,CAM7F;AAiCD;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,UAAU,GAAG,MAAM,CAM3E;AAgBD;;;;;;GAMG;AACH,wBAAgB,UAAU,CAAC,MAAM,EAAE,YAAY,EAAE,IAAI,EAAE,UAAU,GAAG,MAAM,CAczE;AAED;;;;GAIG;AACH,wBAAgB,mBAAmB,CACjC,KAAK,EAAE,cAAc,EACrB,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,UAAU,EAClB,IAAI,EAAE,UAAU,GACf,MAAM,CAGR;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,oBAAoB,CAClC,MAAM,EAAE,kBAAkB,EAC1B,MAAM,EAAE,UAAU,EAClB,IAAI,EAAE,UAAU,GACf,MAAM,CAwBR;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,aAAa,CAAC,MAAM,EAAE,eAAe,EAAE,MAAM,EAAE,UAAU,EAAE,IAAI,EAAE,UAAU,GAAG,MAAM,CAqBnG;AAED;;;;;GAKG;AACH,wBAAgB,YAAY,CAC1B,MAAM,EAAE,cAAc,EACtB,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,MAAM,EAChB,IAAI,EAAE,UAAU,GACf,MAAM,CAQR;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,uBAAuB,CACrC,iBAAiB,EAAE,MAAM,EACzB,gBAAgB,EAAE,MAAM,EAAE,EAC1B,WAAW,EAAE,MAAM,MAAM,EACzB,QAAQ,EAAE,MAAM,EAChB,IAAI,EAAE,UAAU,GACf,MAAM,CAKR;AAED;;;;;;;;GAQG;AACH,wBAAgB,gBAAgB,CAC9B,MAAM,EAAE,kBAAkB,EAC1B,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,MAAM,EAChB,IAAI,EAAE,UAAU,GACf,MAAM,CAOR"}
@@ -0,0 +1,279 @@
1
+ /* This Source Code Form is subject to the terms of the Mozilla Public
2
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
3
+ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */
4
+ /**
5
+ * The shared STEP builder behind every 5D / cost entity `IfcCreator` authors —
6
+ * IfcCostSchedule, IfcCostItem, IfcCostValue, the units and measures they
7
+ * reference, and the IfcPhysicalSimpleQuantity a cost item is derived from.
8
+ *
9
+ * Split out of `ifc-creator.ts` so that file stays under its recorded
10
+ * module-size budget (see `scripts/module-size-allowlist.txt`), the same way
11
+ * `ifc-creator-scheduling.ts` is. The dependency on the creator is narrowed to
12
+ * the one `EmitEntity` callback: it allocates the next express id, writes the
13
+ * `#N=TYPE(attrs);` line, and returns the id — so nothing here reaches into
14
+ * the creator's private state, and every cost entity in a file goes through
15
+ * exactly one set of emitters whether the caller reached it directly or
16
+ * through another cost method.
17
+ *
18
+ * WHAT THIS FILE IS CAREFUL ABOUT
19
+ *
20
+ * 1. TYPED SELECT VALUES. `IfcCostValue.AppliedValue` (IfcAppliedValueSelect)
21
+ * and `IfcMeasureWithUnit.ValueComponent` (IfcValue) are SELECTs. STEP
22
+ * names the branch — `IFCMONETARYMEASURE(1234.56)` — and a bare `1234.56`
23
+ * in the same slot is still well-formed STEP that means something else.
24
+ * `typedValue()` is the only way a number reaches either attribute.
25
+ *
26
+ * 2. UNIT BASIS. `IfcCostValue.UnitBasis` is the quantity a rate is quoted
27
+ * per, so it divides. Writing it as anything but the caller's own
28
+ * IfcMeasureWithUnit moves the amount by orders of magnitude, not by a
29
+ * rounding step.
30
+ *
31
+ * 3. CURRENCY IS NEVER INVENTED. There is no default. A file whose author did
32
+ * not state a currency is written without an IfcMonetaryUnit, and reads
33
+ * back with no currency — which is a different (and honest) answer from a
34
+ * guessed one.
35
+ *
36
+ * 4. ABSENT IS NOT EMPTY. An optional LIST attribute the caller omitted is
37
+ * written `$`. An empty array is a caller error (EXPRESS declares these
38
+ * lists `[1:?]`) and is refused loudly rather than degraded to `$`.
39
+ */
40
+ import { esc, optStr, optEnum, refList } from './ifc-creator-math.js';
41
+ import { COST_ITEM_TYPES, COST_SCHEDULE_TYPES, QUANTITY_KINDS, assertOneOf, isIntegerMeasure, validateArithmeticOperator, validateTypedValue, } from './cost-authoring-rules.js';
42
+ /**
43
+ * Serialize a finite number as an exact STEP REAL.
44
+ *
45
+ * The shared `num()` expands exponent notation through `toFixed(10)`, which
46
+ * is fine for geometry but turns 1e-11 into 0 and leaves 1e21 in JS exponent
47
+ * form. A cost amount has no tolerance for either, and ISO 10303-21 REAL
48
+ * allows an exponent (`1.E-11`), so the shortest round-trip digits from
49
+ * `toString()` are kept and only rewritten into STEP's spelling.
50
+ */
51
+ export function stepReal(v) {
52
+ const s = v.toString();
53
+ const e = s.search(/e/i);
54
+ if (e < 0)
55
+ return s.includes('.') ? s : `${s}.`;
56
+ const mantissa = s.slice(0, e);
57
+ const exponent = s.slice(e + 1).replace(/^\+/, '');
58
+ return `${mantissa.includes('.') ? mantissa : `${mantissa}.`}E${exponent}`;
59
+ }
60
+ export { assertCostSchema } from './cost-authoring-rules.js';
61
+ /**
62
+ * Serialize a typed IFC value as a named SELECT branch.
63
+ *
64
+ * The branch comes from the caller, never from the shape of the number: 12 is
65
+ * a valid IfcMonetaryMeasure, IfcAreaMeasure, IfcCountMeasure and IfcInteger,
66
+ * and picking one by inspecting the value would silently retype the file.
67
+ */
68
+ export function typedValue(value, schema, context) {
69
+ validateTypedValue(value, schema, context);
70
+ if (isIntegerMeasure(value.Type, schema)) {
71
+ return `${value.Type.toUpperCase()}(${value.Value.toString()})`;
72
+ }
73
+ return `${value.Type.toUpperCase()}(${stepReal(value.Value)})`;
74
+ }
75
+ /**
76
+ * Serialize an optional LIST-of-reference attribute.
77
+ *
78
+ * `undefined` is absent and becomes `$`. An empty array is NOT absent: the
79
+ * EXPRESS declaration is `[1:?]`, so `()` would be a malformed list that the
80
+ * reader reports as INVALID_LIST. Refusing here keeps the two states distinct
81
+ * end to end.
82
+ */
83
+ function optRefList(ids, attribute, context) {
84
+ if (ids === undefined)
85
+ return '$';
86
+ if (ids.length === 0) {
87
+ throw new Error(`${context}: ${attribute} must name at least one entity. Omit the field entirely `
88
+ + 'to write it as absent — an empty list is a malformed IFC list, not "no value".');
89
+ }
90
+ for (const id of ids) {
91
+ if (!Number.isInteger(id) || id <= 0) {
92
+ throw new Error(`${context}: ${attribute} contains '${id}', which is not an express id`);
93
+ }
94
+ }
95
+ return refList(ids);
96
+ }
97
+ /** Require a positive integer express id for a single-reference attribute. */
98
+ function requireRef(id, attribute, context) {
99
+ if (!Number.isInteger(id) || id <= 0) {
100
+ throw new Error(`${context}: ${attribute} must be an express id, got '${id}'`);
101
+ }
102
+ return `#${id}`;
103
+ }
104
+ /**
105
+ * Emit an IfcMonetaryUnit.
106
+ *
107
+ * The currency is written exactly as given. There is no default and no
108
+ * normalisation: an unstated currency must stay unstated, so callers that have
109
+ * none simply do not call this.
110
+ */
111
+ export function emitMonetaryUnit(currency, emit) {
112
+ if (typeof currency !== 'string' || currency.trim().length === 0) {
113
+ throw new Error('addIfcMonetaryUnit: Currency must be a non-empty string (there is no default currency)');
114
+ }
115
+ // IFC4 IfcMonetaryUnit: [0] Currency (IfcLabel).
116
+ return emit('IFCMONETARYUNIT', `'${esc(currency)}'`);
117
+ }
118
+ const SI_PREFIXES = new Set([
119
+ 'ATTO', 'CENTI', 'DECA', 'DECI', 'EXA', 'FEMTO', 'GIGA', 'HECTO',
120
+ 'KILO', 'MEGA', 'MICRO', 'MILLI', 'NANO', 'PETA', 'PICO', 'TERA',
121
+ ]);
122
+ /** The one IfcSIUnitName each authorable UnitType is dimensionally consistent with. */
123
+ const SI_NAME_FOR_UNIT_TYPE = {
124
+ LENGTHUNIT: 'METRE',
125
+ AREAUNIT: 'SQUARE_METRE',
126
+ VOLUMEUNIT: 'CUBIC_METRE',
127
+ MASSUNIT: 'GRAM',
128
+ TIMEUNIT: 'SECOND',
129
+ };
130
+ /**
131
+ * Emit an IfcSIUnit. [0] Dimensions, [1] UnitType, [2] Prefix, [3] Name.
132
+ *
133
+ * All three are ENUMERATION literals and `Name` is mandatory, so an unknown or
134
+ * empty string is refused rather than written as `.WHATEVER.` or `$` (the
135
+ * sandbox passes these straight through from untyped script input).
136
+ */
137
+ export function emitSIUnit(params, emit) {
138
+ const expected = SI_NAME_FOR_UNIT_TYPE[params.UnitType];
139
+ if (expected === undefined) {
140
+ throw new Error(`addIfcSIUnit: UnitType must be one of ${Object.keys(SI_NAME_FOR_UNIT_TYPE).join(', ')}, got '${params.UnitType}'`);
141
+ }
142
+ if (params.Name !== expected) {
143
+ throw new Error(`addIfcSIUnit: a ${params.UnitType} must be named '${expected}', got '${params.Name}'`);
144
+ }
145
+ if (params.Prefix !== undefined && !SI_PREFIXES.has(params.Prefix)) {
146
+ throw new Error(`addIfcSIUnit: Prefix '${params.Prefix}' is not an IfcSIPrefix`);
147
+ }
148
+ return emit('IFCSIUNIT', `*,${optEnum(params.UnitType)},${optEnum(params.Prefix)},${optEnum(params.Name)}`);
149
+ }
150
+ /**
151
+ * Emit an IfcMeasureWithUnit — the value/unit pair behind a cost rate's
152
+ * UnitBasis and behind an AppliedValue expressed as an entity rather than a
153
+ * literal. [0] ValueComponent (IfcValue SELECT), [1] UnitComponent.
154
+ */
155
+ export function emitMeasureWithUnit(value, unitId, schema, emit) {
156
+ const unitRef = requireRef(unitId, 'UnitComponent', 'addIfcMeasureWithUnit');
157
+ return emit('IFCMEASUREWITHUNIT', `${typedValue(value, schema, 'addIfcMeasureWithUnit')},${unitRef}`);
158
+ }
159
+ /**
160
+ * Emit an IfcPhysicalSimpleQuantity.
161
+ *
162
+ * The value attribute is a DEFINED TYPE (`IfcQuantityArea.AreaValue` is an
163
+ * `IfcAreaMeasure`), not a SELECT, so it is written as a bare number — the
164
+ * opposite of `IfcCostValue.AppliedValue`. Naming a branch here would be as
165
+ * wrong as omitting one there.
166
+ *
167
+ * The rules are schema-dependent: IfcCountMeasure is NUMBER in IFC4 but
168
+ * INTEGER in IFC4X3, IfcQuantityNumber only exists from IFC4X3, and every kind
169
+ * except IfcQuantityNumber carries a `WR: <Value> >= 0` rule.
170
+ *
171
+ * [0] Name, [1] Description, [2] Unit, [3] <Kind>Value, [4] Formula.
172
+ */
173
+ export function emitPhysicalQuantity(params, schema, emit) {
174
+ assertOneOf(params.Kind, QUANTITY_KINDS, 'Kind', 'addIfcPhysicalQuantity');
175
+ const context = `addIfcPhysicalQuantity: ${params.Kind} '${params.Name}'`;
176
+ if (params.Kind === 'IfcQuantityNumber' && schema !== 'IFC4X3') {
177
+ throw new Error(`${context} does not exist in ${schema}; IfcQuantityNumber requires Schema "IFC4X3"`);
178
+ }
179
+ if (!Number.isFinite(params.Value)) {
180
+ throw new Error(`${context} value must be a finite number`);
181
+ }
182
+ if (params.Kind === 'IfcQuantityCount' && schema === 'IFC4X3' && !Number.isInteger(params.Value)) {
183
+ throw new Error(`${context} value must be a finite integer in IFC4X3 (IfcCountMeasure is INTEGER)`);
184
+ }
185
+ if (params.Kind !== 'IfcQuantityNumber' && params.Value < 0) {
186
+ throw new Error(`${context} value must be non-negative, got ${params.Value}`);
187
+ }
188
+ const unitRef = params.Unit === undefined
189
+ ? '$'
190
+ : requireRef(params.Unit, 'Unit', 'addIfcPhysicalQuantity');
191
+ // An IFC4X3 count is INTEGER, so it takes no trailing `.` (that spells a REAL).
192
+ const value = params.Kind === 'IfcQuantityCount' && schema === 'IFC4X3'
193
+ ? params.Value.toString()
194
+ : stepReal(params.Value);
195
+ return emit(params.Kind.toUpperCase(), `'${esc(params.Name)}',${optStr(params.Description)},${unitRef},${value},${optStr(params.Formula)}`);
196
+ }
197
+ /**
198
+ * Emit an IfcCostValue.
199
+ *
200
+ * `AppliedValue` (a literal typed measure) and `AppliedValueRef` (an
201
+ * IfcMeasureWithUnit) are the two branches of one SELECT, so at most one may
202
+ * be given. Neither is synthesised from `Components`, and `Components` is
203
+ * never synthesised from either: which form the source used is part of what
204
+ * the file says.
205
+ *
206
+ * [0] Name, [1] Description, [2] AppliedValue, [3] UnitBasis,
207
+ * [4] ApplicableDate, [5] FixedUntilDate, [6] Category, [7] Condition,
208
+ * [8] ArithmeticOperator, [9] Components.
209
+ */
210
+ export function emitCostValue(params, schema, emit) {
211
+ validateArithmeticOperator(params.ArithmeticOperator, schema, 'addIfcCostValue');
212
+ if (params.AppliedValue !== undefined && params.AppliedValueRef !== undefined) {
213
+ throw new Error('addIfcCostValue: AppliedValue and AppliedValueRef are the two branches of one SELECT — give at most one');
214
+ }
215
+ let applied = '$';
216
+ if (params.AppliedValue !== undefined) {
217
+ applied = typedValue(params.AppliedValue, schema, 'addIfcCostValue');
218
+ }
219
+ else if (params.AppliedValueRef !== undefined) {
220
+ applied = requireRef(params.AppliedValueRef, 'AppliedValueRef', 'addIfcCostValue');
221
+ }
222
+ const unitBasis = params.UnitBasis === undefined
223
+ ? '$'
224
+ : requireRef(params.UnitBasis, 'UnitBasis', 'addIfcCostValue');
225
+ return emit('IFCCOSTVALUE', `${optStr(params.Name)},${optStr(params.Description)},${applied},${unitBasis},`
226
+ + `${optStr(params.ApplicableDate)},${optStr(params.FixedUntilDate)},`
227
+ + `${optStr(params.Category)},${optStr(params.Condition)},`
228
+ + `${optEnum(params.ArithmeticOperator)},`
229
+ + `${optRefList(params.Components, 'Components', 'addIfcCostValue')}`);
230
+ }
231
+ /**
232
+ * Emit an IfcCostItem.
233
+ *
234
+ * [0] GlobalId, [1] OwnerHistory, [2] Name, [3] Description, [4] ObjectType,
235
+ * [5] Identification, [6] PredefinedType, [7] CostValues, [8] CostQuantities.
236
+ */
237
+ export function emitCostItem(params, globalId, ownerRef, emit) {
238
+ assertOneOf(params.PredefinedType, COST_ITEM_TYPES, 'PredefinedType', 'addIfcCostItem');
239
+ return emit('IFCCOSTITEM', `'${globalId}',${ownerRef},'${esc(params.Name)}',${optStr(params.Description)},`
240
+ + `${optStr(params.ObjectType)},${optStr(params.Identification)},`
241
+ + `${optEnum(params.PredefinedType)},`
242
+ + `${optRefList(params.CostValues, 'CostValues', 'addIfcCostItem')},`
243
+ + `${optRefList(params.CostQuantities, 'CostQuantities', 'addIfcCostItem')}`);
244
+ }
245
+ /**
246
+ * Emit an IfcRelAssignsToProduct — binds objects (here, IfcCostItems) to the
247
+ * product they price.
248
+ *
249
+ * DIRECTION IS NOT SYMMETRIC. The PRODUCT is `RelatingProduct` (index 6) and
250
+ * the cost items are `RelatedObjects` (index 4). Swapping them yields a
251
+ * relationship that is still well-formed STEP and says the opposite thing —
252
+ * which is why the cost read model type-checks both ends and flags
253
+ * `InvalidReferences` rather than trusting the shape.
254
+ *
255
+ * [0] GlobalId, [1] OwnerHistory, [2] Name, [3] Description,
256
+ * [4] RelatedObjects, [5] RelatedObjectsType, [6] RelatingProduct.
257
+ */
258
+ export function emitRelAssignsToProduct(relatingProductId, relatedObjectIds, newGlobalId, ownerRef, emit) {
259
+ const refs = optRefList(relatedObjectIds, 'relatedObjectIds', 'addIfcRelAssignsToProduct');
260
+ const productRef = requireRef(relatingProductId, 'relatingProductId', 'addIfcRelAssignsToProduct');
261
+ return emit('IFCRELASSIGNSTOPRODUCT', `'${newGlobalId()}',${ownerRef},$,$,${refs},$,${productRef}`);
262
+ }
263
+ /**
264
+ * Emit an IfcCostSchedule.
265
+ *
266
+ * [0] GlobalId, [1] OwnerHistory, [2] Name, [3] Description, [4] ObjectType,
267
+ * [5] Identification, [6] PredefinedType, [7] Status, [8] SubmittedOn,
268
+ * [9] UpdateDate. SubmittedOn / UpdateDate are IfcDateTime STRINGS in IFC4 —
269
+ * the IFC2X3 IfcDateAndTime entity references live at different indices, which
270
+ * is one of the reasons `assertCostSchema` refuses that schema outright.
271
+ */
272
+ export function emitCostSchedule(params, globalId, ownerRef, emit) {
273
+ assertOneOf(params.PredefinedType, COST_SCHEDULE_TYPES, 'PredefinedType', 'addIfcCostSchedule');
274
+ return emit('IFCCOSTSCHEDULE', `'${globalId}',${ownerRef},'${esc(params.Name)}',${optStr(params.Description)},`
275
+ + `${optStr(params.ObjectType)},${optStr(params.Identification)},`
276
+ + `${optEnum(params.PredefinedType)},${optStr(params.Status)},`
277
+ + `${optStr(params.SubmittedOn)},${optStr(params.UpdateDate)}`);
278
+ }
279
+ //# sourceMappingURL=ifc-creator-cost.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ifc-creator-cost.js","sourceRoot":"","sources":["../src/ifc-creator-cost.ts"],"names":[],"mappings":"AAAA;;+DAE+D;AAE/D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AAEH,OAAO,EAAE,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AACtE,OAAO,EACL,eAAe,EAAE,mBAAmB,EAAE,cAAc,EACpD,WAAW,EAAE,gBAAgB,EAAE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AAM,CAAC,cAAc,CAAC,GAAG;UAChE,GAAG,OAAO,CAAC,MAAM,CAAC,cAAc,CAAC,IAAI,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,GAAG;UAC7D,GAAG,MAAM,CAAC,MAAM,CAAC,WAAW,CAAC,IAAI,MAAM,CAAC,MAAM,CAAC,UAAU,CAAC,EAAE,CAAC,CAAC;AACpE,CAAC"}
@@ -0,0 +1,21 @@
1
+ import type { EmitEntity } from './ifc-creator-cost.js';
2
+ import type { PropertySetDef, QuantitySetDef } from './types.js';
3
+ /** The creator hooks these emitters need. */
4
+ export interface DefinitionContext {
5
+ emit: EmitEntity;
6
+ newGlobalId: () => string;
7
+ ownerRef: string;
8
+ /** Renders a trailing IFC4/IFC4X3-only attribute, or nothing under IFC2X3. */
9
+ ifc4Only: (value: string) => string;
10
+ }
11
+ /**
12
+ * Emit an IfcPropertySet, its IfcPropertySingleValue properties, and the
13
+ * IfcRelDefinesByProperties binding it to `elementId`. Returns the pset id.
14
+ */
15
+ export declare function emitPropertySet(elementId: number, pset: PropertySetDef, context: DefinitionContext): number;
16
+ /**
17
+ * Emit an IfcElementQuantity, its IfcPhysicalSimpleQuantity members, and the
18
+ * IfcRelDefinesByProperties binding it to `elementId`. Returns the qset id.
19
+ */
20
+ export declare function emitElementQuantity(elementId: number, qset: QuantitySetDef, context: DefinitionContext): number;
21
+ //# sourceMappingURL=ifc-creator-definitions.d.ts.map