@ifc-lite/export 4.13.2 → 4.14.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/affected-set.d.ts.map +1 -1
- package/dist/affected-set.js +9 -2
- package/dist/affected-set.js.map +1 -1
- package/dist/anonymize-export.js +2 -2
- package/dist/anonymize-export.js.map +1 -1
- package/dist/anonymize-scrub.js +3 -3
- package/dist/anonymize-scrub.js.map +1 -1
- package/dist/appearance-dependencies.js +1 -1
- package/dist/appearance-dependencies.js.map +1 -1
- package/dist/attribute-real-slots.js +1 -1
- package/dist/attribute-real-slots.js.map +1 -1
- package/dist/attribute-slot-types.d.ts.map +1 -1
- package/dist/attribute-slot-types.js +19 -13
- package/dist/attribute-slot-types.js.map +1 -1
- package/dist/authored-resource-cleanup.js +1 -1
- package/dist/authored-resource-cleanup.js.map +1 -1
- package/dist/declared-property-type.d.ts.map +1 -1
- package/dist/declared-property-type.js +5 -4
- package/dist/declared-property-type.js.map +1 -1
- package/dist/edit-ownership.d.ts +8 -0
- package/dist/edit-ownership.d.ts.map +1 -1
- package/dist/edit-ownership.js +58 -42
- package/dist/edit-ownership.js.map +1 -1
- package/dist/effective-index-created-rows.d.ts +19 -0
- package/dist/effective-index-created-rows.d.ts.map +1 -0
- package/dist/effective-index-created-rows.js +37 -0
- package/dist/effective-index-created-rows.js.map +1 -0
- package/dist/effective-index.d.ts.map +1 -1
- package/dist/effective-index.js +3 -3
- package/dist/effective-index.js.map +1 -1
- package/dist/effective-source-record.js +1 -1
- package/dist/effective-source-record.js.map +1 -1
- package/dist/entity-subgraph.d.ts +6 -2
- package/dist/entity-subgraph.d.ts.map +1 -1
- package/dist/entity-subgraph.js +70 -5
- package/dist/entity-subgraph.js.map +1 -1
- package/dist/entity-type-sets.d.ts +2 -19
- package/dist/entity-type-sets.d.ts.map +1 -1
- package/dist/entity-type-sets.js +14 -4
- package/dist/entity-type-sets.js.map +1 -1
- package/dist/ifc4-registry.d.ts +14 -0
- package/dist/ifc4-registry.d.ts.map +1 -0
- package/dist/ifc4-registry.js +22 -0
- package/dist/ifc4-registry.js.map +1 -0
- package/dist/ifc5-effective-rows.js +1 -1
- package/dist/ifc5-effective-rows.js.map +1 -1
- package/dist/ifc5-tree-scope.js +2 -2
- package/dist/ifc5-tree-scope.js.map +1 -1
- package/dist/index.d.ts +4 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -2
- package/dist/index.js.map +1 -1
- package/dist/lod0-generator.d.ts.map +1 -1
- package/dist/lod0-generator.js +14 -8
- package/dist/lod0-generator.js.map +1 -1
- package/dist/merged-exporter.d.ts.map +1 -1
- package/dist/merged-exporter.js +6 -3
- package/dist/merged-exporter.js.map +1 -1
- package/dist/nonrel-positional-ref-narrowing.js +6 -6
- package/dist/nonrel-positional-ref-narrowing.js.map +1 -1
- package/dist/nonrel-ref-list-types.d.ts +4 -4
- package/dist/nonrel-ref-list-types.d.ts.map +1 -1
- package/dist/nonrel-ref-list-types.js +19 -7
- package/dist/nonrel-ref-list-types.js.map +1 -1
- package/dist/parquet-created-entity-rows.js +1 -1
- package/dist/parquet-created-entity-rows.js.map +1 -1
- package/dist/parquet-relationship-rows.js +1 -1
- package/dist/parquet-relationship-rows.js.map +1 -1
- package/dist/reference-collector.d.ts.map +1 -1
- package/dist/reference-collector.js +2 -2
- package/dist/reference-collector.js.map +1 -1
- package/dist/registry-entity-names.d.ts +6 -2
- package/dist/registry-entity-names.d.ts.map +1 -1
- package/dist/registry-entity-names.js +10 -2
- package/dist/registry-entity-names.js.map +1 -1
- package/dist/relationship-slot-bounds.js +4 -4
- package/dist/relationship-slot-bounds.js.map +1 -1
- package/dist/remesh-context-roots.d.ts +13 -6
- package/dist/remesh-context-roots.d.ts.map +1 -1
- package/dist/remesh-context-roots.js +51 -22
- package/dist/remesh-context-roots.js.map +1 -1
- package/dist/renumber-step-ids.d.ts +43 -0
- package/dist/renumber-step-ids.d.ts.map +1 -0
- package/dist/renumber-step-ids.js +237 -0
- package/dist/renumber-step-ids.js.map +1 -0
- package/dist/retype.d.ts.map +1 -1
- package/dist/retype.js +23 -12
- package/dist/retype.js.map +1 -1
- package/dist/schema-conversion-description.d.ts +6 -0
- package/dist/schema-conversion-description.d.ts.map +1 -0
- package/dist/schema-conversion-description.js +25 -0
- package/dist/schema-conversion-description.js.map +1 -0
- package/dist/schema-conversion-loss-report.d.ts +2 -24
- package/dist/schema-conversion-loss-report.d.ts.map +1 -1
- package/dist/schema-conversion-loss-report.js +34 -0
- package/dist/schema-conversion-loss-report.js.map +1 -1
- package/dist/schema-converter-attr-remap.d.ts +8 -0
- package/dist/schema-converter-attr-remap.d.ts.map +1 -1
- package/dist/schema-converter-attr-remap.js +10 -0
- package/dist/schema-converter-attr-remap.js.map +1 -1
- package/dist/schema-converter-enums.d.ts +3 -0
- package/dist/schema-converter-enums.d.ts.map +1 -1
- package/dist/schema-converter-enums.js +4 -1
- package/dist/schema-converter-enums.js.map +1 -1
- package/dist/schema-converter-structural-axes.d.ts +11 -0
- package/dist/schema-converter-structural-axes.d.ts.map +1 -0
- package/dist/schema-converter-structural-axes.js +59 -0
- package/dist/schema-converter-structural-axes.js.map +1 -0
- package/dist/schema-converter-structural-diagnostics.d.ts +24 -0
- package/dist/schema-converter-structural-diagnostics.d.ts.map +1 -0
- package/dist/schema-converter-structural-diagnostics.js +84 -0
- package/dist/schema-converter-structural-diagnostics.js.map +1 -0
- package/dist/schema-converter-structural-links.d.ts +21 -0
- package/dist/schema-converter-structural-links.d.ts.map +1 -0
- package/dist/schema-converter-structural-links.js +63 -0
- package/dist/schema-converter-structural-links.js.map +1 -0
- package/dist/schema-converter-structural-varying.d.ts +43 -0
- package/dist/schema-converter-structural-varying.d.ts.map +1 -0
- package/dist/schema-converter-structural-varying.js +154 -0
- package/dist/schema-converter-structural-varying.js.map +1 -0
- package/dist/schema-converter-structural.d.ts +8 -0
- package/dist/schema-converter-structural.d.ts.map +1 -0
- package/dist/schema-converter-structural.js +78 -0
- package/dist/schema-converter-structural.js.map +1 -0
- package/dist/schema-converter.d.ts +0 -4
- package/dist/schema-converter.d.ts.map +1 -1
- package/dist/schema-converter.js +19 -32
- package/dist/schema-converter.js.map +1 -1
- package/dist/schema-grid-frames.d.ts +19 -0
- package/dist/schema-grid-frames.d.ts.map +1 -0
- package/dist/schema-grid-frames.js +84 -0
- package/dist/schema-grid-frames.js.map +1 -0
- package/dist/schema-ifc2x3-placements.d.ts +12 -0
- package/dist/schema-ifc2x3-placements.d.ts.map +1 -0
- package/dist/schema-ifc2x3-placements.js +297 -0
- package/dist/schema-ifc2x3-placements.js.map +1 -0
- package/dist/schema-ifc2x3-records.d.ts +58 -0
- package/dist/schema-ifc2x3-records.d.ts.map +1 -0
- package/dist/schema-ifc2x3-records.js +179 -0
- package/dist/schema-ifc2x3-records.js.map +1 -0
- package/dist/schema-style-flatten.d.ts +7 -2
- package/dist/schema-style-flatten.d.ts.map +1 -1
- package/dist/schema-style-flatten.js +34 -2
- package/dist/schema-style-flatten.js.map +1 -1
- package/dist/section-export.d.ts.map +1 -1
- package/dist/section-export.js +3 -2
- package/dist/section-export.js.map +1 -1
- package/dist/select-qualification.d.ts.map +1 -1
- package/dist/select-qualification.js +6 -5
- package/dist/select-qualification.js.map +1 -1
- package/dist/step-collection.d.ts.map +1 -1
- package/dist/step-collection.js +3 -0
- package/dist/step-collection.js.map +1 -1
- package/dist/step-derived-quantities.d.ts +23 -0
- package/dist/step-derived-quantities.d.ts.map +1 -0
- package/dist/step-derived-quantities.js +50 -0
- package/dist/step-derived-quantities.js.map +1 -0
- package/dist/step-exporter.js +2 -1
- package/dist/step-exporter.js.map +1 -1
- package/dist/step-header.d.ts.map +1 -1
- package/dist/step-header.js +3 -1
- package/dist/step-header.js.map +1 -1
- package/dist/step-internal-pset-ids.d.ts +7 -0
- package/dist/step-internal-pset-ids.d.ts.map +1 -0
- package/dist/step-internal-pset-ids.js +25 -0
- package/dist/step-internal-pset-ids.js.map +1 -0
- package/dist/step-map-unit-normalization.d.ts.map +1 -1
- package/dist/step-map-unit-normalization.js +10 -3
- package/dist/step-map-unit-normalization.js.map +1 -1
- package/dist/step-native-set-record.d.ts +2 -0
- package/dist/step-native-set-record.d.ts.map +1 -1
- package/dist/step-native-set-record.js +10 -0
- package/dist/step-native-set-record.js.map +1 -1
- package/dist/step-overlay-entities.js +4 -4
- package/dist/step-overlay-entities.js.map +1 -1
- package/dist/step-overlay-property-base.d.ts +13 -0
- package/dist/step-overlay-property-base.d.ts.map +1 -0
- package/dist/step-overlay-property-base.js +30 -0
- package/dist/step-overlay-property-base.js.map +1 -0
- package/dist/step-pass-builder.d.ts.map +1 -1
- package/dist/step-pass-builder.js +7 -0
- package/dist/step-pass-builder.js.map +1 -1
- package/dist/step-property-set-collection.d.ts.map +1 -1
- package/dist/step-property-set-collection.js +7 -2
- package/dist/step-property-set-collection.js.map +1 -1
- package/dist/step-property-set-generators.d.ts.map +1 -1
- package/dist/step-property-set-generators.js +8 -4
- package/dist/step-property-set-generators.js.map +1 -1
- package/dist/step-property-set-index.js +1 -1
- package/dist/step-property-set-index.js.map +1 -1
- package/dist/step-property-set-readers.d.ts.map +1 -1
- package/dist/step-property-set-readers.js +6 -5
- package/dist/step-property-set-readers.js.map +1 -1
- package/dist/step-pset-copy-on-write.d.ts.map +1 -1
- package/dist/step-pset-copy-on-write.js +9 -7
- package/dist/step-pset-copy-on-write.js.map +1 -1
- package/dist/step-serialization.d.ts +1 -1
- package/dist/step-serialization.d.ts.map +1 -1
- package/dist/step-serialization.js +14 -2
- package/dist/step-serialization.js.map +1 -1
- package/dist/step-shared-atom-retention.js +1 -1
- package/dist/step-shared-atom-retention.js.map +1 -1
- package/dist/step-slot-grammar.d.ts +2 -0
- package/dist/step-slot-grammar.d.ts.map +1 -1
- package/dist/step-slot-grammar.js +5 -0
- package/dist/step-slot-grammar.js.map +1 -1
- package/dist/step-source-iteration.d.ts.map +1 -1
- package/dist/step-source-iteration.js +6 -2
- package/dist/step-source-iteration.js.map +1 -1
- package/dist/subset-entity-reader.d.ts.map +1 -1
- package/dist/subset-entity-reader.js +15 -8
- package/dist/subset-entity-reader.js.map +1 -1
- package/dist/subset-roots.d.ts +4 -14
- package/dist/subset-roots.d.ts.map +1 -1
- package/dist/subset-roots.js +14 -4
- package/dist/subset-roots.js.map +1 -1
- package/package.json +11 -10
|
@@ -7,12 +7,14 @@
|
|
|
7
7
|
* fillings in those openings (`IfcRelFillsElement`), and its layered material
|
|
8
8
|
* (`IfcRelAssociatesMaterial`, which the wasm material-layer index scans the
|
|
9
9
|
* buffer for). Nor does it reach the project, whose unit assignment and
|
|
10
|
-
* representation contexts the pre-pass reads
|
|
10
|
+
* representation contexts the pre-pass reads, or the sites, whose placement
|
|
11
|
+
* the mesher recognises to pick a host's cut frame (#10435; the subgraph
|
|
12
|
+
* writes them without their representation). This module names those roots.
|
|
11
13
|
*
|
|
12
|
-
* Cost is O(targets + their relationship edges
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
14
|
+
* Cost is O(targets + their relationship edges): the parsed relationship
|
|
15
|
+
* graph answers the source relationships by CSR lookup, and the overlay's
|
|
16
|
+
* reference buckets answer the created ones. Nothing here enumerates the
|
|
17
|
+
* model or the session (#8452).
|
|
16
18
|
*
|
|
17
19
|
* Known gap: a SOURCE relationship retargeted onto a target by a queued
|
|
18
20
|
* attribute mutation is invisible to the parsed graph, which still names the
|
|
@@ -22,9 +24,14 @@
|
|
|
22
24
|
import type { IfcDataStore } from '@ifc-lite/parser';
|
|
23
25
|
import type { MutablePropertyView } from '@ifc-lite/mutations';
|
|
24
26
|
import { type EffectiveEntityIndex } from './effective-index.js';
|
|
27
|
+
/** Records a re-mesh buffer carries for what the mesher reads about the whole
|
|
28
|
+
* model, not for any element: the project (units, contexts) and the sites
|
|
29
|
+
* (the placement a host's cut frame is recognised by, #10435). Never
|
|
30
|
+
* re-meshed themselves. */
|
|
31
|
+
export declare const REMESH_CONTEXT_TYPES: readonly ["IFCPROJECT", "IFCSITE"];
|
|
25
32
|
/**
|
|
26
33
|
* Roots, besides the targets themselves, that a subgraph must carry for the
|
|
27
|
-
* targets to mesh exactly as they do on load: every live `IfcProject`, each
|
|
34
|
+
* targets to mesh exactly as they do on load: every live `IfcProject` and `IfcSite`, each
|
|
28
35
|
* target's openings and host (with the voiding relationship), the fillings of
|
|
29
36
|
* those openings (with the filling relationship), and each target's
|
|
30
37
|
* `IfcRelAssociatesMaterial`. Relationships the overlay created this session
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"remesh-context-roots.d.ts","sourceRoot":"","sources":["../src/remesh-context-roots.ts"],"names":[],"mappings":"AAIA
|
|
1
|
+
{"version":3,"file":"remesh-context-roots.d.ts","sourceRoot":"","sources":["../src/remesh-context-roots.ts"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAE/D,OAAO,EAA2B,KAAK,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAM1F;;;4BAG4B;AAC5B,eAAO,MAAM,oBAAoB,oCAAqC,CAAC;AAEvE;;;;;;;GAOG;AACH,wBAAgB,kBAAkB,CAChC,KAAK,EAAE,YAAY,EACnB,IAAI,EAAE,mBAAmB,GAAG,IAAI,EAChC,OAAO,EAAE,WAAW,CAAC,MAAM,CAAC,GAC3B,GAAG,CAAC,MAAM,CAAC,CAGb;AAED,wEAAwE;AACxE,wBAAgB,eAAe,CAC7B,KAAK,EAAE,YAAY,EACnB,KAAK,EAAE,oBAAoB,EAC3B,IAAI,EAAE,mBAAmB,GAAG,IAAI,EAChC,OAAO,EAAE,WAAW,CAAC,MAAM,CAAC,GAC3B,GAAG,CAAC,MAAM,CAAC,CAkDb"}
|
|
@@ -6,9 +6,14 @@ import { getEffectiveEntityIndex } from './effective-index.js';
|
|
|
6
6
|
const VOIDS = 'IFCRELVOIDSELEMENT';
|
|
7
7
|
const FILLS = 'IFCRELFILLSELEMENT';
|
|
8
8
|
const MATERIAL = 'IFCRELASSOCIATESMATERIAL';
|
|
9
|
+
/** Records a re-mesh buffer carries for what the mesher reads about the whole
|
|
10
|
+
* model, not for any element: the project (units, contexts) and the sites
|
|
11
|
+
* (the placement a host's cut frame is recognised by, #10435). Never
|
|
12
|
+
* re-meshed themselves. */
|
|
13
|
+
export const REMESH_CONTEXT_TYPES = ['IFCPROJECT', 'IFCSITE'];
|
|
9
14
|
/**
|
|
10
15
|
* Roots, besides the targets themselves, that a subgraph must carry for the
|
|
11
|
-
* targets to mesh exactly as they do on load: every live `IfcProject`, each
|
|
16
|
+
* targets to mesh exactly as they do on load: every live `IfcProject` and `IfcSite`, each
|
|
12
17
|
* target's openings and host (with the voiding relationship), the fillings of
|
|
13
18
|
* those openings (with the filling relationship), and each target's
|
|
14
19
|
* `IfcRelAssociatesMaterial`. Relationships the overlay created this session
|
|
@@ -21,10 +26,14 @@ export function remeshContextRoots(store, view, targets) {
|
|
|
21
26
|
/** {@link remeshContextRoots} over an already-built effective index. */
|
|
22
27
|
export function contextRootsFor(store, index, view, targets) {
|
|
23
28
|
const out = new Set();
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
29
|
+
for (const type of REMESH_CONTEXT_TYPES) {
|
|
30
|
+
// @raw-entity-enumeration-ok one bucket lookup per context type, each id re-checked against the effective index and type; overlay-created ones are added below
|
|
31
|
+
for (const id of store.entityIndex.byType.get(type) ?? []) {
|
|
32
|
+
// Any live source project, as on main (its units and contexts are read
|
|
33
|
+
// whatever it was retyped to); a site only while it is one.
|
|
34
|
+
if (index.has(id) && (type === 'IFCPROJECT' || index.typeOf(id) === type))
|
|
35
|
+
out.add(id);
|
|
36
|
+
}
|
|
28
37
|
}
|
|
29
38
|
const graph = store.relationships;
|
|
30
39
|
const liveRelationships = (edge) => {
|
|
@@ -74,27 +83,47 @@ export function contextRootsFor(store, index, view, targets) {
|
|
|
74
83
|
* `IfcRelVoidsElement` attaches is known before its fillings are looked up.
|
|
75
84
|
*/
|
|
76
85
|
function addOverlayRelationships(index, view, targets, openings, out) {
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
86
|
+
// Candidates come from the overlay's reference buckets: created records
|
|
87
|
+
// that name a target in their authored attributes or in a queued override,
|
|
88
|
+
// plus records retyped into one of these classes. The effective endpoint
|
|
89
|
+
// checks below decide. A view without those buckets scans every creation.
|
|
90
|
+
const indexed = typeof view.getNewEntitiesReferencing === 'function'
|
|
91
|
+
&& typeof view.getAttributeOverrideReferenceCandidates === 'function'
|
|
92
|
+
&& typeof view.getAttributeOverrideEntityIds === 'function'
|
|
93
|
+
&& typeof view.readNewEntitiesOfType === 'function';
|
|
94
|
+
const everything = indexed ? null : Array.from(view.readNewEntities?.() ?? view.getNewEntities(), entity => entity.expressId);
|
|
95
|
+
const retyped = indexed
|
|
96
|
+
? view.getAttributeOverrideEntityIds([VOIDS, FILLS, MATERIAL, ...REMESH_CONTEXT_TYPES]).filter(id => index.isOverlayCreated(id))
|
|
97
|
+
: [];
|
|
98
|
+
const ascending = (ids) => [...new Set(ids)].sort((a, b) => a - b);
|
|
99
|
+
const naming = (ids) => {
|
|
100
|
+
if (everything)
|
|
101
|
+
return everything;
|
|
102
|
+
const found = [...retyped];
|
|
103
|
+
for (const id of ids) {
|
|
104
|
+
for (const row of view.getNewEntitiesReferencing(id))
|
|
105
|
+
found.push(row.expressId);
|
|
106
|
+
found.push(...view.getAttributeOverrideReferenceCandidates(id));
|
|
107
|
+
}
|
|
108
|
+
return ascending(found);
|
|
109
|
+
};
|
|
110
|
+
const ofType = (ids, type) => ids.filter(id => index.typeOf(id) === type);
|
|
111
|
+
// Source records retyped into a context type count too: the bucket loop
|
|
112
|
+
// above only sees the type a record was parsed with.
|
|
113
|
+
const retypedContext = everything ? [] : view.getAttributeOverrideEntityIds([...REMESH_CONTEXT_TYPES]);
|
|
114
|
+
for (const type of REMESH_CONTEXT_TYPES) {
|
|
115
|
+
const created = everything
|
|
116
|
+
?? ascending([...Array.from(view.readNewEntitiesOfType(type), row => row.expressId), ...retypedContext]);
|
|
117
|
+
for (const id of ofType(created, type))
|
|
118
|
+
out.add(id);
|
|
91
119
|
}
|
|
92
120
|
const targetSet = new Set(targets);
|
|
93
121
|
const ref = (rel, name) => {
|
|
94
122
|
const id = index.effectiveAttributeRef(rel, name);
|
|
95
123
|
return id !== undefined && index.has(id) ? id : undefined;
|
|
96
124
|
};
|
|
97
|
-
|
|
125
|
+
const nearTargets = naming(targets);
|
|
126
|
+
for (const rel of ofType(nearTargets, VOIDS)) {
|
|
98
127
|
const host = ref(rel, 'RelatingBuildingElement');
|
|
99
128
|
const opening = ref(rel, 'RelatedOpeningElement');
|
|
100
129
|
if (host === undefined || opening === undefined)
|
|
@@ -107,7 +136,7 @@ function addOverlayRelationships(index, view, targets, openings, out) {
|
|
|
107
136
|
if (targetSet.has(host))
|
|
108
137
|
openings.add(opening);
|
|
109
138
|
}
|
|
110
|
-
for (const rel of
|
|
139
|
+
for (const rel of ofType(everything ?? naming([...targets, ...openings]), FILLS)) {
|
|
111
140
|
const opening = ref(rel, 'RelatingOpeningElement');
|
|
112
141
|
const filling = ref(rel, 'RelatedBuildingElement');
|
|
113
142
|
if (opening === undefined || filling === undefined)
|
|
@@ -118,7 +147,7 @@ function addOverlayRelationships(index, view, targets, openings, out) {
|
|
|
118
147
|
out.add(opening);
|
|
119
148
|
out.add(filling);
|
|
120
149
|
}
|
|
121
|
-
for (const rel of
|
|
150
|
+
for (const rel of ofType(nearTargets, MATERIAL)) {
|
|
122
151
|
if ((index.refsOf(rel) ?? []).some((id) => targetSet.has(id)))
|
|
123
152
|
out.add(rel);
|
|
124
153
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"remesh-context-roots.js","sourceRoot":"","sources":["../src/remesh-context-roots.ts"],"names":[],"mappings":"AAAA;;+DAE+D;
|
|
1
|
+
{"version":3,"file":"remesh-context-roots.js","sourceRoot":"","sources":["../src/remesh-context-roots.ts"],"names":[],"mappings":"AAAA;;+DAE+D;AA4B/D,OAAO,EAAE,gBAAgB,EAAa,MAAM,gBAAgB,CAAC;AAC7D,OAAO,EAAE,uBAAuB,EAA6B,MAAM,sBAAsB,CAAC;AAE1F,MAAM,KAAK,GAAG,oBAAoB,CAAC;AACnC,MAAM,KAAK,GAAG,oBAAoB,CAAC;AACnC,MAAM,QAAQ,GAAG,0BAA0B,CAAC;AAE5C;;;4BAG4B;AAC5B,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,YAAY,EAAE,SAAS,CAAU,CAAC;AAEvE;;;;;;;GAOG;AACH,MAAM,UAAU,kBAAkB,CAChC,KAAmB,EACnB,IAAgC,EAChC,OAA4B;IAE5B,MAAM,KAAK,GAAG,uBAAuB,CAAC,KAAK,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;IACzD,OAAO,eAAe,CAAC,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,OAAO,CAAC,CAAC;AACtD,CAAC;AAED,wEAAwE;AACxE,MAAM,UAAU,eAAe,CAC7B,KAAmB,EACnB,KAA2B,EAC3B,IAAgC,EAChC,OAA4B;IAE5B,MAAM,GAAG,GAAG,IAAI,GAAG,EAAU,CAAC;IAC9B,KAAK,MAAM,IAAI,IAAI,oBAAoB,EAAE,CAAC;QACxC,+JAA+J;QAC/J,KAAK,MAAM,EAAE,IAAI,KAAK,CAAC,WAAW,CAAC,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,EAAE,EAAE,CAAC;YAC1D,uEAAuE;YACvE,4DAA4D;YAC5D,IAAI,KAAK,CAAC,GAAG,CAAC,EAAE,CAAC,IAAI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CAAC,GAAG,CAAC,CAAC;QACb,GAAG,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;QACjB,GAAG,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;IACnB,CAAC;IACD,KAAK,MAAM,GAAG,IAAI,MAAM,CAAC,WAAW,EAAE,QAAQ,CAAC,EAAE,CAAC;QAChD,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,SAAS,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;YAAE,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IAC9E,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Give every entity instance in a STEP file a new instance name (`#id`) from a
|
|
3
|
+
* seeded permutation, and rewrite every reference to match.
|
|
4
|
+
*
|
|
5
|
+
* Instance names only identify an instance within one file; they carry no
|
|
6
|
+
* meaning and exporters renumber freely. This makes that visible and testable:
|
|
7
|
+
* teaching material can show that `#id`s change while GlobalIds do not, and
|
|
8
|
+
* test corpora can check that a consumer never depends on `#id` values or on
|
|
9
|
+
* instance order.
|
|
10
|
+
*
|
|
11
|
+
* Reference rewriting is `remapEntityText` (the merged exporter's rule): only
|
|
12
|
+
* `#digits` tokens outside string literals change, so `'Room #205'` survives.
|
|
13
|
+
* Statements are split at `;` outside string literals (`stepStringLiteralEnd`,
|
|
14
|
+
* which also honours the `\S\'` PAGE operand) and outside comments. References
|
|
15
|
+
* are rewritten in DATA records and in the edition-3 ANCHOR and REFERENCE
|
|
16
|
+
* sections; REFERENCE entries (`#12=<uri>;`) declare instance names like DATA
|
|
17
|
+
* records do. The HEADER, comments and `<...>` resource literals (anchor names,
|
|
18
|
+
* URIs such as `<http://x#12>`) are copied verbatim, so a `#digits` inside them
|
|
19
|
+
* is neither a reference nor rewritten.
|
|
20
|
+
*/
|
|
21
|
+
import { type RandomSource } from '@ifc-lite/encoding';
|
|
22
|
+
export interface RenumberStepIdsOptions {
|
|
23
|
+
/** Source of the permutation, e.g. a seeded `() => number` in [0, 1). Same source, same output. */
|
|
24
|
+
random: RandomSource;
|
|
25
|
+
/** Also shuffle the order of the instances within each DATA section. Default false: order kept, ids changed. */
|
|
26
|
+
reorder?: boolean;
|
|
27
|
+
}
|
|
28
|
+
export interface RenumberStepIdsResult {
|
|
29
|
+
text: string;
|
|
30
|
+
/** Old instance name -> new instance name, for every instance in the file. */
|
|
31
|
+
idMap: Map<number, number>;
|
|
32
|
+
/** References to instance names no instance in the file declares; left as they were. */
|
|
33
|
+
danglingReferences: number[];
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Renumber every entity instance of a STEP physical file (`#id` -> a seeded
|
|
37
|
+
* permutation of new ids) and rewrite every reference to match.
|
|
38
|
+
*
|
|
39
|
+
* New ids are 1..n, skipping any id that a dangling reference uses, so a
|
|
40
|
+
* dangling reference can never come to point at a real instance.
|
|
41
|
+
*/
|
|
42
|
+
export declare function renumberStepIds(text: string, options: RenumberStepIdsOptions): RenumberStepIdsResult;
|
|
43
|
+
//# sourceMappingURL=renumber-step-ids.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"renumber-step-ids.d.ts","sourceRoot":"","sources":["../src/renumber-step-ids.ts"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,EAAwB,KAAK,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAG7E,MAAM,WAAW,sBAAsB;IACrC,mGAAmG;IACnG,MAAM,EAAE,YAAY,CAAC;IACrB,gHAAgH;IAChH,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED,MAAM,WAAW,qBAAqB;IACpC,IAAI,EAAE,MAAM,CAAC;IACb,8EAA8E;IAC9E,KAAK,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC3B,wFAAwF;IACxF,kBAAkB,EAAE,MAAM,EAAE,CAAC;CAC9B;AAuHD;;;;;;GAMG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,sBAAsB,GAAG,qBAAqB,CAqEpG"}
|
|
@@ -0,0 +1,237 @@
|
|
|
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
|
+
* Give every entity instance in a STEP file a new instance name (`#id`) from a
|
|
6
|
+
* seeded permutation, and rewrite every reference to match.
|
|
7
|
+
*
|
|
8
|
+
* Instance names only identify an instance within one file; they carry no
|
|
9
|
+
* meaning and exporters renumber freely. This makes that visible and testable:
|
|
10
|
+
* teaching material can show that `#id`s change while GlobalIds do not, and
|
|
11
|
+
* test corpora can check that a consumer never depends on `#id` values or on
|
|
12
|
+
* instance order.
|
|
13
|
+
*
|
|
14
|
+
* Reference rewriting is `remapEntityText` (the merged exporter's rule): only
|
|
15
|
+
* `#digits` tokens outside string literals change, so `'Room #205'` survives.
|
|
16
|
+
* Statements are split at `;` outside string literals (`stepStringLiteralEnd`,
|
|
17
|
+
* which also honours the `\S\'` PAGE operand) and outside comments. References
|
|
18
|
+
* are rewritten in DATA records and in the edition-3 ANCHOR and REFERENCE
|
|
19
|
+
* sections; REFERENCE entries (`#12=<uri>;`) declare instance names like DATA
|
|
20
|
+
* records do. The HEADER, comments and `<...>` resource literals (anchor names,
|
|
21
|
+
* URIs such as `<http://x#12>`) are copied verbatim, so a `#digits` inside them
|
|
22
|
+
* is neither a reference nor rewritten.
|
|
23
|
+
*/
|
|
24
|
+
import { stepStringLiteralEnd } from '@ifc-lite/encoding';
|
|
25
|
+
import { remapEntityText } from './merged-remap.js';
|
|
26
|
+
/** Statements (`...;`) in `text`, split outside string literals, `/* *\/` comments and `<...>` literals. */
|
|
27
|
+
function splitStatements(text) {
|
|
28
|
+
const out = [];
|
|
29
|
+
let start = 0;
|
|
30
|
+
let i = 0;
|
|
31
|
+
while (i < text.length) {
|
|
32
|
+
const c = text.charCodeAt(i);
|
|
33
|
+
if (c === 0x27 /* ' */) {
|
|
34
|
+
const end = stepStringLiteralEnd(text, i);
|
|
35
|
+
if (end === -1)
|
|
36
|
+
throw new Error(`renumberStepIds: unterminated string literal at offset ${i}`);
|
|
37
|
+
i = end;
|
|
38
|
+
continue;
|
|
39
|
+
}
|
|
40
|
+
if (c === 0x2f /* / */ && text.charCodeAt(i + 1) === 0x2a /* * */) {
|
|
41
|
+
const end = text.indexOf('*/', i + 2);
|
|
42
|
+
if (end === -1)
|
|
43
|
+
throw new Error(`renumberStepIds: unterminated comment at offset ${i}`);
|
|
44
|
+
i = end + 2;
|
|
45
|
+
continue;
|
|
46
|
+
}
|
|
47
|
+
if (c === 0x3c /* < */) {
|
|
48
|
+
// Edition-3 resource literal `<...>`: a `;` inside a URI does not end the statement.
|
|
49
|
+
const end = text.indexOf('>', i + 1);
|
|
50
|
+
if (end !== -1) {
|
|
51
|
+
i = end + 1;
|
|
52
|
+
continue;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
if (c === 0x3b /* ; */) {
|
|
56
|
+
out.push({ start, end: i + 1 });
|
|
57
|
+
start = i + 1;
|
|
58
|
+
}
|
|
59
|
+
i++;
|
|
60
|
+
}
|
|
61
|
+
return out;
|
|
62
|
+
}
|
|
63
|
+
/** The statement's keyword after leading whitespace and comments, e.g. `DATA`, `ENDSEC`, or `#` for a record. */
|
|
64
|
+
function leadingToken(text) {
|
|
65
|
+
const t = text.replace(/^(?:\s|\/\*[\s\S]*?\*\/)*/, '');
|
|
66
|
+
if (t.startsWith('#'))
|
|
67
|
+
return '#';
|
|
68
|
+
const m = /^[A-Za-z_][A-Za-z0-9_-]*/.exec(t);
|
|
69
|
+
return m ? m[0].toUpperCase() : '';
|
|
70
|
+
}
|
|
71
|
+
const RECORD_NAME = /^(?:\s|\/\*[\s\S]*?\*\/)*#(\d+)(?:\s|\/\*[\s\S]*?\*\/)*=/;
|
|
72
|
+
/** Whitespace and comments before a statement: they stay in place, untouched. */
|
|
73
|
+
const LEADING_TRIVIA = /^(?:\s|\/\*[\s\S]*?\*\/)*/;
|
|
74
|
+
const leadLength = (raw) => LEADING_TRIVIA.exec(raw)[0].length;
|
|
75
|
+
/**
|
|
76
|
+
* A statement split into code and verbatim parts. Verbatim: `/* *\/` comments
|
|
77
|
+
* and edition-3 resource literals `<...>` (anchor names, URIs such as
|
|
78
|
+
* `<http://x#12>`), both found outside string literals. String literals stay
|
|
79
|
+
* inside the code parts, where `remapEntityText` already leaves them alone.
|
|
80
|
+
*/
|
|
81
|
+
function segments(text) {
|
|
82
|
+
const parts = [];
|
|
83
|
+
let codeStart = 0;
|
|
84
|
+
let i = 0;
|
|
85
|
+
while (i < text.length) {
|
|
86
|
+
if (text[i] === "'") {
|
|
87
|
+
const end = stepStringLiteralEnd(text, i);
|
|
88
|
+
i = end === -1 ? text.length : end;
|
|
89
|
+
continue;
|
|
90
|
+
}
|
|
91
|
+
const comment = text[i] === '/' && text[i + 1] === '*';
|
|
92
|
+
if (comment || text[i] === '<') {
|
|
93
|
+
const end = comment ? text.indexOf('*/', i + 2) : text.indexOf('>', i + 1);
|
|
94
|
+
const stop = end === -1 ? text.length : end + (comment ? 2 : 1);
|
|
95
|
+
if (i > codeStart)
|
|
96
|
+
parts.push({ text: text.slice(codeStart, i), verbatim: false });
|
|
97
|
+
parts.push({ text: text.slice(i, stop), verbatim: true });
|
|
98
|
+
i = codeStart = stop;
|
|
99
|
+
continue;
|
|
100
|
+
}
|
|
101
|
+
i++;
|
|
102
|
+
}
|
|
103
|
+
if (codeStart < text.length)
|
|
104
|
+
parts.push({ text: text.slice(codeStart), verbatim: false });
|
|
105
|
+
return parts;
|
|
106
|
+
}
|
|
107
|
+
/** `#digits` tokens in code: outside string literals, comments and `<...>` literals. */
|
|
108
|
+
function referencedIds(text, into) {
|
|
109
|
+
for (const part of segments(text)) {
|
|
110
|
+
if (part.verbatim)
|
|
111
|
+
continue;
|
|
112
|
+
const code = part.text;
|
|
113
|
+
for (let i = 0; i < code.length; i++) {
|
|
114
|
+
const c = code[i];
|
|
115
|
+
if (c === "'") {
|
|
116
|
+
const end = stepStringLiteralEnd(code, i);
|
|
117
|
+
i = (end === -1 ? code.length : end) - 1;
|
|
118
|
+
}
|
|
119
|
+
else if (c === '#' && code[i + 1] >= '0' && code[i + 1] <= '9') {
|
|
120
|
+
let j = i + 1;
|
|
121
|
+
while (j < code.length && code[j] >= '0' && code[j] <= '9')
|
|
122
|
+
j++;
|
|
123
|
+
into.add(Number(code.slice(i + 1, j)));
|
|
124
|
+
i = j - 1;
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
/** `remapEntityText` on the code parts only; comments and `<...>` literals are copied unchanged. */
|
|
130
|
+
function remapRecord(text, idMap) {
|
|
131
|
+
return segments(text).map(p => (p.verbatim ? p.text : remapEntityText(p.text, 0, idMap))).join('');
|
|
132
|
+
}
|
|
133
|
+
function shuffleInPlace(items, random) {
|
|
134
|
+
for (let i = items.length - 1; i > 0; i--) {
|
|
135
|
+
const j = Math.floor(random() * (i + 1));
|
|
136
|
+
[items[i], items[j]] = [items[j], items[i]];
|
|
137
|
+
}
|
|
138
|
+
return items;
|
|
139
|
+
}
|
|
140
|
+
/**
|
|
141
|
+
* Renumber every entity instance of a STEP physical file (`#id` -> a seeded
|
|
142
|
+
* permutation of new ids) and rewrite every reference to match.
|
|
143
|
+
*
|
|
144
|
+
* New ids are 1..n, skipping any id that a dangling reference uses, so a
|
|
145
|
+
* dangling reference can never come to point at a real instance.
|
|
146
|
+
*/
|
|
147
|
+
export function renumberStepIds(text, options) {
|
|
148
|
+
const statements = splitStatements(text);
|
|
149
|
+
// DATA records grouped by section (they may be reordered within one), plus the
|
|
150
|
+
// edition-3 ANCHOR and REFERENCE statements, rewritten in place.
|
|
151
|
+
const dataSections = [];
|
|
152
|
+
const inPlace = [];
|
|
153
|
+
const named = [];
|
|
154
|
+
let section = null;
|
|
155
|
+
let current = null;
|
|
156
|
+
for (const s of statements) {
|
|
157
|
+
const token = leadingToken(text.slice(s.start, s.end));
|
|
158
|
+
if (token === 'DATA') {
|
|
159
|
+
section = 'DATA';
|
|
160
|
+
current = [];
|
|
161
|
+
dataSections.push(current);
|
|
162
|
+
continue;
|
|
163
|
+
}
|
|
164
|
+
if (token === 'ANCHOR' || token === 'REFERENCE') {
|
|
165
|
+
section = token;
|
|
166
|
+
current = null;
|
|
167
|
+
continue;
|
|
168
|
+
}
|
|
169
|
+
if (token === 'ENDSEC') {
|
|
170
|
+
section = null;
|
|
171
|
+
current = null;
|
|
172
|
+
continue;
|
|
173
|
+
}
|
|
174
|
+
if (section === 'DATA' && current && token === '#') {
|
|
175
|
+
current.push(s);
|
|
176
|
+
named.push(s);
|
|
177
|
+
}
|
|
178
|
+
else if (section === 'REFERENCE' && token === '#') {
|
|
179
|
+
inPlace.push(s);
|
|
180
|
+
named.push(s);
|
|
181
|
+
}
|
|
182
|
+
else if (section === 'ANCHOR')
|
|
183
|
+
inPlace.push(s);
|
|
184
|
+
}
|
|
185
|
+
// Instance names come from DATA records and from REFERENCE entries (`#12=<uri>;`).
|
|
186
|
+
const declared = new Map();
|
|
187
|
+
const referenced = new Set();
|
|
188
|
+
const namedSet = new Set(named);
|
|
189
|
+
for (const r of [...named, ...inPlace.filter(s => !namedSet.has(s))]) {
|
|
190
|
+
const body = text.slice(r.start, r.end);
|
|
191
|
+
const m = namedSet.has(r) ? RECORD_NAME.exec(body) : null;
|
|
192
|
+
if (namedSet.has(r)) {
|
|
193
|
+
if (!m)
|
|
194
|
+
throw new Error(`renumberStepIds: cannot read the instance name of: ${body.trim().slice(0, 80)}`);
|
|
195
|
+
const id = Number(m[1]);
|
|
196
|
+
if (declared.has(id))
|
|
197
|
+
throw new Error(`renumberStepIds: instance #${id} is declared twice`);
|
|
198
|
+
declared.set(id, r);
|
|
199
|
+
}
|
|
200
|
+
referencedIds(m ? body.slice(m[0].length) : body, referenced);
|
|
201
|
+
}
|
|
202
|
+
const danglingReferences = [...referenced].filter(id => !declared.has(id)).sort((a, b) => a - b);
|
|
203
|
+
const blocked = new Set(danglingReferences);
|
|
204
|
+
const pool = [];
|
|
205
|
+
for (let candidate = 1; pool.length < declared.size; candidate++) {
|
|
206
|
+
if (!blocked.has(candidate))
|
|
207
|
+
pool.push(candidate);
|
|
208
|
+
}
|
|
209
|
+
shuffleInPlace(pool, options.random);
|
|
210
|
+
const idMap = new Map();
|
|
211
|
+
[...declared.keys()].forEach((id, i) => idMap.set(id, pool[i]));
|
|
212
|
+
// Rewrite each DATA record in its slot. With `reorder`, the records of a
|
|
213
|
+
// section trade slots; the whitespace and comments before each slot stay where
|
|
214
|
+
// they were, unchanged. Comments inside a record body are copied unchanged too.
|
|
215
|
+
const replacement = new Map();
|
|
216
|
+
const rewrite = (slot, body) => {
|
|
217
|
+
const raw = text.slice(slot.start, slot.end);
|
|
218
|
+
replacement.set(slot, raw.slice(0, leadLength(raw)) + remapRecord(body, idMap));
|
|
219
|
+
};
|
|
220
|
+
const bodyOf = (s) => { const raw = text.slice(s.start, s.end); return raw.slice(leadLength(raw)); };
|
|
221
|
+
for (const sectionRecords of dataSections) {
|
|
222
|
+
const bodies = sectionRecords.map(bodyOf);
|
|
223
|
+
const order = options.reorder ? shuffleInPlace(bodies.map((_, i) => i), options.random) : bodies.map((_, i) => i);
|
|
224
|
+
sectionRecords.forEach((slot, i) => rewrite(slot, bodies[order[i]]));
|
|
225
|
+
}
|
|
226
|
+
for (const s of inPlace)
|
|
227
|
+
rewrite(s, bodyOf(s));
|
|
228
|
+
let out = '';
|
|
229
|
+
let last = 0;
|
|
230
|
+
for (const s of [...replacement.keys()].sort((a, b) => a.start - b.start)) {
|
|
231
|
+
out += text.slice(last, s.start) + replacement.get(s);
|
|
232
|
+
last = s.end;
|
|
233
|
+
}
|
|
234
|
+
out += text.slice(last);
|
|
235
|
+
return { text: out, idMap, danglingReferences };
|
|
236
|
+
}
|
|
237
|
+
//# sourceMappingURL=renumber-step-ids.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"renumber-step-ids.js","sourceRoot":"","sources":["../src/renumber-step-ids.ts"],"names":[],"mappings":"AAAA;;+DAE+D;AAE/D;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,EAAE,oBAAoB,EAAqB,MAAM,oBAAoB,CAAC;AAC7E,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAuBpD,4GAA4G;AAC5G,SAAS,eAAe,CAAC,IAAY;IACnC,MAAM,GAAG,GAAgB,EAAE,CAAC;IAC5B,IAAI,KAAK,GAAG,CAAC,CAAC;IACd,IAAI,CAAC,GAAG,CAAC,CAAC;IACV,OAAO,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC;QACvB,MAAM,CAAC,GAAG,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;QAC7B,IAAI,CAAC,KAAK,IAAI,CAAC,OAAO,EAAE,CAAC;YACvB,MAAM,GAAG,GAAG,oBAAoB,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC;YAC1C,IAAI,GAAG,KAAK,CAAC,CAAC;gBAAE,MAAM,IAAI,KAAK,CAAC,0DAA0D,CAAC,EAAE,CAAC,CAAC;YAC/F,CAAC,GAAG,GAAG,CAAC;YACR,SAAS;QACX,CAAC;QACD,IAAI,CAAC,KAAK,IAAI,CAAC,OAAO,IAAI,IAAI,CAAC,UAAU,CAAC,CAAC,GAAG,CAAC,CAAC,KAAK,IAAI,CAAC,OAAO,EAAE,CAAC;YAClE,MAAM,GAAG,GAAG,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;YACtC,IAAI,GAAG,KAAK,CAAC,CAAC;gBAAE,MAAM,IAAI,KAA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b,KAAK,MAAM,CAAC,IAAI,CAAC,GAAG,WAAW,CAAC,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,GAAG,CAAC,CAAC,KAAK,CAAC,EAAE,CAAC;QAC1E,GAAG,IAAI,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC,CAAC,KAAK,CAAC,GAAG,WAAW,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;QACtD,IAAI,GAAG,CAAC,CAAC,GAAG,CAAC;IACf,CAAC;IACD,GAAG,IAAI,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IACxB,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,KAAK,EAAE,kBAAkB,EAAE,CAAC;AAClD,CAAC"}
|
package/dist/retype.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"retype.d.ts","sourceRoot":"","sources":["../src/retype.ts"],"names":[],"mappings":"AAgCA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"retype.d.ts","sourceRoot":"","sources":["../src/retype.ts"],"names":[],"mappings":"AAgCA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAkE9D,MAAM,WAAW,gBAAgB;IAC/B,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,gFAAgF;IAChF,QAAQ,EAAE,OAAO,CAAC;CACnB;AAED;;;;;;;;GAQG;AACH,wBAAgB,eAAe,CAC7B,SAAS,EAAE,MAAM,EAAE,EACnB,UAAU,EAAE,MAAM,EAClB,OAAO,EAAE,MAAM,EACf,cAAc,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,EACzC,MAAM,EAAE,gBAAgB,GACvB,gBAAgB,CA+ClB;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,cAAc,CAC5B,UAAU,EAAE,MAAM,EAClB,UAAU,EAAE,MAAM,EAClB,OAAO,EAAE,MAAM,EACf,cAAc,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,EACzC,MAAM,EAAE,gBAAgB,GACvB,MAAM,CA2BR"}
|
package/dist/retype.js
CHANGED
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
* identity and only the keyword (and optionally PredefinedType) changes — the
|
|
25
25
|
* raw argument tokens are preserved byte-for-byte.
|
|
26
26
|
*/
|
|
27
|
-
import {
|
|
27
|
+
import { getEntitiesIfc2x3, getEntitiesIfc4Express, getEntitiesIfc4x3 } from '@ifc-lite/data';
|
|
28
28
|
import { escapeStepString } from './step-serialization.js';
|
|
29
29
|
import { frameArgs, stepRecordFrame } from './step-record-frame.js';
|
|
30
30
|
import { splitTopLevelStepArguments } from './step-argument-parser.js';
|
|
@@ -38,16 +38,26 @@ function buildSchemaMap(list) {
|
|
|
38
38
|
}
|
|
39
39
|
return map;
|
|
40
40
|
}
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
41
|
+
// Built on first use: the tables decode on first use too, and loading this
|
|
42
|
+
// module must not decode them (the viewer's startup chunks carry it).
|
|
43
|
+
let schemaMaps;
|
|
44
|
+
function getSchemaMaps() {
|
|
45
|
+
if (schemaMaps === undefined)
|
|
46
|
+
schemaMaps = buildSchemaMaps();
|
|
47
|
+
return schemaMaps;
|
|
48
|
+
}
|
|
49
|
+
function buildSchemaMaps() {
|
|
50
|
+
return {
|
|
51
|
+
IFC2X3: buildSchemaMap(getEntitiesIfc2x3()),
|
|
52
|
+
// Not the raw `ENTITIES_IFC4`: retyping into one of its phantom IFC4
|
|
53
|
+
// entities wrote a class IFC4 lacks, and into `IfcCartesianPointList3D`
|
|
54
|
+
// appended a `TagList` IFC4 never had (#5204).
|
|
55
|
+
IFC4: buildSchemaMap(getEntitiesIfc4Express()),
|
|
56
|
+
IFC4X3: buildSchemaMap(getEntitiesIfc4x3()),
|
|
57
|
+
// IFC5 isn't STEP; never reached for retype, but keep the lookup total.
|
|
58
|
+
IFC5: buildSchemaMap(getEntitiesIfc4x3()),
|
|
59
|
+
};
|
|
60
|
+
}
|
|
51
61
|
/**
|
|
52
62
|
* Look up a class's attribute layout + PredefinedType domain for a schema.
|
|
53
63
|
* Falls back to the IFC4 registry for vendor extensions absent from the
|
|
@@ -55,7 +65,8 @@ const SCHEMA_MAPS = {
|
|
|
55
65
|
*/
|
|
56
66
|
function lookupEntityInfo(schema, name) {
|
|
57
67
|
const upper = name.toUpperCase();
|
|
58
|
-
|
|
68
|
+
const maps = getSchemaMaps();
|
|
69
|
+
return maps[schema]?.get(upper) ?? maps.IFC4.get(upper) ?? null;
|
|
59
70
|
}
|
|
60
71
|
/** Strip the dot-wrapping from a STEP enum token: `.ELEMENT.` → `ELEMENT`. */
|
|
61
72
|
function enumValue(token) {
|
package/dist/retype.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"retype.js","sourceRoot":"","sources":["../src/retype.ts"],"names":[],"mappings":"AAAA;;+DAE+D;AAE/D;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"retype.js","sourceRoot":"","sources":["../src/retype.ts"],"names":[],"mappings":"AAAA;;+DAE+D;AAE/D;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,OAAO,EAAE,iBAAiB,EAAE,sBAAsB,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAC9F,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACpE,OAAO,EAAE,0BAA0B,EAAE,MAAM,2BAA2B,CAAC;AAQvE,SAAS,cAAc,CACrB,IAAwG;IAExG,MAAM,GAAG,GAAG,IAAI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AAI,CAAC,OAAO,EAAE,IAAI,CAAC,IAAI,GAAG,CAAC,CAAC,GAAG,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,UAAU,CAAC,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE,CAAC;AACnI,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { IfcSchemaVersion } from './schema-converter.js';
|
|
2
|
+
/**
|
|
3
|
+
* Get human-readable description of what a conversion entails.
|
|
4
|
+
*/
|
|
5
|
+
export declare function describeConversion(fromSchema: IfcSchemaVersion, toSchema: IfcSchemaVersion): string;
|
|
6
|
+
//# sourceMappingURL=schema-conversion-description.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema-conversion-description.d.ts","sourceRoot":"","sources":["../src/schema-conversion-description.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAE9D;;GAEG;AACH,wBAAgB,kBAAkB,CAChC,UAAU,EAAE,gBAAgB,EAC5B,QAAQ,EAAE,gBAAgB,GACzB,MAAM,CAqBR"}
|
|
@@ -0,0 +1,25 @@
|
|
|
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
|
+
* Get human-readable description of what a conversion entails.
|
|
6
|
+
*/
|
|
7
|
+
export function describeConversion(fromSchema, toSchema) {
|
|
8
|
+
if (fromSchema === toSchema)
|
|
9
|
+
return 'No conversion needed';
|
|
10
|
+
const warnings = [];
|
|
11
|
+
if (toSchema === 'IFC2X3') {
|
|
12
|
+
warnings.push('Entities not in IFC2X3 will be mapped to IfcBuildingElementProxy');
|
|
13
|
+
warnings.push('Extra attributes (e.g., PredefinedType) will be trimmed');
|
|
14
|
+
}
|
|
15
|
+
if (toSchema === 'IFC5') {
|
|
16
|
+
warnings.push('IFC5 is alpha/incomplete — exported files may not validate against final spec');
|
|
17
|
+
}
|
|
18
|
+
if (fromSchema === 'IFC4X3' && (toSchema === 'IFC4' || toSchema === 'IFC2X3')) {
|
|
19
|
+
warnings.push('IFC4X3 facility types (Bridge, Road, Railway) will be mapped to Building/Storey');
|
|
20
|
+
}
|
|
21
|
+
return warnings.length > 0
|
|
22
|
+
? `Converting ${fromSchema} → ${toSchema}: ${warnings.join('; ')}`
|
|
23
|
+
: `Converting ${fromSchema} → ${toSchema}`;
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=schema-conversion-description.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema-conversion-description.js","sourceRoot":"","sources":["../src/schema-conversion-description.ts"],"names":[],"mappings":"AAAA;;+DAE+D;AAI/D;;GAEG;AACH,MAAM,UAAU,kBAAkB,CAChC,UAA4B,EAC5B,QAA0B;IAE1B,IAAI,UAAU,KAAK,QAAQ;QAAE,OAAO,sBAAsB,CAAC;IAE3D,MAAM,QAAQ,GAAa,EAAE,CAAC;IAE9B,IAAI,QAAQ,KAAK,QAAQ,EAAE,CAAC;QAC1B,QAAQ,CAAC,IAAI,CAAC,kEAAkE,CAAC,CAAC;QAClF,QAAQ,CAAC,IAAI,CAAC,yDAAyD,CAAC,CAAC;IAC3E,CAAC;IAED,IAAI,QAAQ,KAAK,MAAM,EAAE,CAAC;QACxB,QAAQ,CAAC,IAAI,CAAC,+EAA+E,CAAC,CAAC;IACjG,CAAC;IAED,IAAI,UAAU,KAAK,QAAQ,IAAI,CAAC,QAAQ,KAAK,MAAM,IAAI,QAAQ,KAAK,QAAQ,CAAC,EAAE,CAAC;QAC9E,QAAQ,CAAC,IAAI,CAAC,iFAAiF,CAAC,CAAC;IACnG,CAAC;IAED,OAAO,QAAQ,CAAC,MAAM,GAAG,CAAC;QACxB,CAAC,CAAC,cAAc,UAAU,MAAM,QAAQ,KAAK,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE;QAClE,CAAC,CAAC,cAAc,UAAU,MAAM,QAAQ,EAAE,CAAC;AAC/C,CAAC"}
|