@ifc-lite/export 4.14.0 → 5.0.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.
- package/dist/attribute-slot-types.d.ts.map +1 -1
- package/dist/attribute-slot-types.js +3 -1
- package/dist/attribute-slot-types.js.map +1 -1
- package/dist/effective-index-created-rows.d.ts +3 -0
- package/dist/effective-index-created-rows.d.ts.map +1 -1
- package/dist/effective-index-created-rows.js +16 -5
- package/dist/effective-index-created-rows.js.map +1 -1
- package/dist/effective-index.d.ts.map +1 -1
- package/dist/effective-index.js +2 -1
- package/dist/effective-index.js.map +1 -1
- package/dist/georef-closure.d.ts +12 -0
- package/dist/georef-closure.d.ts.map +1 -1
- package/dist/georef-closure.js +3 -1
- package/dist/georef-closure.js.map +1 -1
- package/dist/ifc5-exporter.d.ts.map +1 -1
- package/dist/ifc5-exporter.js +3 -10
- package/dist/ifc5-exporter.js.map +1 -1
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -0
- package/dist/index.js.map +1 -1
- package/dist/merged-bake.d.ts +32 -0
- package/dist/merged-bake.d.ts.map +1 -0
- package/dist/merged-bake.js +120 -0
- package/dist/merged-bake.js.map +1 -0
- package/dist/merged-context.d.ts +49 -6
- package/dist/merged-context.d.ts.map +1 -1
- package/dist/merged-context.js +165 -53
- package/dist/merged-context.js.map +1 -1
- package/dist/merged-exporter.d.ts +7 -14
- package/dist/merged-exporter.d.ts.map +1 -1
- package/dist/merged-exporter.js +43 -111
- package/dist/merged-exporter.js.map +1 -1
- package/dist/merged-georef-normalize.d.ts +54 -0
- package/dist/merged-georef-normalize.d.ts.map +1 -0
- package/dist/merged-georef-normalize.js +260 -0
- package/dist/merged-georef-normalize.js.map +1 -0
- package/dist/merged-project-contexts.d.ts +12 -0
- package/dist/merged-project-contexts.d.ts.map +1 -0
- package/dist/merged-project-contexts.js +56 -0
- package/dist/merged-project-contexts.js.map +1 -0
- package/dist/merged-remap.d.ts +2 -0
- package/dist/merged-remap.d.ts.map +1 -1
- package/dist/merged-remap.js +10 -0
- package/dist/merged-remap.js.map +1 -1
- package/dist/merged-subcontext.d.ts +22 -0
- package/dist/merged-subcontext.d.ts.map +1 -1
- package/dist/merged-subcontext.js +14 -18
- package/dist/merged-subcontext.js.map +1 -1
- package/dist/schema-conversion-loss-report.d.ts +20 -12
- package/dist/schema-conversion-loss-report.d.ts.map +1 -1
- package/dist/schema-conversion-loss-report.js +153 -24
- package/dist/schema-conversion-loss-report.js.map +1 -1
- package/dist/schema-converter-attr-maps.d.ts +51 -0
- package/dist/schema-converter-attr-maps.d.ts.map +1 -0
- package/dist/schema-converter-attr-maps.js +142 -0
- package/dist/schema-converter-attr-maps.js.map +1 -0
- package/dist/schema-converter-attr-remap.d.ts.map +1 -1
- package/dist/schema-converter-attr-remap.js +5 -1
- package/dist/schema-converter-attr-remap.js.map +1 -1
- package/dist/schema-converter-document-links.d.ts +23 -0
- package/dist/schema-converter-document-links.d.ts.map +1 -0
- package/dist/schema-converter-document-links.js +146 -0
- package/dist/schema-converter-document-links.js.map +1 -0
- package/dist/schema-converter-enums.d.ts +10 -1
- package/dist/schema-converter-enums.d.ts.map +1 -1
- package/dist/schema-converter-enums.js +27 -4
- package/dist/schema-converter-enums.js.map +1 -1
- package/dist/schema-converter-ifc4-slots.d.ts +4 -3
- package/dist/schema-converter-ifc4-slots.d.ts.map +1 -1
- package/dist/schema-converter-ifc4-slots.js +4 -3
- package/dist/schema-converter-ifc4-slots.js.map +1 -1
- package/dist/schema-converter-renames.d.ts +17 -0
- package/dist/schema-converter-renames.d.ts.map +1 -1
- package/dist/schema-converter-renames.js +34 -2
- package/dist/schema-converter-renames.js.map +1 -1
- package/dist/schema-converter-retyped.d.ts +17 -0
- package/dist/schema-converter-retyped.d.ts.map +1 -0
- package/dist/schema-converter-retyped.js +68 -0
- package/dist/schema-converter-retyped.js.map +1 -0
- package/dist/schema-converter-structural-axes.d.ts +48 -4
- package/dist/schema-converter-structural-axes.d.ts.map +1 -1
- package/dist/schema-converter-structural-axes.js +348 -29
- package/dist/schema-converter-structural-axes.js.map +1 -1
- package/dist/schema-converter-structural-carriers.d.ts +76 -0
- package/dist/schema-converter-structural-carriers.d.ts.map +1 -0
- package/dist/schema-converter-structural-carriers.js +330 -0
- package/dist/schema-converter-structural-carriers.js.map +1 -0
- package/dist/schema-converter-structural-diagnostics.d.ts +49 -9
- package/dist/schema-converter-structural-diagnostics.d.ts.map +1 -1
- package/dist/schema-converter-structural-diagnostics.js +152 -17
- package/dist/schema-converter-structural-diagnostics.js.map +1 -1
- package/dist/schema-converter-structural-links.d.ts +2 -2
- package/dist/schema-converter-structural-links.d.ts.map +1 -1
- package/dist/schema-converter-structural-links.js +3 -28
- package/dist/schema-converter-structural-links.js.map +1 -1
- package/dist/schema-converter-structural-source.d.ts +76 -0
- package/dist/schema-converter-structural-source.d.ts.map +1 -0
- package/dist/schema-converter-structural-source.js +197 -0
- package/dist/schema-converter-structural-source.js.map +1 -0
- package/dist/schema-converter-structural-thickness.d.ts +33 -0
- package/dist/schema-converter-structural-thickness.d.ts.map +1 -0
- package/dist/schema-converter-structural-thickness.js +155 -0
- package/dist/schema-converter-structural-thickness.js.map +1 -0
- package/dist/schema-converter-structural-varying.d.ts +17 -10
- package/dist/schema-converter-structural-varying.d.ts.map +1 -1
- package/dist/schema-converter-structural-varying.js +66 -50
- package/dist/schema-converter-structural-varying.js.map +1 -1
- package/dist/schema-converter-structural.d.ts +2 -2
- package/dist/schema-converter-structural.d.ts.map +1 -1
- package/dist/schema-converter-structural.js +9 -6
- package/dist/schema-converter-structural.js.map +1 -1
- package/dist/schema-converter-userdefined-label.d.ts +8 -0
- package/dist/schema-converter-userdefined-label.d.ts.map +1 -0
- package/dist/schema-converter-userdefined-label.js +60 -0
- package/dist/schema-converter-userdefined-label.js.map +1 -0
- package/dist/schema-converter-userdefined.d.ts +15 -0
- package/dist/schema-converter-userdefined.d.ts.map +1 -0
- package/dist/schema-converter-userdefined.js +59 -0
- package/dist/schema-converter-userdefined.js.map +1 -0
- package/dist/schema-converter-value-forms.d.ts +12 -0
- package/dist/schema-converter-value-forms.d.ts.map +1 -0
- package/dist/schema-converter-value-forms.js +188 -0
- package/dist/schema-converter-value-forms.js.map +1 -0
- package/dist/schema-converter.d.ts +2 -4
- package/dist/schema-converter.d.ts.map +1 -1
- package/dist/schema-converter.js +44 -42
- package/dist/schema-converter.js.map +1 -1
- package/dist/schema-enum-policy.d.ts +5 -1
- package/dist/schema-enum-policy.d.ts.map +1 -1
- package/dist/schema-enum-policy.js +21 -1
- package/dist/schema-enum-policy.js.map +1 -1
- package/dist/schema-value-form-policy.d.ts +129 -0
- package/dist/schema-value-form-policy.d.ts.map +1 -0
- package/dist/schema-value-form-policy.js +222 -0
- package/dist/schema-value-form-policy.js.map +1 -0
- package/dist/step-collection.d.ts.map +1 -1
- package/dist/step-collection.js +2 -0
- package/dist/step-collection.js.map +1 -1
- package/dist/step-comment-skip.d.ts +8 -0
- package/dist/step-comment-skip.d.ts.map +1 -1
- package/dist/step-comment-skip.js +28 -0
- package/dist/step-comment-skip.js.map +1 -1
- package/dist/step-coordinate-options.d.ts +15 -0
- package/dist/step-coordinate-options.d.ts.map +1 -1
- package/dist/step-coordinate-options.js +13 -1
- package/dist/step-coordinate-options.js.map +1 -1
- package/dist/step-export-types.d.ts +2 -1
- package/dist/step-export-types.d.ts.map +1 -1
- package/dist/step-export-types.js.map +1 -1
- package/dist/step-exporter.d.ts +0 -6
- package/dist/step-exporter.d.ts.map +1 -1
- package/dist/step-exporter.js +9 -6
- package/dist/step-exporter.js.map +1 -1
- package/dist/step-georeferencing.d.ts +2 -0
- package/dist/step-georeferencing.d.ts.map +1 -1
- package/dist/step-georeferencing.js +122 -46
- package/dist/step-georeferencing.js.map +1 -1
- package/dist/step-header.d.ts.map +1 -1
- package/dist/step-header.js +1 -0
- package/dist/step-header.js.map +1 -1
- package/dist/step-internal-pset-ids.js +1 -1
- package/dist/step-internal-pset-ids.js.map +1 -1
- package/dist/step-map-unit.d.ts +8 -1
- package/dist/step-map-unit.d.ts.map +1 -1
- package/dist/step-map-unit.js +13 -5
- package/dist/step-map-unit.js.map +1 -1
- package/dist/step-omission-predicates.d.ts.map +1 -1
- package/dist/step-omission-predicates.js +1 -0
- package/dist/step-omission-predicates.js.map +1 -1
- package/dist/step-overlay-entities.d.ts +0 -35
- package/dist/step-overlay-entities.d.ts.map +1 -1
- package/dist/step-overlay-entities.js +38 -2
- package/dist/step-overlay-entities.js.map +1 -1
- package/dist/step-pass-builder.d.ts.map +1 -1
- package/dist/step-pass-builder.js +12 -6
- package/dist/step-pass-builder.js.map +1 -1
- package/dist/step-record-frame.d.ts +5 -3
- package/dist/step-record-frame.d.ts.map +1 -1
- package/dist/step-record-frame.js +12 -8
- package/dist/step-record-frame.js.map +1 -1
- package/dist/step-ref-scan.d.ts +7 -0
- package/dist/step-ref-scan.d.ts.map +1 -1
- package/dist/step-ref-scan.js +24 -3
- package/dist/step-ref-scan.js.map +1 -1
- package/dist/step-serialization.d.ts +12 -0
- package/dist/step-serialization.d.ts.map +1 -1
- package/dist/step-serialization.js +15 -0
- package/dist/step-serialization.js.map +1 -1
- package/dist/step-source-iteration.d.ts.map +1 -1
- package/dist/step-source-iteration.js +4 -3
- package/dist/step-source-iteration.js.map +1 -1
- package/dist/unit-normalize.d.ts.map +1 -1
- package/dist/unit-normalize.js +4 -3
- package/dist/unit-normalize.js.map +1 -1
- package/dist/viewer-georef-scale.d.ts +14 -0
- package/dist/viewer-georef-scale.d.ts.map +1 -0
- package/dist/viewer-georef-scale.js +20 -0
- package/dist/viewer-georef-scale.js.map +1 -0
- package/package.json +41 -8
|
@@ -4,25 +4,82 @@ import { getSchemaRegistryForVersion, getCanonicalEntityName } from '@ifc-lite/p
|
|
|
4
4
|
import { convertEntityType } from './schema-converter.js';
|
|
5
5
|
import { destabilizingUnknown, isStructuralAssignmentConversion } from './schema-converter-structural.js';
|
|
6
6
|
import { StructuralAxes } from './schema-converter-structural-axes.js';
|
|
7
|
+
import { CAUSED_BY, StructuralCarriers } from './schema-converter-structural-carriers.js';
|
|
8
|
+
import { conversionMode, namesWithheld, SourceRecords } from './schema-converter-structural-source.js';
|
|
9
|
+
import { holdsValue, withoutComments } from './step-comment-skip.js';
|
|
10
|
+
import { StructuralThickness, THICKNESS_WRITTEN } from './schema-converter-structural-thickness.js';
|
|
7
11
|
import { StructuralLinks } from './schema-converter-structural-links.js';
|
|
8
|
-
import { StructuralVarying } from './schema-converter-structural-varying.js';
|
|
12
|
+
import { SHARED_CONFIGURATION, StructuralVarying, varyingTarget } from './schema-converter-structural-varying.js';
|
|
13
|
+
import { computeWithheldRefIds } from './schema-untranslatable.js';
|
|
9
14
|
import { readStepSlots } from './step-argument-parser.js';
|
|
10
15
|
import { referencesAnyExpressId } from './step-ref-scan.js';
|
|
16
|
+
const NONE = new Set();
|
|
17
|
+
const CAUSED_BY_UNCONVERTED = "IFC2X3 CausedBy of a varying action that stays unconverted is kept only in that IFC2X3 record; no 'Causes' relationship is written";
|
|
11
18
|
const LINK = 'IfcRelAssignsToProduct linking one structural member to its element is written as IfcRelConnectsStructuralElement, the IFC2X3 physical-to-analytical link';
|
|
19
|
+
/**
|
|
20
|
+
* IFC2X3 -> IFC4: the type the export writes varying action `entity` as when
|
|
21
|
+
* it reports its CausedBy as not coming back: an unconverted action naming a
|
|
22
|
+
* point reaction keeps it only in its IFC2X3 record, and a converted one loses
|
|
23
|
+
* it unless one 'Causes' relationship restores it (`cause`, from `noteCause`).
|
|
24
|
+
* Null when it reports nothing.
|
|
25
|
+
*/
|
|
26
|
+
function strandedAs(entity, args, unconverted, reaction, cause) {
|
|
27
|
+
const target = varyingTarget(entity);
|
|
28
|
+
// The export's own warning test (#10779): `$`, `*` or empty, comments aside, is no value.
|
|
29
|
+
if (!target || !holdsValue(args[CAUSED_BY] ?? ''))
|
|
30
|
+
return null;
|
|
31
|
+
// An unconverted action naming no point reaction keeps CausedBy unreported.
|
|
32
|
+
if (unconverted)
|
|
33
|
+
return reaction ? entity : null;
|
|
34
|
+
return cause?.restored ? null : target;
|
|
35
|
+
}
|
|
12
36
|
export class StructuralDiagnostics {
|
|
37
|
+
roundTrip;
|
|
13
38
|
axes = new StructuralAxes();
|
|
14
39
|
links = new StructuralLinks();
|
|
15
40
|
varying = new StructuralVarying();
|
|
41
|
+
carriers = new StructuralCarriers();
|
|
42
|
+
thickness = new StructuralThickness();
|
|
16
43
|
losses = new Map();
|
|
17
|
-
/**
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
44
|
+
/** Source record id -> attributes the target holds elsewhere (`note*`), which `inspect` does not report lost. */
|
|
45
|
+
carried = new Map();
|
|
46
|
+
/** Source record id -> attributes the target leaves out or holds elsewhere that the reverse conversion writes back. */
|
|
47
|
+
restored = new Map();
|
|
48
|
+
/** Source record id -> the type an IFC2X3 varying action is written as when the export reports its CausedBy (`strandedAs`). */
|
|
49
|
+
stranded = new Map();
|
|
50
|
+
/** `roundTrip`: also find what the reverse conversion restores (`structuralRoundTrip`); an export does not. */
|
|
51
|
+
constructor(roundTrip = false) {
|
|
52
|
+
this.roundTrip = roundTrip;
|
|
53
|
+
this.carriers.roundTrip = roundTrip;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* The source prepasses for an IFC2X3 <-> IFC4 export; the caller arms them
|
|
57
|
+
* only for an unedited full export.
|
|
58
|
+
*/
|
|
59
|
+
fromStore(store, from, to, source = new SourceRecords(store)) {
|
|
60
|
+
if (from !== 'IFC2X3')
|
|
22
61
|
this.links.fromStore(store);
|
|
23
|
-
this.varying.
|
|
62
|
+
this.varying.fromSource(source, from, to);
|
|
63
|
+
this.axes.fromStore(source, from, to);
|
|
64
|
+
this.carriers.fromStore(source, from, to);
|
|
65
|
+
this.thickness.fromStore(source, from, to);
|
|
24
66
|
}
|
|
25
|
-
|
|
67
|
+
/** The exporter's express-id allocator, for the records the prepasses add. */
|
|
68
|
+
set ids(next) { this.varying.ids = next; this.carriers.ids = next; this.thickness.ids = next; this.axes.ids = next; }
|
|
69
|
+
/** Records the prepasses added, to append after the source records. */
|
|
70
|
+
added() { return [...this.varying.added(), ...this.carriers.added(), ...this.thickness.added(), ...this.axes.added()]; }
|
|
71
|
+
/** An already converted IFC2X3 <-> IFC4 line with the values carriers fill in place (`StructuralCarriers.after`). */
|
|
72
|
+
after(line, withheld) {
|
|
73
|
+
if (!this.carriers.rewritesAfter)
|
|
74
|
+
return line;
|
|
75
|
+
const filled = this.carriers.after(Number(/^\s*#(\d+)/.exec(line)?.[1]), line, withheld);
|
|
76
|
+
if (!filled)
|
|
77
|
+
return line;
|
|
78
|
+
if (filled.loss)
|
|
79
|
+
this.record(filled.loss);
|
|
80
|
+
return filled.line;
|
|
81
|
+
}
|
|
82
|
+
inspect(id, line, from, to) {
|
|
26
83
|
const assignment = /^\s*#\d+\s*=\s*IFCRELCONNECTSSTRUCTURALELEMENT\s*\(/i.test(line) ? readStepSlots(line) : null;
|
|
27
84
|
if (assignment && isStructuralAssignmentConversion(assignment.type, from, to)) {
|
|
28
85
|
this.record('IfcRelConnectsStructuralElement is mapped to IfcRelAssignsToProduct; the relationship kind is not kept in the target file');
|
|
@@ -35,6 +92,10 @@ export class StructuralDiagnostics {
|
|
|
35
92
|
const rec = readStepSlots(line);
|
|
36
93
|
if (!rec || !(rec.type.startsWith('IFCSTRUCTURAL') || rec.type.startsWith('IFCRELCONNECTSSTRUCTURAL') || rec.type === 'IFCRELASSOCIATESPROFILEPROPERTIES'))
|
|
37
94
|
return;
|
|
95
|
+
// Recorded here, where the record takes the generic path, never for one withheld or rewritten.
|
|
96
|
+
const notice = this.thickness.notice(id, rec.type, rec.slots);
|
|
97
|
+
if (notice)
|
|
98
|
+
this.record(notice);
|
|
38
99
|
const source = getSchemaRegistryForVersion(from), target = getSchemaRegistryForVersion(to);
|
|
39
100
|
const name = getCanonicalEntityName(source, rec.type);
|
|
40
101
|
if (!name)
|
|
@@ -48,14 +109,19 @@ export class StructuralDiagnostics {
|
|
|
48
109
|
return;
|
|
49
110
|
}
|
|
50
111
|
const tgt = (meta.allAttributes ?? meta.attributes).map(a => a.name);
|
|
112
|
+
const carried = this.carried.get(id);
|
|
113
|
+
this.carried.delete(id);
|
|
51
114
|
src.forEach((attr, i) => {
|
|
52
115
|
// CONST is intrinsic to IFC2X3 linear/planar actions, not lost data.
|
|
53
|
-
if (attr.name === 'PredefinedType' && rec.slots[i]
|
|
116
|
+
if (attr.name === 'PredefinedType' && withoutComments(rec.slots[i] ?? '') === '.CONST.'
|
|
54
117
|
&& ['IFCSTRUCTURALCURVEACTION', 'IFCSTRUCTURALSURFACEACTION', 'IFCSTRUCTURALLINEARACTION', 'IFCSTRUCTURALPLANARACTION'].includes(rec.type))
|
|
55
118
|
return;
|
|
56
|
-
if (attr.name === 'DestabilizingLoad' && rec.slots[i]
|
|
119
|
+
if (attr.name === 'DestabilizingLoad' && withoutComments(rec.slots[i] ?? '') === '$' && to === 'IFC2X3')
|
|
57
120
|
this.record(destabilizingUnknown(rec.type));
|
|
58
|
-
if (
|
|
121
|
+
if (carried?.has(attr.name))
|
|
122
|
+
return;
|
|
123
|
+
// The dropped count's own test (#10779): a comment-only slot is no value.
|
|
124
|
+
if (!tgt.includes(attr.name) && holdsValue(rec.slots[i] ?? '')) {
|
|
59
125
|
const effect = attr.name === 'ConditionCoordinateSystem' ? '; restraint directions in that coordinate system are not preserved' : '';
|
|
60
126
|
this.record(`${rec.type}.${attr.name} has no slot in ${to}; its value is omitted${effect}`);
|
|
61
127
|
}
|
|
@@ -66,19 +132,88 @@ export class StructuralDiagnostics {
|
|
|
66
132
|
}
|
|
67
133
|
/**
|
|
68
134
|
* A record written as another entity from source-derived facts (`StructuralLinks`,
|
|
69
|
-
* `StructuralVarying`, each armed only for its schema pair):
|
|
70
|
-
*
|
|
71
|
-
* refused, and then nothing is reported.
|
|
135
|
+
* `StructuralVarying`, `StructuralCarriers`, `StructuralThickness`, each armed only for its schema pair):
|
|
136
|
+
* the target record body, or `null` for a carrier record the target leaves out.
|
|
137
|
+
* A body still naming a `withheld` id is refused, and then nothing is reported.
|
|
72
138
|
*/
|
|
73
|
-
rewrite(entity, args, withheld) {
|
|
139
|
+
rewrite(id, entity, args, withheld) {
|
|
140
|
+
// A record naming a withheld id becomes a proxy, which the reverse conversion derives nothing for.
|
|
141
|
+
if (this.roundTrip && !namesWithheld(args, withheld))
|
|
142
|
+
this.restore(id, this.carriers.restoredFrom(id));
|
|
143
|
+
// An IFC2X3 varying action that stays unconverted is no IFC4 product a 'Causes' relationship could name.
|
|
144
|
+
const unconverted = this.varying.staysUnconverted(entity, args);
|
|
145
|
+
const reaction = this.carriers.causeOf(entity, args, withheld) !== null;
|
|
146
|
+
if (unconverted && reaction)
|
|
147
|
+
this.record(CAUSED_BY_UNCONVERTED);
|
|
148
|
+
const cause = unconverted ? null : this.carriers.noteCause(id, entity, args, withheld);
|
|
149
|
+
const stranded = this.roundTrip ? strandedAs(entity, args, unconverted, reaction, cause) : null;
|
|
150
|
+
if (stranded)
|
|
151
|
+
this.stranded.set(id, stranded);
|
|
152
|
+
const thickness = cause ? [] : this.thickness.note(id, entity, args, withheld);
|
|
153
|
+
const axis = cause || thickness.length ? null : this.axes.hold(id, args, withheld);
|
|
154
|
+
const held = cause ? ['CausedBy'] : axis ? ['Axis'] : thickness;
|
|
155
|
+
let carried = NONE;
|
|
156
|
+
if (held.length) {
|
|
157
|
+
carried = new Set(held);
|
|
158
|
+
this.record(cause?.message ?? axis ?? THICKNESS_WRITTEN);
|
|
159
|
+
this.carried.set(id, carried);
|
|
160
|
+
// The downgrade reads a held thickness back (`StructuralThickness.rewrite`); a cause only when it says so.
|
|
161
|
+
if (this.roundTrip && cause?.restored !== false && (!axis || this.axes.fillWritten(id)))
|
|
162
|
+
this.restore(id, held);
|
|
163
|
+
}
|
|
74
164
|
const attrs = this.links.link(entity, args);
|
|
75
|
-
const rewrite = attrs ? { body: `IFCRELCONNECTSSTRUCTURALELEMENT(${attrs})`, losses: [LINK] }
|
|
76
|
-
|
|
165
|
+
const rewrite = attrs ? { body: `IFCRELCONNECTSSTRUCTURALELEMENT(${attrs})`, losses: [LINK] }
|
|
166
|
+
: this.varying.rewrite(id, entity, args, carried) ?? this.carriers.rewrite(id, entity, args, withheld)
|
|
167
|
+
?? this.thickness.rewrite(id, entity, args) ?? this.axes.rewrite(id, args, withheld);
|
|
168
|
+
if (!rewrite || (withheld && rewrite.body !== null && referencesAnyExpressId(rewrite.body, withheld)))
|
|
77
169
|
return undefined;
|
|
78
170
|
rewrite.losses.forEach((loss) => this.record(loss));
|
|
171
|
+
rewrite.restored?.forEach(([source, attributes]) => this.restore(source, attributes));
|
|
172
|
+
// A rewritten record skips `inspect`, which would free this.
|
|
173
|
+
this.carried.delete(id);
|
|
79
174
|
return rewrite.body;
|
|
80
175
|
}
|
|
176
|
+
restore(id, attributes) {
|
|
177
|
+
if (!this.roundTrip || !attributes.length)
|
|
178
|
+
return;
|
|
179
|
+
const set = this.restored.get(id) ?? new Set();
|
|
180
|
+
attributes.forEach((a) => set.add(a));
|
|
181
|
+
this.restored.set(id, set);
|
|
182
|
+
}
|
|
183
|
+
/** What `rewrite` found: per source record id, the attributes a carrier writes back on the reverse conversion, and the target type of a varying action whose CausedBy the export reports. */
|
|
184
|
+
roundTripResult() { return { restored: this.restored, stranded: this.stranded }; }
|
|
81
185
|
record(message) { this.losses.set(message, (this.losses.get(message) ?? 0) + 1); }
|
|
82
186
|
warnings() { return [...this.losses].sort(([a], [b]) => a.localeCompare(b)).map(([message, count]) => `${count} structural conversion record(s): ${message} (#9668).`); }
|
|
83
187
|
}
|
|
188
|
+
/** The round trip of a file the carriers do not run for. */
|
|
189
|
+
export const NO_ROUND_TRIP = { restored: new Map(), stranded: new Map() };
|
|
190
|
+
export function structuralRoundTrip(store, from, to, ids) {
|
|
191
|
+
if (!conversionMode(from, to) || !ids.length)
|
|
192
|
+
return NO_ROUND_TRIP;
|
|
193
|
+
try {
|
|
194
|
+
const source = new SourceRecords(store);
|
|
195
|
+
const records = ids.filter((id) => source.type(id)?.startsWith('IFCSTRUCTURAL'));
|
|
196
|
+
if (!records.length)
|
|
197
|
+
return NO_ROUND_TRIP;
|
|
198
|
+
const run = new StructuralDiagnostics(true);
|
|
199
|
+
run.fromStore(store, from, to, source);
|
|
200
|
+
// Nothing is written, so every added record may take the same id.
|
|
201
|
+
run.ids = () => 0;
|
|
202
|
+
// Only an IFC2X3 target withholds ids.
|
|
203
|
+
const withheld = to === 'IFC2X3' ? computeWithheldRefIds(store, to) : undefined;
|
|
204
|
+
for (const id of records) {
|
|
205
|
+
const slots = source.slots(id);
|
|
206
|
+
if (slots)
|
|
207
|
+
run.rewrite(id, source.type(id), slots, withheld);
|
|
208
|
+
}
|
|
209
|
+
return run.roundTripResult();
|
|
210
|
+
}
|
|
211
|
+
catch (error) {
|
|
212
|
+
// The schema-only preview remains available even when the carrier prepass fails.
|
|
213
|
+
if (!(error instanceof Error && error.message === SHARED_CONFIGURATION)) {
|
|
214
|
+
console.warn('[analyzeConversionLoss] Could not evaluate structural carriers', error);
|
|
215
|
+
}
|
|
216
|
+
return NO_ROUND_TRIP;
|
|
217
|
+
}
|
|
218
|
+
}
|
|
84
219
|
//# sourceMappingURL=schema-converter-structural-diagnostics.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema-converter-structural-diagnostics.js","sourceRoot":"","sources":["../src/schema-converter-structural-diagnostics.ts"],"names":[],"mappings":"AAAA,sCAAsC;AACtC,wEAAwE;AACxE,OAAO,EAAE,2BAA2B,EAAE,sBAAsB,EAAqB,MAAM,kBAAkB,CAAC;AAC1G,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAC1D,OAAO,EAAE,oBAAoB,EAAE,gCAAgC,EAAE,MAAM,kCAAkC,CAAC;AAC1G,OAAO,EAAE,cAAc,EAAE,MAAM,uCAAuC,CAAC;AACvE,OAAO,EAAE,eAA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C,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,OAAO,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC,GAAG,KAAK,qCAAqC,OAAO,WAAW,CAAC,CAAC,CAAC,CAAC;CACpL"}
|
|
1
|
+
{"version":3,"file":"schema-converter-structural-diagnostics.js","sourceRoot":"","sources":["../src/schema-converter-structural-diagnostics.ts"],"names":[],"mappings":"AAAA,sCAAsC;AACtC,wEAAwE;AACxE,OAAO,EAAE,2BAA2B,EAAE,sBAAsB,EAAE,MAAM,kBAAkB,CAAC;AACvF,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAC1D,OAAO,EAAE,oBAAoB,EAAE,gCAAgC,EAAE,MAAM,kCAAkC,CAAC;AAC1G,OAAO,EAAE,cAAc,EAAE,MAAM,uCAAuC,CAAC;AACvE,OAAO,EAAE,SAAS,EAAE,kBAAkB,EAAE,MAAM,2CAA2C,CAAC;AAC1F,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,aAAa,EAAoB,MAAM,yCAAyC,CAAC;AACzH,OAAO,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACrE,OAAO,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,MAAM,4CAA4C,CAAC;AACpG,OAAO,EAAE,eAAe,EAAE,MAAM,wCAAwC,CAAC;AACzE,OAAO,EAAE,oBAAoB,EAAE,iBAAiB,EAAE,aAAa,EAAE,MAAM,0CAA0C,CAAC;AAClH,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AACnE,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAC1D,OAAO,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAE5D,MAAM,IAAI,GAAwB,IAAI,GAAG,EAAE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
2
|
+
import { type SourceStore } from './schema-converter-structural-source.js';
|
|
3
3
|
/**
|
|
4
4
|
* IFC4 -> IFC2X3: the physical-to-analytical link back to its IFC2X3 entity.
|
|
5
5
|
* IFC2X3 links an element to its analytical member with
|
|
@@ -14,7 +14,7 @@ import { type IfcDataStore } from '@ifc-lite/parser';
|
|
|
14
14
|
*/
|
|
15
15
|
export declare class StructuralLinks {
|
|
16
16
|
private typeOf;
|
|
17
|
-
fromStore(store:
|
|
17
|
+
fromStore(store: SourceStore): void;
|
|
18
18
|
/** The IfcRelConnectsStructuralElement attributes for an IFC4 `IFCRELASSIGNSTOPRODUCT` record of that shape. */
|
|
19
19
|
link(entity: string, args: readonly string[]): string | undefined;
|
|
20
20
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema-converter-structural-links.d.ts","sourceRoot":"","sources":["../src/schema-converter-structural-links.ts"],"names":[],"mappings":"AACA,kEAAkE;AAClE,OAAO,
|
|
1
|
+
{"version":3,"file":"schema-converter-structural-links.d.ts","sourceRoot":"","sources":["../src/schema-converter-structural-links.ts"],"names":[],"mappings":"AACA,kEAAkE;AAClE,OAAO,EAAiC,KAAK,WAAW,EAAE,MAAM,yCAAyC,CAAC;AAQ1G;;;;;;;;;;;GAWG;AACH,qBAAa,eAAe;IAC1B,OAAO,CAAC,MAAM,CAAqD;IAEnE,SAAS,CAAC,KAAK,EAAE,WAAW,GAAG,IAAI;IAMnC,gHAAgH;IAChH,IAAI,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,SAAS,MAAM,EAAE,GAAG,MAAM,GAAG,SAAS;CAOlE"}
|
|
@@ -1,35 +1,10 @@
|
|
|
1
1
|
/* SPDX-License-Identifier: MPL-2.0 */
|
|
2
2
|
/** Matches rust/export/src/schema_structural_links.rs (#9668). */
|
|
3
|
-
import {
|
|
3
|
+
import { isSubtype, slotRef, slotUnset } from './schema-converter-structural-source.js';
|
|
4
4
|
import { convertEntityType } from './schema-converter.js';
|
|
5
5
|
import { listItems } from './schema-converter-structural-axes.js';
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
function slotRef(token) {
|
|
9
|
-
const start = skipStepTrivia(token ?? '', 0);
|
|
10
|
-
const m = start < 0 ? null : /^#\s*(\d+)/.exec(token.slice(start));
|
|
11
|
-
return m && skipStepTrivia(token, start + m[0].length) === token.length ? Number(m[1]) : null;
|
|
12
|
-
}
|
|
13
|
-
/** Whether the slot is the unset marker `$`, with STEP whitespace and comments around it allowed (#10248). */
|
|
14
|
-
function slotUnset(token) {
|
|
15
|
-
const start = skipStepTrivia(token, 0);
|
|
16
|
-
return start >= 0 && token[start] === '$' && skipStepTrivia(token, start + 1) === token.length;
|
|
17
|
-
}
|
|
18
|
-
const BECOMES = new Map();
|
|
19
|
-
/** Whether IFC4 `keyword` converts to an IFC2X3 subtype of `parent`, memoized per pair. */
|
|
20
|
-
function becomes(keyword, parent) {
|
|
21
|
-
if (!keyword)
|
|
22
|
-
return false;
|
|
23
|
-
const key = `${keyword} ${parent}`;
|
|
24
|
-
let known = BECOMES.get(key);
|
|
25
|
-
if (known === undefined) {
|
|
26
|
-
const registry = getSchemaRegistryForVersion('IFC2X3');
|
|
27
|
-
const name = getCanonicalEntityName(registry, convertEntityType(keyword, 'IFC4', 'IFC2X3'));
|
|
28
|
-
known = !!name && registry.entities[name]?.inheritanceChain?.includes(parent) === true;
|
|
29
|
-
BECOMES.set(key, known);
|
|
30
|
-
}
|
|
31
|
-
return known;
|
|
32
|
-
}
|
|
6
|
+
/** Whether IFC4 `keyword` converts to an IFC2X3 subtype of `parent`. */
|
|
7
|
+
const becomes = (keyword, parent) => !!keyword && isSubtype('IFC2X3', convertEntityType(keyword, 'IFC4', 'IFC2X3'), parent);
|
|
33
8
|
/**
|
|
34
9
|
* IFC4 -> IFC2X3: the physical-to-analytical link back to its IFC2X3 entity.
|
|
35
10
|
* IFC2X3 links an element to its analytical member with
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema-converter-structural-links.js","sourceRoot":"","sources":["../src/schema-converter-structural-links.ts"],"names":[],"mappings":"AAAA,sCAAsC;AACtC,kEAAkE;AAClE,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"schema-converter-structural-links.js","sourceRoot":"","sources":["../src/schema-converter-structural-links.ts"],"names":[],"mappings":"AAAA,sCAAsC;AACtC,kEAAkE;AAClE,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,SAAS,EAAoB,MAAM,yCAAyC,CAAC;AAC1G,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAC1D,OAAO,EAAE,SAAS,EAAE,MAAM,uCAAuC,CAAC;AAElE,wEAAwE;AACxE,MAAM,OAAO,GAAG,CAAC,OAA2B,EAAE,MAAc,EAAW,EAAE,CACvE,CAAC,CAAC,OAAO,IAAI,SAAS,CAAC,QAAQ,EAAE,iBAAiB,CAAC,OAAO,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,CAAC,CAAC;AAEzF;;;;;;;;;;;GAWG;AACH,MAAM,OAAO,eAAe;IAClB,MAAM,GAAgD,IAAI,CAAC;IAEnE,SAAS,CAAC,KAAkB;QAC1B,mGAAmG;QACnG,MAAM,IAAI,GAAG,KAAK,CAAC,WAAW,CAAC,IAAI,CAAC;QACpC,IAAI,CAAC,MAAM,GAAG,CAAC,EAAE,EAAE,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,IAAI,CAAC,WAAW,EAAE,CAAC;IACzD,CAAC;IAED,gHAAgH;IAChH,IAAI,CAAC,MAAc,EAAE,IAAuB;QAC1C,IAAI,CAAC,IAAI,CAAC,MAAM,IAAI,MAAM,KAAK,wBAAwB,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;YAAE,OAAO,SAAS,CAAC;QACtH,MAAM,OAAO,GAAG,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;QACnC,MAAM,MAAM,GAAG,OAAO,EAAE,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;QAC9F,IAAI,MAAM,KAAK,IAAI,IAAI,OAAO,KAAK,IAAI,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,qBAAqB,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,EAAE,YAAY,CAAC;YAAE,OAAO,SAAS,CAAC;QAClK,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,OAAO,KAAK,MAAM,EAAE,CAAC;IAChE,CAAC;CACF"}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { type IfcDataStore } from '@ifc-lite/parser';
|
|
2
|
+
export type ConversionMode = 'upgrade' | 'downgrade' | null;
|
|
3
|
+
/** What the prepasses read: the source index and bytes. */
|
|
4
|
+
export type SourceStore = Pick<IfcDataStore, 'entityIndex' | 'deferredEntityIndex' | 'source'>;
|
|
5
|
+
/** IFC2X3 -> IFC4 is an upgrade, IFC4 -> IFC2X3 a downgrade; the prepasses run for nothing else. */
|
|
6
|
+
export declare const conversionMode: (from: string, to: string) => ConversionMode;
|
|
7
|
+
/** Whether any of `args` names an id this export withholds. */
|
|
8
|
+
export declare const namesWithheld: (args: readonly string[] | undefined, withheld: ReadonlySet<number> | undefined) => boolean;
|
|
9
|
+
/**
|
|
10
|
+
* A target record body, `null` for a source record the target leaves out, and
|
|
11
|
+
* what the change loses or moves. `restored` names, per source record id, the
|
|
12
|
+
* attributes the target holds elsewhere and the reverse conversion writes back;
|
|
13
|
+
* the loss report leaves them out (`structuralRoundTrip`).
|
|
14
|
+
*/
|
|
15
|
+
export interface StructuralRewrite {
|
|
16
|
+
readonly body: string | null;
|
|
17
|
+
readonly losses: readonly string[];
|
|
18
|
+
readonly restored?: readonly (readonly [number, readonly string[]])[];
|
|
19
|
+
}
|
|
20
|
+
/** Whether `keyword` names a subtype of `parent` in `schema`, memoized per triple. */
|
|
21
|
+
export declare function isSubtype(schema: 'IFC2X3' | 'IFC4', keyword: string | undefined, parent: string): boolean;
|
|
22
|
+
/** Source records read by id, each decoded once. Lives only for one prepass. */
|
|
23
|
+
export declare class SourceRecords {
|
|
24
|
+
private readonly store;
|
|
25
|
+
private readonly keptIdsByType;
|
|
26
|
+
private readonly cache;
|
|
27
|
+
constructor(store: SourceStore);
|
|
28
|
+
hasIndexedRecords(): boolean;
|
|
29
|
+
private decode;
|
|
30
|
+
/**
|
|
31
|
+
* How many source records name each of `targets`, outside strings and
|
|
32
|
+
* comments. Reads every record, so callers ask only when they have targets.
|
|
33
|
+
*/
|
|
34
|
+
referrers(targets: ReadonlySet<number>): Map<number, number>;
|
|
35
|
+
/**
|
|
36
|
+
* Each source record naming any of `targets` outside strings and comments,
|
|
37
|
+
* and which ones. Reads every record and caches nothing, so callers ask only
|
|
38
|
+
* when they have targets.
|
|
39
|
+
*/
|
|
40
|
+
naming(targets: ReadonlySet<number>): Generator<{
|
|
41
|
+
id: number;
|
|
42
|
+
named: ReadonlySet<number>;
|
|
43
|
+
}>;
|
|
44
|
+
/** A repeated id belongs to its last record, at that record's position. */
|
|
45
|
+
ids(type: string): readonly number[];
|
|
46
|
+
private entry;
|
|
47
|
+
type(id: number | null): string | undefined;
|
|
48
|
+
slots(id: number | null): readonly string[] | undefined;
|
|
49
|
+
}
|
|
50
|
+
/** An entity reference slot, with STEP whitespace and comments around it allowed (#10248). */
|
|
51
|
+
export declare function slotRef(token: string | undefined): number | null;
|
|
52
|
+
/** Whether the slot is the unset marker `$`, with STEP whitespace and comments around it allowed (#10248). */
|
|
53
|
+
export declare function slotUnset(token: string | undefined): boolean;
|
|
54
|
+
/** The bare number of `token`, given as such or wrapped as `TYPE(n)`, or null when it is not a finite number. */
|
|
55
|
+
export declare function bareMeasure(token: string | undefined, type: string): string | null;
|
|
56
|
+
/** The text of a STEP string token, or null. Only compared with fixed names here, so escapes need no decoding. */
|
|
57
|
+
export declare function stepString(token: string | undefined): string | null;
|
|
58
|
+
/** A property set attached by an IfcRelDefinesByProperties, read from the source. */
|
|
59
|
+
export interface CarrierSet {
|
|
60
|
+
readonly rel: number;
|
|
61
|
+
readonly pset: number;
|
|
62
|
+
readonly related: readonly number[];
|
|
63
|
+
/** Property name -> its id; empty for a set that names two properties alike or lists one it cannot read, or whose relationship lists a non-reference; such a set is never read. */
|
|
64
|
+
readonly props: ReadonlyMap<string, number>;
|
|
65
|
+
/** Whether the set and each of its properties are named by no other source record than this relationship and this set; undefined unless `checkExclusive`. */
|
|
66
|
+
readonly exclusive?: boolean;
|
|
67
|
+
}
|
|
68
|
+
/** Every property set named `name` in the source, with what it relates to; `exclusive`, which reads every record, only with `checkExclusive`. */
|
|
69
|
+
export declare function readCarrierSets(source: SourceRecords, name: string, checkExclusive?: boolean): CarrierSet[];
|
|
70
|
+
/**
|
|
71
|
+
* The records of a property set named `name` holding `properties` (STEP bodies
|
|
72
|
+
* such as `IFCPROPERTYSINGLEVALUE(...)`) and relating it to `object`, with
|
|
73
|
+
* GlobalIds derived from `seed`. `ids` numbers them in the target file.
|
|
74
|
+
*/
|
|
75
|
+
export declare function writeCarrierSet(ids: () => number, seed: string, ownerHistory: string, name: string, object: number, properties: readonly string[]): string[];
|
|
76
|
+
//# sourceMappingURL=schema-converter-structural-source.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema-converter-structural-source.d.ts","sourceRoot":"","sources":["../src/schema-converter-structural-source.ts"],"names":[],"mappings":"AAOA,OAAO,EAA8E,KAAK,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAQjI,MAAM,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IAAI,EAAE,MAAM,EAAE,cAAc,UAAO,GAAG,UAAU,EAAE,CA8BxG;AAED;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,GAAG,EAAE,MAAM,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,SAAS,MAAM,EAAE,GAAG,MAAM,EAAE,CAW5J"}
|
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
/* SPDX-License-Identifier: MPL-2.0 */
|
|
2
|
+
/**
|
|
3
|
+
* What the structural conversion prepasses (#9668) share: the schema pair they
|
|
4
|
+
* run for, memoized reads of source records, subtype tests, and the property-set
|
|
5
|
+
* carrier some of them write into the target file and read back from the source.
|
|
6
|
+
*/
|
|
7
|
+
import { stepStringLiteralEnd } from '@ifc-lite/encoding';
|
|
8
|
+
import { deterministicGlobalId, getCanonicalEntityName, getSchemaRegistryForVersion } from '@ifc-lite/parser';
|
|
9
|
+
import { listItems } from './schema-converter-structural-axes.js';
|
|
10
|
+
import { decodeRange } from './source-ref-bounds.js';
|
|
11
|
+
import { readStepSlots } from './step-argument-parser.js';
|
|
12
|
+
import { stepRecordHead } from './step-record-frame.js';
|
|
13
|
+
import { parseStepNumber, skipStepTrivia } from './step-slot-grammar.js';
|
|
14
|
+
import { namedExpressIds, referencesAnyExpressId } from './step-ref-scan.js';
|
|
15
|
+
/** IFC2X3 -> IFC4 is an upgrade, IFC4 -> IFC2X3 a downgrade; the prepasses run for nothing else. */
|
|
16
|
+
export const conversionMode = (from, to) => from === 'IFC2X3' && to === 'IFC4' ? 'upgrade' : from === 'IFC4' && to === 'IFC2X3' ? 'downgrade' : null;
|
|
17
|
+
/** Whether any of `args` names an id this export withholds. */
|
|
18
|
+
export const namesWithheld = (args, withheld) => !!withheld?.size && !!args?.some((a) => referencesAnyExpressId(a, withheld));
|
|
19
|
+
const SUBTYPES = new Map();
|
|
20
|
+
/** Whether `keyword` names a subtype of `parent` in `schema`, memoized per triple. */
|
|
21
|
+
export function isSubtype(schema, keyword, parent) {
|
|
22
|
+
if (!keyword)
|
|
23
|
+
return false;
|
|
24
|
+
const key = `${schema} ${keyword} ${parent}`;
|
|
25
|
+
let known = SUBTYPES.get(key);
|
|
26
|
+
if (known === undefined) {
|
|
27
|
+
const registry = getSchemaRegistryForVersion(schema);
|
|
28
|
+
const name = getCanonicalEntityName(registry, keyword);
|
|
29
|
+
known = !!name && registry.entities[name]?.inheritanceChain?.includes(parent) === true;
|
|
30
|
+
SUBTYPES.set(key, known);
|
|
31
|
+
}
|
|
32
|
+
return known;
|
|
33
|
+
}
|
|
34
|
+
/** Source records read by id, each decoded once. Lives only for one prepass. */
|
|
35
|
+
export class SourceRecords {
|
|
36
|
+
store;
|
|
37
|
+
keptIdsByType = new Map();
|
|
38
|
+
cache = new Map();
|
|
39
|
+
constructor(store) {
|
|
40
|
+
this.store = store;
|
|
41
|
+
}
|
|
42
|
+
hasIndexedRecords() {
|
|
43
|
+
// @raw-entity-enumeration-ok distinguish a parsed source index from type-only preview input
|
|
44
|
+
return this.store.entityIndex.byId.size > 0 || (this.store.deferredEntityIndex?.size ?? 0) > 0;
|
|
45
|
+
}
|
|
46
|
+
decode(entry) {
|
|
47
|
+
return decodeRange(this.store.source, entry.byteOffset, entry.byteOffset + entry.byteLength);
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* How many source records name each of `targets`, outside strings and
|
|
51
|
+
* comments. Reads every record, so callers ask only when they have targets.
|
|
52
|
+
*/
|
|
53
|
+
referrers(targets) {
|
|
54
|
+
const uses = new Map();
|
|
55
|
+
for (const { named } of this.naming(targets))
|
|
56
|
+
for (const t of named)
|
|
57
|
+
uses.set(t, (uses.get(t) ?? 0) + 1);
|
|
58
|
+
return uses;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Each source record naming any of `targets` outside strings and comments,
|
|
62
|
+
* and which ones. Reads every record and caches nothing, so callers ask only
|
|
63
|
+
* when they have targets.
|
|
64
|
+
*/
|
|
65
|
+
*naming(targets) {
|
|
66
|
+
if (targets.size === 0)
|
|
67
|
+
return;
|
|
68
|
+
const deferred = this.store.deferredEntityIndex;
|
|
69
|
+
// @raw-entity-enumeration-ok same unedited source-only prepass
|
|
70
|
+
const primary = this.store.entityIndex.byId;
|
|
71
|
+
for (const index of deferred ? [primary, deferred] : [primary]) {
|
|
72
|
+
for (const [id, entry] of index) {
|
|
73
|
+
if (deferred && this.entry(id)?.byteOffset !== entry.byteOffset)
|
|
74
|
+
continue;
|
|
75
|
+
const text = this.decode(entry);
|
|
76
|
+
const head = stepRecordHead(text);
|
|
77
|
+
const named = namedExpressIds(text.slice(head?.open ?? skipStepTrivia(text, 0) + 1), targets);
|
|
78
|
+
if (named.size)
|
|
79
|
+
yield { id, named };
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
/** A repeated id belongs to its last record, at that record's position. */
|
|
84
|
+
ids(type) {
|
|
85
|
+
const cached = this.keptIdsByType.get(type);
|
|
86
|
+
if (cached)
|
|
87
|
+
return cached;
|
|
88
|
+
// @raw-entity-enumeration-ok conversion prepass is enabled only for an unedited full-source export (step-pass-builder.ts)
|
|
89
|
+
const ids = this.store.entityIndex.byType.get(type) ?? [];
|
|
90
|
+
const last = new Map();
|
|
91
|
+
ids.forEach((id, i) => last.set(id, i));
|
|
92
|
+
const kept = ids.filter((id, i) => last.get(id) === i && this.type(id) === type);
|
|
93
|
+
this.keptIdsByType.set(type, kept);
|
|
94
|
+
return kept;
|
|
95
|
+
}
|
|
96
|
+
entry(id) {
|
|
97
|
+
// @raw-entity-enumeration-ok same unedited source-only prepass
|
|
98
|
+
const primary = this.store.entityIndex.byId.get(id);
|
|
99
|
+
const deferred = this.store.deferredEntityIndex?.get(id);
|
|
100
|
+
return deferred && (!primary || deferred.byteOffset > primary.byteOffset) ? deferred : primary;
|
|
101
|
+
}
|
|
102
|
+
type(id) {
|
|
103
|
+
return id === null ? undefined : this.entry(id)?.type.toUpperCase();
|
|
104
|
+
}
|
|
105
|
+
slots(id) {
|
|
106
|
+
if (id === null)
|
|
107
|
+
return undefined;
|
|
108
|
+
if (!this.cache.has(id)) {
|
|
109
|
+
const entry = this.entry(id);
|
|
110
|
+
this.cache.set(id, entry ? readStepSlots(this.decode(entry))?.slots : undefined);
|
|
111
|
+
}
|
|
112
|
+
return this.cache.get(id);
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
/** An entity reference slot, with STEP whitespace and comments around it allowed (#10248). */
|
|
116
|
+
export function slotRef(token) {
|
|
117
|
+
const text = token ?? '';
|
|
118
|
+
const start = skipStepTrivia(text, 0);
|
|
119
|
+
const m = start < 0 ? null : /^#\s*(\d+)/.exec(text.slice(start));
|
|
120
|
+
return m && skipStepTrivia(text, start + m[0].length) === text.length ? Number(m[1]) : null;
|
|
121
|
+
}
|
|
122
|
+
/** Whether the slot is the unset marker `$`, with STEP whitespace and comments around it allowed (#10248). */
|
|
123
|
+
export function slotUnset(token) {
|
|
124
|
+
const text = token ?? '';
|
|
125
|
+
const start = skipStepTrivia(text, 0);
|
|
126
|
+
return start >= 0 && text[start] === '$' && skipStepTrivia(text, start + 1) === text.length;
|
|
127
|
+
}
|
|
128
|
+
/** The bare number of `token`, given as such or wrapped as `TYPE(n)`, or null when it is not a finite number. */
|
|
129
|
+
export function bareMeasure(token, type) {
|
|
130
|
+
const wrapped = new RegExp(`^\\s*${type}\\s*\\((.*)\\)\\s*$`, 'i').exec(token ?? '')?.[1];
|
|
131
|
+
const bare = (wrapped ?? token ?? '').trim();
|
|
132
|
+
return Number.isFinite(parseStepNumber(bare)) ? bare : null;
|
|
133
|
+
}
|
|
134
|
+
/** The text of a STEP string token, or null. Only compared with fixed names here, so escapes need no decoding. */
|
|
135
|
+
export function stepString(token) {
|
|
136
|
+
// STEP whitespace and comments may sit around the string (#10248), never inside the quotes.
|
|
137
|
+
const text = token ?? '';
|
|
138
|
+
const start = skipStepTrivia(text, 0);
|
|
139
|
+
if (start < 0 || text[start] !== "'")
|
|
140
|
+
return null;
|
|
141
|
+
const end = stepStringLiteralEnd(text, start);
|
|
142
|
+
return end > start && skipStepTrivia(text, end) === text.length ? text.slice(start + 1, end - 1) : null;
|
|
143
|
+
}
|
|
144
|
+
/** Every property set named `name` in the source, with what it relates to; `exclusive`, which reads every record, only with `checkExclusive`. */
|
|
145
|
+
export function readCarrierSets(source, name, checkExclusive = true) {
|
|
146
|
+
const rels = source.ids('IFCRELDEFINESBYPROPERTIES');
|
|
147
|
+
const candidates = rels.filter((rel) => {
|
|
148
|
+
const pset = slotRef(source.slots(rel)?.[5]);
|
|
149
|
+
return source.type(pset) === 'IFCPROPERTYSET' && stepString(source.slots(pset)?.[2]) === name;
|
|
150
|
+
});
|
|
151
|
+
if (!candidates.length)
|
|
152
|
+
return [];
|
|
153
|
+
const members = candidates.map((rel) => {
|
|
154
|
+
const pset = slotRef(source.slots(rel)[5]);
|
|
155
|
+
return { rel, pset, propIds: (listItems(source.slots(pset)?.[4] ?? '') ?? []).map(slotRef) };
|
|
156
|
+
});
|
|
157
|
+
// A carrier is exclusive when its relationship is the only record naming its set, and its set the only one naming each property.
|
|
158
|
+
const uses = checkExclusive ? source.referrers(new Set(members.flatMap(({ pset, propIds }) => [pset, ...propIds.filter((p) => p !== null)]))) : undefined;
|
|
159
|
+
return members.map(({ rel, pset, propIds }) => {
|
|
160
|
+
// IfcPropertySet names its properties uniquely (IFC4 UniquePropertyNames, IFC2X3 WR32). A set that does
|
|
161
|
+
// not, that lists a property it cannot read, or whose relationship lists a non-reference, still counts as
|
|
162
|
+
// present for the objects it does name (for ambiguity checks) but gives no property and is never consumed.
|
|
163
|
+
const listed = listItems(source.slots(rel)?.[4] ?? '')?.map(slotRef) ?? [];
|
|
164
|
+
const related = listed.filter((r) => r !== null);
|
|
165
|
+
const props = new Map();
|
|
166
|
+
if (related.length === listed.length) {
|
|
167
|
+
for (const p of propIds) {
|
|
168
|
+
const propName = stepString(source.slots(p)?.[0]);
|
|
169
|
+
if (p === null || propName === null || props.has(propName)) {
|
|
170
|
+
props.clear();
|
|
171
|
+
break;
|
|
172
|
+
}
|
|
173
|
+
props.set(propName, p);
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
const exclusive = uses ? uses.get(pset) === 1 && propIds.every((p) => p !== null && uses.get(p) === 1) : undefined;
|
|
177
|
+
return { rel, pset, related, props, exclusive };
|
|
178
|
+
});
|
|
179
|
+
}
|
|
180
|
+
/**
|
|
181
|
+
* The records of a property set named `name` holding `properties` (STEP bodies
|
|
182
|
+
* such as `IFCPROPERTYSINGLEVALUE(...)`) and relating it to `object`, with
|
|
183
|
+
* GlobalIds derived from `seed`. `ids` numbers them in the target file.
|
|
184
|
+
*/
|
|
185
|
+
export function writeCarrierSet(ids, seed, ownerHistory, name, object, properties) {
|
|
186
|
+
const lines = [];
|
|
187
|
+
const propIds = properties.map((body) => {
|
|
188
|
+
const id = ids();
|
|
189
|
+
lines.push(`#${id}=${body};`);
|
|
190
|
+
return `#${id}`;
|
|
191
|
+
});
|
|
192
|
+
const pset = ids();
|
|
193
|
+
lines.push(`#${pset}=IFCPROPERTYSET('${deterministicGlobalId(`${seed}:pset`)}',${ownerHistory},'${name}',$,(${propIds.join(',')}));`);
|
|
194
|
+
lines.push(`#${ids()}=IFCRELDEFINESBYPROPERTIES('${deterministicGlobalId(`${seed}:rel`)}',${ownerHistory},$,$,(#${object}),#${pset});`);
|
|
195
|
+
return lines;
|
|
196
|
+
}
|
|
197
|
+
//# sourceMappingURL=schema-converter-structural-source.js.map
|