@bldrs-ai/conway 1.519.1471 → 1.520.1486
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/compiled/examples/browser-bundled.cjs +65 -3
- package/compiled/examples/cli-bundled.cjs +343 -75
- package/compiled/examples/cli-step-bundled.cjs +288 -63
- package/compiled/examples/validator-bundled.cjs +65 -3
- package/compiled/src/AP214E3_2010/ap214_command_line_main.js +7 -3
- package/compiled/src/AP214E3_2010/ap214_geometry_extraction.d.ts +80 -7
- package/compiled/src/AP214E3_2010/ap214_geometry_extraction.d.ts.map +1 -1
- package/compiled/src/AP214E3_2010/ap214_geometry_extraction.js +254 -33
- package/compiled/src/AP214E3_2010/ap214_pcurve_basis_surfaces.test.d.ts +2 -0
- package/compiled/src/AP214E3_2010/ap214_pcurve_basis_surfaces.test.d.ts.map +1 -0
- package/compiled/src/AP214E3_2010/ap214_pcurve_basis_surfaces.test.js +233 -0
- package/compiled/src/compat/web-ifc/ifc_api.d.ts.map +1 -1
- package/compiled/src/compat/web-ifc/ifc_api.js +10 -2
- package/compiled/src/compat/web-ifc/ifc_api_proxy_ap214.d.ts.map +1 -1
- package/compiled/src/compat/web-ifc/ifc_api_proxy_ap214.js +10 -2
- package/compiled/src/compat/web-ifc/ifc_api_proxy_ifc.d.ts.map +1 -1
- package/compiled/src/compat/web-ifc/ifc_api_proxy_ifc.js +10 -2
- package/compiled/src/core/wasm_heap.d.ts +119 -2
- package/compiled/src/core/wasm_heap.d.ts.map +1 -1
- package/compiled/src/core/wasm_heap.js +239 -30
- package/compiled/src/core/wasm_heap.test.js +315 -3
- package/compiled/src/ifc/ifc_geometry_extraction.d.ts +74 -0
- package/compiled/src/ifc/ifc_geometry_extraction.d.ts.map +1 -1
- package/compiled/src/ifc/ifc_geometry_extraction.js +315 -7
- package/compiled/src/ifc/ifc_grid_placement.test.d.ts +2 -0
- package/compiled/src/ifc/ifc_grid_placement.test.d.ts.map +1 -0
- package/compiled/src/ifc/ifc_grid_placement.test.js +261 -0
- package/compiled/src/ifc/ifc_stream_open.test.js +14 -4
- package/compiled/src/step/step_entity_base.d.ts.map +1 -1
- package/compiled/src/step/step_entity_base.js +9 -2
- package/compiled/src/version/version.js +1 -1
- package/compiled/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
|
@@ -30,7 +30,7 @@ var import_node_process = require("node:process");
|
|
|
30
30
|
var readline = __toESM(require("node:readline"), 1);
|
|
31
31
|
|
|
32
32
|
// compiled/src/version/version.js
|
|
33
|
-
var versionString = "Conway v1.
|
|
33
|
+
var versionString = "Conway v1.520.1486";
|
|
34
34
|
|
|
35
35
|
// compiled/dependencies/conway-geom/interface/conway_geometry.js
|
|
36
36
|
var wasmType = "";
|
|
@@ -11065,6 +11065,67 @@ function IfcWorkScheduleTypeEnumDeserializeStep(input2, cursor, endCursor) {
|
|
|
11065
11065
|
return parser208.extract(IfcWorkScheduleTypeEnumSearch, input2, cursor, endCursor);
|
|
11066
11066
|
}
|
|
11067
11067
|
|
|
11068
|
+
// compiled/src/core/wasm_heap.js
|
|
11069
|
+
function describeHeap(wasmModule, arrayPtr, numBytes) {
|
|
11070
|
+
const heap = wasmModule.HEAPU8;
|
|
11071
|
+
const buffer = currentHeapBuffer(wasmModule);
|
|
11072
|
+
const shared = typeof SharedArrayBuffer !== "undefined" && buffer instanceof SharedArrayBuffer;
|
|
11073
|
+
const kind = buffer === void 0 ? "none" : shared ? "SharedArrayBuffer" : "ArrayBuffer";
|
|
11074
|
+
const extensible = shared ? buffer?.growable : buffer?.resizable;
|
|
11075
|
+
return `ptr ${arrayPtr} + ${numBytes} bytes, heap view length ${heap?.length}, buffer ${kind} byteLength ${buffer?.byteLength}, extensible ${extensible}`;
|
|
11076
|
+
}
|
|
11077
|
+
function currentHeapBuffer(wasmModule) {
|
|
11078
|
+
const memory = wasmModule.wasmMemory;
|
|
11079
|
+
return memory !== void 0 ? memory.buffer : wasmModule.HEAPU8?.buffer;
|
|
11080
|
+
}
|
|
11081
|
+
function refreshHeapViews(wasmModule) {
|
|
11082
|
+
if (typeof wasmModule.updateMemoryViews === "function") {
|
|
11083
|
+
wasmModule.updateMemoryViews();
|
|
11084
|
+
return;
|
|
11085
|
+
}
|
|
11086
|
+
if (wasmModule.wasmMemory !== void 0) {
|
|
11087
|
+
return;
|
|
11088
|
+
}
|
|
11089
|
+
const StringVector = wasmModule.stringVector;
|
|
11090
|
+
if (StringVector === void 0) {
|
|
11091
|
+
return;
|
|
11092
|
+
}
|
|
11093
|
+
let scratch;
|
|
11094
|
+
releaseQuietly(() => {
|
|
11095
|
+
const created2 = new StringVector();
|
|
11096
|
+
scratch = created2;
|
|
11097
|
+
created2.push_back("");
|
|
11098
|
+
});
|
|
11099
|
+
const created = scratch;
|
|
11100
|
+
if (created !== void 0) {
|
|
11101
|
+
releaseQuietly(() => created.delete());
|
|
11102
|
+
}
|
|
11103
|
+
}
|
|
11104
|
+
function reconcileHeapBuffer(wasmModule, address, numBytes) {
|
|
11105
|
+
const buffer = currentHeapBuffer(wasmModule);
|
|
11106
|
+
if (buffer !== void 0 && address + numBytes <= buffer.byteLength) {
|
|
11107
|
+
return buffer;
|
|
11108
|
+
}
|
|
11109
|
+
refreshHeapViews(wasmModule);
|
|
11110
|
+
const refreshed = currentHeapBuffer(wasmModule);
|
|
11111
|
+
if (refreshed !== void 0 && address + numBytes <= refreshed.byteLength) {
|
|
11112
|
+
return refreshed;
|
|
11113
|
+
}
|
|
11114
|
+
throw new Error("wasm heap allocation lies outside the heap, and refreshing the module views did not reconcile it. " + describeHeap(wasmModule, address, numBytes));
|
|
11115
|
+
}
|
|
11116
|
+
function wasmHeapView(wasmModule, arrayType, pointer, elementCount) {
|
|
11117
|
+
const address = pointer >>> 0;
|
|
11118
|
+
const numBytes = elementCount * arrayType.BYTES_PER_ELEMENT;
|
|
11119
|
+
return new arrayType(reconcileHeapBuffer(wasmModule, address, numBytes), address, elementCount);
|
|
11120
|
+
}
|
|
11121
|
+
function releaseQuietly(release) {
|
|
11122
|
+
try {
|
|
11123
|
+
release();
|
|
11124
|
+
} catch (error) {
|
|
11125
|
+
logger_default.debug(`wasm resource release failed during teardown: ${error instanceof Error ? error.message : error}`);
|
|
11126
|
+
}
|
|
11127
|
+
}
|
|
11128
|
+
|
|
11068
11129
|
// compiled/src/step/step_entity_base.js
|
|
11069
11130
|
var IfcTokenType;
|
|
11070
11131
|
(function(IfcTokenType2) {
|
|
@@ -11500,8 +11561,9 @@ var StepEntityBase = class {
|
|
|
11500
11561
|
if (optional && stepExtractOptional(buffer, cursor, endCursor) === null) {
|
|
11501
11562
|
return false;
|
|
11502
11563
|
}
|
|
11503
|
-
const
|
|
11504
|
-
|
|
11564
|
+
const length = endCursor - cursor;
|
|
11565
|
+
const dataPtr = result.resize(length);
|
|
11566
|
+
wasmHeapView(module2, Uint8Array, dataPtr, length).set(buffer.subarray(cursor, endCursor));
|
|
11505
11567
|
return true;
|
|
11506
11568
|
}
|
|
11507
11569
|
/**
|
|
@@ -14965,7 +14965,7 @@ ${t5.join("\n")}` : "";
|
|
|
14965
14965
|
var import_process = require("process");
|
|
14966
14966
|
|
|
14967
14967
|
// compiled/src/version/version.js
|
|
14968
|
-
var versionString = "Conway v1.
|
|
14968
|
+
var versionString = "Conway v1.520.1486";
|
|
14969
14969
|
|
|
14970
14970
|
// compiled/dependencies/conway-geom/interface/conway_geometry.js
|
|
14971
14971
|
function pThreadsAllowed() {
|
|
@@ -26948,6 +26948,121 @@ function IfcWorkScheduleTypeEnumDeserializeStep(input, cursor, endCursor) {
|
|
|
26948
26948
|
return parser208.extract(IfcWorkScheduleTypeEnumSearch, input, cursor, endCursor);
|
|
26949
26949
|
}
|
|
26950
26950
|
|
|
26951
|
+
// compiled/src/core/wasm_heap.js
|
|
26952
|
+
function describeHeap(wasmModule, arrayPtr, numBytes) {
|
|
26953
|
+
const heap = wasmModule.HEAPU8;
|
|
26954
|
+
const buffer = currentHeapBuffer(wasmModule);
|
|
26955
|
+
const shared = typeof SharedArrayBuffer !== "undefined" && buffer instanceof SharedArrayBuffer;
|
|
26956
|
+
const kind = buffer === void 0 ? "none" : shared ? "SharedArrayBuffer" : "ArrayBuffer";
|
|
26957
|
+
const extensible = shared ? buffer?.growable : buffer?.resizable;
|
|
26958
|
+
return `ptr ${arrayPtr} + ${numBytes} bytes, heap view length ${heap?.length}, buffer ${kind} byteLength ${buffer?.byteLength}, extensible ${extensible}`;
|
|
26959
|
+
}
|
|
26960
|
+
function currentHeapBuffer(wasmModule) {
|
|
26961
|
+
const memory = wasmModule.wasmMemory;
|
|
26962
|
+
return memory !== void 0 ? memory.buffer : wasmModule.HEAPU8?.buffer;
|
|
26963
|
+
}
|
|
26964
|
+
function refreshHeapViews(wasmModule) {
|
|
26965
|
+
if (typeof wasmModule.updateMemoryViews === "function") {
|
|
26966
|
+
wasmModule.updateMemoryViews();
|
|
26967
|
+
return;
|
|
26968
|
+
}
|
|
26969
|
+
if (wasmModule.wasmMemory !== void 0) {
|
|
26970
|
+
return;
|
|
26971
|
+
}
|
|
26972
|
+
const StringVector = wasmModule.stringVector;
|
|
26973
|
+
if (StringVector === void 0) {
|
|
26974
|
+
return;
|
|
26975
|
+
}
|
|
26976
|
+
let scratch;
|
|
26977
|
+
releaseQuietly(() => {
|
|
26978
|
+
const created2 = new StringVector();
|
|
26979
|
+
scratch = created2;
|
|
26980
|
+
created2.push_back("");
|
|
26981
|
+
});
|
|
26982
|
+
const created = scratch;
|
|
26983
|
+
if (created !== void 0) {
|
|
26984
|
+
releaseQuietly(() => created.delete());
|
|
26985
|
+
}
|
|
26986
|
+
}
|
|
26987
|
+
function reconcileHeapBuffer(wasmModule, address, numBytes) {
|
|
26988
|
+
const buffer = currentHeapBuffer(wasmModule);
|
|
26989
|
+
if (buffer !== void 0 && address + numBytes <= buffer.byteLength) {
|
|
26990
|
+
return buffer;
|
|
26991
|
+
}
|
|
26992
|
+
refreshHeapViews(wasmModule);
|
|
26993
|
+
const refreshed = currentHeapBuffer(wasmModule);
|
|
26994
|
+
if (refreshed !== void 0 && address + numBytes <= refreshed.byteLength) {
|
|
26995
|
+
return refreshed;
|
|
26996
|
+
}
|
|
26997
|
+
throw new Error("wasm heap allocation lies outside the heap, and refreshing the module views did not reconcile it. " + describeHeap(wasmModule, address, numBytes));
|
|
26998
|
+
}
|
|
26999
|
+
function wasmHeapView(wasmModule, arrayType, pointer, elementCount) {
|
|
27000
|
+
const address = pointer >>> 0;
|
|
27001
|
+
const numBytes = elementCount * arrayType.BYTES_PER_ELEMENT;
|
|
27002
|
+
return new arrayType(reconcileHeapBuffer(wasmModule, address, numBytes), address, elementCount);
|
|
27003
|
+
}
|
|
27004
|
+
function arrayToWasmHeap(wasmModule, array) {
|
|
27005
|
+
const numBytes = array.length * array.BYTES_PER_ELEMENT;
|
|
27006
|
+
const arrayPtr = wasmModule._malloc(numBytes) >>> 0;
|
|
27007
|
+
if (arrayPtr === 0 && numBytes > 0) {
|
|
27008
|
+
throw new Error(`wasm _malloc returned an unusable address for ${numBytes} bytes - ` + describeHeap(wasmModule, arrayPtr, numBytes));
|
|
27009
|
+
}
|
|
27010
|
+
let destination;
|
|
27011
|
+
try {
|
|
27012
|
+
destination = wasmHeapView(wasmModule, Uint8Array, arrayPtr, numBytes);
|
|
27013
|
+
} catch (error) {
|
|
27014
|
+
releaseQuietly(() => wasmModule._free(arrayPtr));
|
|
27015
|
+
throw error;
|
|
27016
|
+
}
|
|
27017
|
+
destination.set(new Uint8Array(array.buffer, array.byteOffset, numBytes));
|
|
27018
|
+
return arrayPtr;
|
|
27019
|
+
}
|
|
27020
|
+
function arraysToWasmHeap(wasmModule, arrays) {
|
|
27021
|
+
const pointers = [];
|
|
27022
|
+
try {
|
|
27023
|
+
for (const array of arrays) {
|
|
27024
|
+
pointers.push(arrayToWasmHeap(wasmModule, array));
|
|
27025
|
+
}
|
|
27026
|
+
} catch (error) {
|
|
27027
|
+
for (const pointer of pointers) {
|
|
27028
|
+
releaseQuietly(() => wasmModule._free(pointer));
|
|
27029
|
+
}
|
|
27030
|
+
throw error;
|
|
27031
|
+
}
|
|
27032
|
+
return pointers;
|
|
27033
|
+
}
|
|
27034
|
+
function releaseQuietly(release) {
|
|
27035
|
+
try {
|
|
27036
|
+
release();
|
|
27037
|
+
} catch (error) {
|
|
27038
|
+
logger_default.debug(`wasm resource release failed during teardown: ${error instanceof Error ? error.message : error}`);
|
|
27039
|
+
}
|
|
27040
|
+
}
|
|
27041
|
+
function withRelease(body, release) {
|
|
27042
|
+
let result;
|
|
27043
|
+
try {
|
|
27044
|
+
result = body();
|
|
27045
|
+
} catch (error) {
|
|
27046
|
+
releaseQuietly(release);
|
|
27047
|
+
throw error;
|
|
27048
|
+
}
|
|
27049
|
+
release();
|
|
27050
|
+
return result;
|
|
27051
|
+
}
|
|
27052
|
+
function freeAll(wasmModule, pointers) {
|
|
27053
|
+
let firstFailure;
|
|
27054
|
+
for (const pointer of pointers) {
|
|
27055
|
+
try {
|
|
27056
|
+
wasmModule._free(pointer);
|
|
27057
|
+
} catch (error) {
|
|
27058
|
+
firstFailure ??= error;
|
|
27059
|
+
}
|
|
27060
|
+
}
|
|
27061
|
+
if (firstFailure !== void 0) {
|
|
27062
|
+
throw firstFailure;
|
|
27063
|
+
}
|
|
27064
|
+
}
|
|
27065
|
+
|
|
26951
27066
|
// compiled/src/step/step_entity_base.js
|
|
26952
27067
|
var IfcTokenType;
|
|
26953
27068
|
(function(IfcTokenType2) {
|
|
@@ -27383,8 +27498,9 @@ var StepEntityBase = class {
|
|
|
27383
27498
|
if (optional && stepExtractOptional(buffer, cursor, endCursor) === null) {
|
|
27384
27499
|
return false;
|
|
27385
27500
|
}
|
|
27386
|
-
const
|
|
27387
|
-
|
|
27501
|
+
const length = endCursor - cursor;
|
|
27502
|
+
const dataPtr = result.resize(length);
|
|
27503
|
+
wasmHeapView(module2, Uint8Array, dataPtr, length).set(buffer.subarray(cursor, endCursor));
|
|
27388
27504
|
return true;
|
|
27389
27505
|
}
|
|
27390
27506
|
/**
|
|
@@ -88642,83 +88758,15 @@ var IfcSceneBuilder = class {
|
|
|
88642
88758
|
}
|
|
88643
88759
|
};
|
|
88644
88760
|
|
|
88645
|
-
// compiled/src/core/wasm_heap.js
|
|
88646
|
-
function describeHeap(wasmModule, arrayPtr, numBytes) {
|
|
88647
|
-
const heap = wasmModule.HEAPU8;
|
|
88648
|
-
const buffer = heap?.buffer;
|
|
88649
|
-
const shared = typeof SharedArrayBuffer !== "undefined" && buffer instanceof SharedArrayBuffer;
|
|
88650
|
-
const kind = buffer === void 0 ? "none" : shared ? "SharedArrayBuffer" : "ArrayBuffer";
|
|
88651
|
-
const extensible = shared ? buffer?.growable : buffer?.resizable;
|
|
88652
|
-
return `ptr ${arrayPtr} + ${numBytes} bytes, heap view length ${heap?.length}, buffer ${kind} byteLength ${buffer?.byteLength}, extensible ${extensible}`;
|
|
88653
|
-
}
|
|
88654
|
-
function arrayToWasmHeap(wasmModule, array) {
|
|
88655
|
-
const numBytes = array.length * array.BYTES_PER_ELEMENT;
|
|
88656
|
-
const arrayPtr = wasmModule._malloc(numBytes) >>> 0;
|
|
88657
|
-
if (arrayPtr === 0 && numBytes > 0) {
|
|
88658
|
-
throw new Error(`wasm _malloc returned an unusable address for ${numBytes} bytes - ` + describeHeap(wasmModule, arrayPtr, numBytes));
|
|
88659
|
-
}
|
|
88660
|
-
const heapBuffer = wasmModule.HEAPU8.buffer;
|
|
88661
|
-
if (arrayPtr + numBytes > heapBuffer.byteLength) {
|
|
88662
|
-
const description = describeHeap(wasmModule, arrayPtr, numBytes);
|
|
88663
|
-
releaseQuietly(() => wasmModule._free(arrayPtr));
|
|
88664
|
-
throw new Error(`wasm heap allocation lies outside the heap view - the view is stale or the heap grew without it. ${description}`);
|
|
88665
|
-
}
|
|
88666
|
-
const destination = new Uint8Array(heapBuffer, arrayPtr, numBytes);
|
|
88667
|
-
destination.set(new Uint8Array(array.buffer, array.byteOffset, numBytes));
|
|
88668
|
-
return arrayPtr;
|
|
88669
|
-
}
|
|
88670
|
-
function arraysToWasmHeap(wasmModule, arrays) {
|
|
88671
|
-
const pointers = [];
|
|
88672
|
-
try {
|
|
88673
|
-
for (const array of arrays) {
|
|
88674
|
-
pointers.push(arrayToWasmHeap(wasmModule, array));
|
|
88675
|
-
}
|
|
88676
|
-
} catch (error) {
|
|
88677
|
-
for (const pointer of pointers) {
|
|
88678
|
-
releaseQuietly(() => wasmModule._free(pointer));
|
|
88679
|
-
}
|
|
88680
|
-
throw error;
|
|
88681
|
-
}
|
|
88682
|
-
return pointers;
|
|
88683
|
-
}
|
|
88684
|
-
function releaseQuietly(release) {
|
|
88685
|
-
try {
|
|
88686
|
-
release();
|
|
88687
|
-
} catch (error) {
|
|
88688
|
-
logger_default.debug(`wasm resource release failed during teardown: ${error instanceof Error ? error.message : error}`);
|
|
88689
|
-
}
|
|
88690
|
-
}
|
|
88691
|
-
function withRelease(body, release) {
|
|
88692
|
-
let result;
|
|
88693
|
-
try {
|
|
88694
|
-
result = body();
|
|
88695
|
-
} catch (error) {
|
|
88696
|
-
releaseQuietly(release);
|
|
88697
|
-
throw error;
|
|
88698
|
-
}
|
|
88699
|
-
release();
|
|
88700
|
-
return result;
|
|
88701
|
-
}
|
|
88702
|
-
function freeAll(wasmModule, pointers) {
|
|
88703
|
-
let firstFailure;
|
|
88704
|
-
for (const pointer of pointers) {
|
|
88705
|
-
try {
|
|
88706
|
-
wasmModule._free(pointer);
|
|
88707
|
-
} catch (error) {
|
|
88708
|
-
firstFailure ??= error;
|
|
88709
|
-
}
|
|
88710
|
-
}
|
|
88711
|
-
if (firstFailure !== void 0) {
|
|
88712
|
-
throw firstFailure;
|
|
88713
|
-
}
|
|
88714
|
-
}
|
|
88715
|
-
|
|
88716
88761
|
// compiled/src/ifc/ifc_parser_quirks.js
|
|
88717
88762
|
var MATERIAL_RELATED_OBJECTS_PERMISSIVE = true;
|
|
88718
88763
|
var REFLECTANCE_METHOD_PERMISSIVE = true;
|
|
88719
88764
|
|
|
88720
88765
|
// compiled/src/ifc/ifc_geometry_extraction.js
|
|
88721
88766
|
var DEFAULT_GEOMETRY_YIELD_INTERVAL_MS = 50;
|
|
88767
|
+
var GRID_INTERSECTION_AXIS_COUNT = 2;
|
|
88768
|
+
var GRID_INTERSECTION_Z_OFFSET = 2;
|
|
88769
|
+
var GRID_AXIS_PARALLEL_EPSILON = 1e-9;
|
|
88722
88770
|
function extractSpecularHighlight(from) {
|
|
88723
88771
|
if (from === null) {
|
|
88724
88772
|
return void 0;
|
|
@@ -91135,7 +91183,7 @@ var IfcGeometryExtraction = class _IfcGeometryExtraction {
|
|
|
91135
91183
|
pointer = this.wasmModule._malloc(numBytes);
|
|
91136
91184
|
capacity = maxPossibleFloats;
|
|
91137
91185
|
}
|
|
91138
|
-
const wasmFloat64View = this.wasmModule
|
|
91186
|
+
const wasmFloat64View = wasmHeapView(this.wasmModule, Float64Array, pointer, capacity);
|
|
91139
91187
|
let offset = 0;
|
|
91140
91188
|
let prevLocalID = -1;
|
|
91141
91189
|
for (let i = 0; i < points.length; i++) {
|
|
@@ -92322,6 +92370,225 @@ var IfcGeometryExtraction = class _IfcGeometryExtraction {
|
|
|
92322
92370
|
model.nullOnErrors = priorNullOnErrors;
|
|
92323
92371
|
}
|
|
92324
92372
|
}
|
|
92373
|
+
/**
|
|
92374
|
+
* Reduce a grid axis to an unbounded line in the plane of the grid's
|
|
92375
|
+
* placement: a point on it, and its tangent there.
|
|
92376
|
+
*
|
|
92377
|
+
* Only the straight axis curves are handled — an IfcLine, or the single
|
|
92378
|
+
* segment of a two-point IfcPolyline — which is what grid axes are in
|
|
92379
|
+
* practice. Anything else returns undefined after warning, so the
|
|
92380
|
+
* placement lands in errors.csv rather than being dropped in silence.
|
|
92381
|
+
*
|
|
92382
|
+
* `SameSense` is folded into the tangent because everything downstream is
|
|
92383
|
+
* measured from it: the offset in IfcVirtualGridIntersection is normal to
|
|
92384
|
+
* the tangent, and the tangent is also an IfcGridPlacement's default
|
|
92385
|
+
* x-axis, so a reversed axis offsets to the other side and points the
|
|
92386
|
+
* other way.
|
|
92387
|
+
*
|
|
92388
|
+
* @param axis The grid axis to reduce.
|
|
92389
|
+
* @return {{x, y, dx, dy} | undefined} A point and (unnormalised) tangent
|
|
92390
|
+
* in the grid's coordinate system, or undefined for an axis curve this
|
|
92391
|
+
* does not handle.
|
|
92392
|
+
*/
|
|
92393
|
+
static gridAxisLine(axis) {
|
|
92394
|
+
const curve = axis.AxisCurve;
|
|
92395
|
+
let x;
|
|
92396
|
+
let y;
|
|
92397
|
+
let dx;
|
|
92398
|
+
let dy;
|
|
92399
|
+
if (curve instanceof IfcPolyline) {
|
|
92400
|
+
const points = curve.Points;
|
|
92401
|
+
if (points.length !== 2) {
|
|
92402
|
+
logger_default.warning("IfcGridPlacement: grid axis IfcPolyline is not a single segment.", axis.expressID);
|
|
92403
|
+
return void 0;
|
|
92404
|
+
}
|
|
92405
|
+
const start = points[0].Coordinates;
|
|
92406
|
+
const end = points[1].Coordinates;
|
|
92407
|
+
x = start[0];
|
|
92408
|
+
y = start[1];
|
|
92409
|
+
dx = end[0] - start[0];
|
|
92410
|
+
dy = end[1] - start[1];
|
|
92411
|
+
} else if (curve instanceof IfcLine) {
|
|
92412
|
+
const origin = curve.Pnt.Coordinates;
|
|
92413
|
+
const direction = curve.Dir.Orientation.DirectionRatios;
|
|
92414
|
+
x = origin[0];
|
|
92415
|
+
y = origin[1];
|
|
92416
|
+
dx = direction[0];
|
|
92417
|
+
dy = direction[1];
|
|
92418
|
+
} else {
|
|
92419
|
+
logger_default.warning(`IfcGridPlacement: unsupported grid axis curve, type: ${entity_types_ifc_gen_default[curve.type]}`, axis.expressID);
|
|
92420
|
+
return void 0;
|
|
92421
|
+
}
|
|
92422
|
+
if (!axis.SameSense) {
|
|
92423
|
+
dx = -dx;
|
|
92424
|
+
dy = -dy;
|
|
92425
|
+
}
|
|
92426
|
+
return { x, y, dx, dy };
|
|
92427
|
+
}
|
|
92428
|
+
/**
|
|
92429
|
+
* Resolve an IfcVirtualGridIntersection to a point in the coordinate system
|
|
92430
|
+
* of the IfcGrid that owns its axes, along with the tangent of its first
|
|
92431
|
+
* axis — which is the default x-axis of an IfcGridPlacement located here.
|
|
92432
|
+
*
|
|
92433
|
+
* Per IFC4 each axis is replaced by its offset curve before intersecting:
|
|
92434
|
+
* OffsetDistances[n] is measured from axis n normal to its tangent,
|
|
92435
|
+
* positive towards the tangent turned a quarter turn anti-clockwise. Both
|
|
92436
|
+
* axes here are straight, so their offset curves are parallel to them and
|
|
92437
|
+
* the tangents are unchanged. A third offset, when the file gives one,
|
|
92438
|
+
* displaces the result along the grid placement's z axis.
|
|
92439
|
+
*
|
|
92440
|
+
* @param from The intersection to resolve.
|
|
92441
|
+
* @return {{position, tangent} | undefined} The intersection point and the
|
|
92442
|
+
* first axis' unit tangent, or undefined when the axes cannot be reduced to
|
|
92443
|
+
* two lines that meet (warned at the point of failure).
|
|
92444
|
+
*/
|
|
92445
|
+
resolveVirtualGridIntersection(from) {
|
|
92446
|
+
const axes = from.IntersectingAxes;
|
|
92447
|
+
if (axes.length < GRID_INTERSECTION_AXIS_COUNT) {
|
|
92448
|
+
logger_default.warning("IfcGridPlacement: virtual grid intersection has fewer than two axes.", from.expressID);
|
|
92449
|
+
return void 0;
|
|
92450
|
+
}
|
|
92451
|
+
const line0 = _IfcGeometryExtraction.gridAxisLine(axes[0]);
|
|
92452
|
+
const line1 = _IfcGeometryExtraction.gridAxisLine(axes[1]);
|
|
92453
|
+
if (line0 === void 0 || line1 === void 0) {
|
|
92454
|
+
return void 0;
|
|
92455
|
+
}
|
|
92456
|
+
const length0 = Math.sqrt(line0.dx * line0.dx + line0.dy * line0.dy);
|
|
92457
|
+
const length1 = Math.sqrt(line1.dx * line1.dx + line1.dy * line1.dy);
|
|
92458
|
+
const cross = line0.dx * line1.dy - line0.dy * line1.dx;
|
|
92459
|
+
if (Math.abs(cross) <= GRID_AXIS_PARALLEL_EPSILON * length0 * length1) {
|
|
92460
|
+
logger_default.warning("IfcGridPlacement: intersecting grid axes are parallel or degenerate.", from.expressID);
|
|
92461
|
+
return void 0;
|
|
92462
|
+
}
|
|
92463
|
+
const offsets = from.OffsetDistances;
|
|
92464
|
+
const offset0 = offsets[0] ?? 0;
|
|
92465
|
+
const offset1 = offsets[1] ?? 0;
|
|
92466
|
+
const x0 = line0.x - offset0 * line0.dy / length0;
|
|
92467
|
+
const y0 = line0.y + offset0 * line0.dx / length0;
|
|
92468
|
+
const x1 = line1.x - offset1 * line1.dy / length1;
|
|
92469
|
+
const y1 = line1.y + offset1 * line1.dx / length1;
|
|
92470
|
+
const t = ((x1 - x0) * line1.dy - (y1 - y0) * line1.dx) / cross;
|
|
92471
|
+
return {
|
|
92472
|
+
position: {
|
|
92473
|
+
x: x0 + t * line0.dx,
|
|
92474
|
+
y: y0 + t * line0.dy,
|
|
92475
|
+
z: offsets[GRID_INTERSECTION_Z_OFFSET] ?? 0
|
|
92476
|
+
},
|
|
92477
|
+
tangent: { x: line0.dx / length0, y: line0.dy / length0 }
|
|
92478
|
+
};
|
|
92479
|
+
}
|
|
92480
|
+
/**
|
|
92481
|
+
* The IfcGrid that lists a given axis, or undefined if no grid does.
|
|
92482
|
+
*
|
|
92483
|
+
* IfcGridAxis's route back to its grid is the PartOfU/PartOfV/PartOfW
|
|
92484
|
+
* inverse attributes, and the generated schema layer carries no inverses,
|
|
92485
|
+
* so this is a scan of every IfcGrid's axis lists, memoised. It is built on
|
|
92486
|
+
* the first grid placement extracted and never at all for a model without
|
|
92487
|
+
* one.
|
|
92488
|
+
*
|
|
92489
|
+
* @param axis The axis to look up.
|
|
92490
|
+
* @return {IfcGrid | undefined} The grid listing the axis.
|
|
92491
|
+
*/
|
|
92492
|
+
gridByAxis(axis) {
|
|
92493
|
+
let gridByAxis = this.gridByAxis_;
|
|
92494
|
+
if (gridByAxis === void 0) {
|
|
92495
|
+
gridByAxis = /* @__PURE__ */ new Map();
|
|
92496
|
+
for (const grid of this.model.types(IfcGrid)) {
|
|
92497
|
+
for (const gridAxis of grid.UAxes) {
|
|
92498
|
+
gridByAxis.set(gridAxis.localID, grid);
|
|
92499
|
+
}
|
|
92500
|
+
for (const gridAxis of grid.VAxes) {
|
|
92501
|
+
gridByAxis.set(gridAxis.localID, grid);
|
|
92502
|
+
}
|
|
92503
|
+
for (const gridAxis of grid.WAxes ?? []) {
|
|
92504
|
+
gridByAxis.set(gridAxis.localID, grid);
|
|
92505
|
+
}
|
|
92506
|
+
}
|
|
92507
|
+
this.gridByAxis_ = gridByAxis;
|
|
92508
|
+
}
|
|
92509
|
+
return gridByAxis.get(axis.localID);
|
|
92510
|
+
}
|
|
92511
|
+
/**
|
|
92512
|
+
* Extract an IfcGridPlacement, registering a transform against its local ID
|
|
92513
|
+
* the same way the IfcLocalPlacement arm does — same scene, same
|
|
92514
|
+
* memoisation, same composition onto the current parent.
|
|
92515
|
+
*
|
|
92516
|
+
* The origin is the virtual intersection of two grid axes and the x-axis
|
|
92517
|
+
* comes from PlacementRefDirection (defaulting to the first axis' tangent),
|
|
92518
|
+
* both expressed in the coordinate system of the IfcGrid that owns the
|
|
92519
|
+
* axes. IfcGridPlacement has no PlacementRelTo of its own in IFC4, so that
|
|
92520
|
+
* grid's object placement IS the parent: extracting it first leaves it as
|
|
92521
|
+
* the scene's current transform, which `addTransform` then composes onto.
|
|
92522
|
+
*
|
|
92523
|
+
* @param from The grid placement to extract.
|
|
92524
|
+
* @param isRelVoid Whether this placement is being resolved into the void
|
|
92525
|
+
* scene rather than the main one.
|
|
92526
|
+
*/
|
|
92527
|
+
extractGridPlacement(from, isRelVoid) {
|
|
92528
|
+
const placementLocation = from.PlacementLocation;
|
|
92529
|
+
const location = this.resolveVirtualGridIntersection(placementLocation);
|
|
92530
|
+
if (location === void 0) {
|
|
92531
|
+
return;
|
|
92532
|
+
}
|
|
92533
|
+
let xAxisRef = { x: location.tangent.x, y: location.tangent.y, z: 0 };
|
|
92534
|
+
const refDirection = from.PlacementRefDirection;
|
|
92535
|
+
if (refDirection instanceof IfcDirection) {
|
|
92536
|
+
const ratios = refDirection.DirectionRatios;
|
|
92537
|
+
xAxisRef = { x: ratios[0], y: ratios[1], z: ratios[2] ?? 0 };
|
|
92538
|
+
} else if (refDirection instanceof IfcVirtualGridIntersection) {
|
|
92539
|
+
const reference = this.resolveVirtualGridIntersection(refDirection);
|
|
92540
|
+
if (reference !== void 0) {
|
|
92541
|
+
xAxisRef = {
|
|
92542
|
+
x: reference.position.x - location.position.x,
|
|
92543
|
+
y: reference.position.y - location.position.y,
|
|
92544
|
+
z: reference.position.z - location.position.z
|
|
92545
|
+
};
|
|
92546
|
+
}
|
|
92547
|
+
}
|
|
92548
|
+
const xAxisRefPlanar = Math.sqrt(xAxisRef.x * xAxisRef.x + xAxisRef.y * xAxisRef.y);
|
|
92549
|
+
const xAxisRefLength = Math.sqrt(xAxisRefPlanar * xAxisRefPlanar + xAxisRef.z * xAxisRef.z);
|
|
92550
|
+
if (xAxisRefPlanar <= GRID_AXIS_PARALLEL_EPSILON * xAxisRefLength) {
|
|
92551
|
+
logger_default.warning("IfcGridPlacement: the placement reference direction is parallel to the grid placement's z axis, or has no length - falling back to the schema default, the first axis' tangent.", from.expressID);
|
|
92552
|
+
xAxisRef = { x: location.tangent.x, y: location.tangent.y, z: 0 };
|
|
92553
|
+
}
|
|
92554
|
+
let grid;
|
|
92555
|
+
let gridScanned = false;
|
|
92556
|
+
try {
|
|
92557
|
+
grid = this.gridByAxis(placementLocation.IntersectingAxes[0]);
|
|
92558
|
+
gridScanned = true;
|
|
92559
|
+
} catch (error) {
|
|
92560
|
+
if (!(error instanceof StepBufferNotResidentError)) {
|
|
92561
|
+
throw error;
|
|
92562
|
+
}
|
|
92563
|
+
logger_default.warning("IfcGridPlacement: grid records are not resident on this windowed source - placing at the grid intersection in the current frame, without the grid's own placement.", from.expressID);
|
|
92564
|
+
}
|
|
92565
|
+
if (gridScanned && grid === void 0) {
|
|
92566
|
+
logger_default.warning("IfcGridPlacement: no IfcGrid lists the axes of this placement.", from.expressID);
|
|
92567
|
+
} else if (grid !== void 0) {
|
|
92568
|
+
try {
|
|
92569
|
+
const gridPlacement = grid.ObjectPlacement;
|
|
92570
|
+
if (gridPlacement !== null) {
|
|
92571
|
+
this.extractPlacement(gridPlacement, isRelVoid);
|
|
92572
|
+
}
|
|
92573
|
+
} catch (error) {
|
|
92574
|
+
if (!(error instanceof StepBufferNotResidentError)) {
|
|
92575
|
+
throw error;
|
|
92576
|
+
}
|
|
92577
|
+
logger_default.warning("IfcGridPlacement: the grid's own placement chain is not fully resident on this windowed source - it was applied as far as it reads, so this placement composes onto a partial frame.", from.expressID);
|
|
92578
|
+
}
|
|
92579
|
+
}
|
|
92580
|
+
const placementTransform = this.conwayModel.getAxis2Placement3D({
|
|
92581
|
+
position: location.position,
|
|
92582
|
+
// A grid is planar in its own placement, so this placement's z axis is
|
|
92583
|
+
// the grid's z axis; only the x axis is steered here.
|
|
92584
|
+
zAxisRef: { x: 0, y: 0, z: 1 },
|
|
92585
|
+
xAxisRef,
|
|
92586
|
+
normalizeZ: false,
|
|
92587
|
+
normalizeX: true
|
|
92588
|
+
});
|
|
92589
|
+
const scene = isRelVoid ? this.voidScene : this.scene;
|
|
92590
|
+
scene.addTransform(from.localID, placementTransform.getValues(), placementTransform);
|
|
92591
|
+
}
|
|
92325
92592
|
/**
|
|
92326
92593
|
*
|
|
92327
92594
|
* @param from
|
|
@@ -92356,6 +92623,7 @@ var IfcGeometryExtraction = class _IfcGeometryExtraction {
|
|
|
92356
92623
|
}
|
|
92357
92624
|
}
|
|
92358
92625
|
} else if (from instanceof IfcGridPlacement) {
|
|
92626
|
+
this.extractGridPlacement(from, isRelVoid);
|
|
92359
92627
|
}
|
|
92360
92628
|
}
|
|
92361
92629
|
/**
|