@bldrs-ai/conway 1.445.1339 → 1.448.1345

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.
@@ -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.445.1339";
33
+ var versionString = "Conway v1.448.1345";
34
34
 
35
35
  // compiled/dependencies/conway-geom/interface/conway_geometry.js
36
36
  var wasmType = "";
@@ -4684,6 +4684,28 @@ var StepVtableBuilder = class {
4684
4684
  }
4685
4685
  };
4686
4686
 
4687
+ // compiled/src/step/parsing/uint32_sink.js
4688
+ function extractIntegerArrayAt(buffer, cursor, endCursor, sink) {
4689
+ if (stepExtractOptional(buffer, cursor, endCursor) === null) {
4690
+ return 0;
4691
+ }
4692
+ let count = 0;
4693
+ let signedCursor0 = stepExtractArrayBegin(buffer, cursor, endCursor);
4694
+ let readCursor = Math.abs(signedCursor0);
4695
+ while (signedCursor0 >= 0) {
4696
+ const value = stepExtractNumber(buffer, readCursor, endCursor);
4697
+ if (value === void 0) {
4698
+ throw new Error("Value in STEP was incorrectly typed");
4699
+ }
4700
+ readCursor = skipValue(buffer, readCursor, endCursor);
4701
+ sink.push(value);
4702
+ ++count;
4703
+ signedCursor0 = stepExtractArrayToken(buffer, readCursor, endCursor);
4704
+ readCursor = Math.abs(signedCursor0);
4705
+ }
4706
+ return count;
4707
+ }
4708
+
4687
4709
  // compiled/src/indexing/index_set_constants.js
4688
4710
  var IndexSetConstants = class {
4689
4711
  };
@@ -5240,6 +5262,48 @@ var StepModelBase = class {
5240
5262
  * @param element The raw elment to populate the vtable entry for.
5241
5263
  * @return {boolean} Did the vtable entry populate correctly?
5242
5264
  */
5265
+ /**
5266
+ * Append a referenced record's unsigned-integer list field into `sink`
5267
+ * without materialising the referenced entity.
5268
+ *
5269
+ * This is the reference-level twin of
5270
+ * `StepEntityBase.extractIntegerArrayInto`, for hot loops that walk
5271
+ * millions of small records (tessellated facesets) where constructing
5272
+ * an entity per record dominates. It deliberately handles only the
5273
+ * simple case and reports failure otherwise, so callers keep a
5274
+ * correct fallback rather than this growing subtle special cases:
5275
+ * the reference must resolve, be single-class (no multi-mapping),
5276
+ * and be exactly `expectedTypeID` — which is what makes reading
5277
+ * `offset` as a plain vtable slot equivalent to the generated
5278
+ * getter's `getOffsetCursor( offset, _, _ )` (that only subtracts a
5279
+ * base offset for multi-mapped records).
5280
+ *
5281
+ * @param expressID The referenced record's express ID.
5282
+ * @param offset The field's vtable offset within the record.
5283
+ * @param expectedTypeID The type the record must be.
5284
+ * @param sink Receives the appended values.
5285
+ * @return {number | undefined} Count appended, or undefined when the
5286
+ * fast path does not apply and the caller must fall back.
5287
+ */
5288
+ extractIntegerArrayByExpressIDInto(expressID, offset, expectedTypeID, sink) {
5289
+ const localID = this.expressIDMap_.get(expressID);
5290
+ if (localID === void 0 || localID >= this.count_) {
5291
+ return void 0;
5292
+ }
5293
+ const element = this.entry(localID);
5294
+ if (element.multiMapping !== void 0 || element.typeID !== expectedTypeID) {
5295
+ return void 0;
5296
+ }
5297
+ if (element.vtableIndex === void 0 && !this.populateVtableEntryRaw(element)) {
5298
+ return void 0;
5299
+ }
5300
+ const vtable = element.vtable;
5301
+ const buffer = element.buffer;
5302
+ if (vtable === void 0 || buffer === void 0 || offset >= (element.vtableCount ?? 0)) {
5303
+ return void 0;
5304
+ }
5305
+ return extractIntegerArrayAt(buffer, vtable[element.vtableIndex + offset], buffer.length, sink);
5306
+ }
5243
5307
  populateVtableEntryRaw(element) {
5244
5308
  if (element.vtableIndex !== void 0 || element.typeID === 0) {
5245
5309
  return true;
@@ -10780,28 +10844,48 @@ var StepEntityBase = class {
10780
10844
  * @return {number} How many values were appended (0 when the field is
10781
10845
  * unset/optional-null).
10782
10846
  */
10783
- extractIntegerArrayInto(offset, baseOffset, depth, sink) {
10847
+ /**
10848
+ * Walk a reference-list field, handing each element's express ID to
10849
+ * `onReference` without resolving it to an entity.
10850
+ *
10851
+ * Lets hot loops decide per element how to read the referenced record
10852
+ * (see StepModelBase.extractIntegerArrayByExpressIDInto) instead of
10853
+ * paying for an entity per element the way the generated list getters
10854
+ * do. Inline (non-reference) elements yield `undefined`, and
10855
+ * `onReference` returning false aborts the walk — together those let
10856
+ * a caller bail out to the generated getter for anything it is not
10857
+ * prepared to handle.
10858
+ *
10859
+ * @param offset The offset in the vtable to extract from.
10860
+ * @param baseOffset The base offset of the class in the vtable.
10861
+ * @param depth The depth in the inheritance hierarchy.
10862
+ * @param onReference Receives each element's express ID, or undefined
10863
+ * for an inline element; return false to abort.
10864
+ * @return {boolean} False if the walk was aborted, true otherwise.
10865
+ */
10866
+ forEachReferenceInField(offset, baseOffset, depth, onReference) {
10784
10867
  let cursor = this.getOffsetCursor(offset, baseOffset, depth);
10785
10868
  const buffer = this.buffer;
10786
10869
  const endCursor = buffer.length;
10787
10870
  if (stepExtractOptional(buffer, cursor, endCursor) === null) {
10788
- return 0;
10871
+ return true;
10789
10872
  }
10790
- let count = 0;
10791
10873
  let signedCursor0 = stepExtractArrayBegin(buffer, cursor, endCursor);
10792
10874
  cursor = Math.abs(signedCursor0);
10793
10875
  while (signedCursor0 >= 0) {
10794
- const value = stepExtractNumber(buffer, cursor, endCursor);
10795
- if (value === void 0) {
10796
- throw new Error("Value in STEP was incorrectly typed");
10876
+ if (!onReference(stepExtractReference(buffer, cursor, endCursor))) {
10877
+ return false;
10797
10878
  }
10798
10879
  cursor = skipValue(buffer, cursor, endCursor);
10799
- sink.push(value);
10800
- ++count;
10801
10880
  signedCursor0 = stepExtractArrayToken(buffer, cursor, endCursor);
10802
10881
  cursor = Math.abs(signedCursor0);
10803
10882
  }
10804
- return count;
10883
+ return true;
10884
+ }
10885
+ extractIntegerArrayInto(offset, baseOffset, depth, sink) {
10886
+ const cursor = this.getOffsetCursor(offset, baseOffset, depth);
10887
+ const buffer = this.buffer;
10888
+ return extractIntegerArrayAt(buffer, cursor, buffer.length, sink);
10805
10889
  }
10806
10890
  /**
10807
10891
  * Extract a number at the particular vtable offset (i.e. the position
@@ -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.445.1339";
14968
+ var versionString = "Conway v1.448.1345";
14969
14969
 
14970
14970
  // compiled/dependencies/conway-geom/interface/conway_geometry.js
14971
14971
  function pThreadsAllowed() {
@@ -20498,6 +20498,67 @@ var StepVtableBuilder = class {
20498
20498
  }
20499
20499
  };
20500
20500
 
20501
+ // compiled/src/step/parsing/uint32_sink.js
20502
+ var Uint32Sink = class {
20503
+ /**
20504
+ * @param initialCapacity Initial element capacity.
20505
+ */
20506
+ constructor(initialCapacity = 1024) {
20507
+ this.length_ = 0;
20508
+ this.data_ = new Uint32Array(Math.max(1, initialCapacity));
20509
+ }
20510
+ /** @return {number} Element count appended since the last reset. */
20511
+ get length() {
20512
+ return this.length_;
20513
+ }
20514
+ /**
20515
+ * A view of exactly the appended elements. Only valid until the next
20516
+ * append (which may reallocate) — copy it if it must outlive that.
20517
+ *
20518
+ * @return {Uint32Array} View over [0, length).
20519
+ */
20520
+ get view() {
20521
+ return this.data_.subarray(0, this.length_);
20522
+ }
20523
+ /** Drop all appended elements, keeping the allocated capacity. */
20524
+ reset() {
20525
+ this.length_ = 0;
20526
+ }
20527
+ /**
20528
+ * Append one value, growing geometrically when full.
20529
+ *
20530
+ * @param value The value to append.
20531
+ */
20532
+ push(value) {
20533
+ if (this.length_ === this.data_.length) {
20534
+ const grown = new Uint32Array(this.data_.length * 2);
20535
+ grown.set(this.data_);
20536
+ this.data_ = grown;
20537
+ }
20538
+ this.data_[this.length_++] = value;
20539
+ }
20540
+ };
20541
+ function extractIntegerArrayAt(buffer, cursor, endCursor, sink) {
20542
+ if (stepExtractOptional(buffer, cursor, endCursor) === null) {
20543
+ return 0;
20544
+ }
20545
+ let count = 0;
20546
+ let signedCursor0 = stepExtractArrayBegin(buffer, cursor, endCursor);
20547
+ let readCursor = Math.abs(signedCursor0);
20548
+ while (signedCursor0 >= 0) {
20549
+ const value = stepExtractNumber(buffer, readCursor, endCursor);
20550
+ if (value === void 0) {
20551
+ throw new Error("Value in STEP was incorrectly typed");
20552
+ }
20553
+ readCursor = skipValue(buffer, readCursor, endCursor);
20554
+ sink.push(value);
20555
+ ++count;
20556
+ signedCursor0 = stepExtractArrayToken(buffer, readCursor, endCursor);
20557
+ readCursor = Math.abs(signedCursor0);
20558
+ }
20559
+ return count;
20560
+ }
20561
+
20501
20562
  // compiled/src/indexing/index_set_constants.js
20502
20563
  var IndexSetConstants = class {
20503
20564
  };
@@ -21054,6 +21115,48 @@ var StepModelBase = class {
21054
21115
  * @param element The raw elment to populate the vtable entry for.
21055
21116
  * @return {boolean} Did the vtable entry populate correctly?
21056
21117
  */
21118
+ /**
21119
+ * Append a referenced record's unsigned-integer list field into `sink`
21120
+ * without materialising the referenced entity.
21121
+ *
21122
+ * This is the reference-level twin of
21123
+ * `StepEntityBase.extractIntegerArrayInto`, for hot loops that walk
21124
+ * millions of small records (tessellated facesets) where constructing
21125
+ * an entity per record dominates. It deliberately handles only the
21126
+ * simple case and reports failure otherwise, so callers keep a
21127
+ * correct fallback rather than this growing subtle special cases:
21128
+ * the reference must resolve, be single-class (no multi-mapping),
21129
+ * and be exactly `expectedTypeID` — which is what makes reading
21130
+ * `offset` as a plain vtable slot equivalent to the generated
21131
+ * getter's `getOffsetCursor( offset, _, _ )` (that only subtracts a
21132
+ * base offset for multi-mapped records).
21133
+ *
21134
+ * @param expressID The referenced record's express ID.
21135
+ * @param offset The field's vtable offset within the record.
21136
+ * @param expectedTypeID The type the record must be.
21137
+ * @param sink Receives the appended values.
21138
+ * @return {number | undefined} Count appended, or undefined when the
21139
+ * fast path does not apply and the caller must fall back.
21140
+ */
21141
+ extractIntegerArrayByExpressIDInto(expressID, offset, expectedTypeID, sink) {
21142
+ const localID = this.expressIDMap_.get(expressID);
21143
+ if (localID === void 0 || localID >= this.count_) {
21144
+ return void 0;
21145
+ }
21146
+ const element = this.entry(localID);
21147
+ if (element.multiMapping !== void 0 || element.typeID !== expectedTypeID) {
21148
+ return void 0;
21149
+ }
21150
+ if (element.vtableIndex === void 0 && !this.populateVtableEntryRaw(element)) {
21151
+ return void 0;
21152
+ }
21153
+ const vtable = element.vtable;
21154
+ const buffer = element.buffer;
21155
+ if (vtable === void 0 || buffer === void 0 || offset >= (element.vtableCount ?? 0)) {
21156
+ return void 0;
21157
+ }
21158
+ return extractIntegerArrayAt(buffer, vtable[element.vtableIndex + offset], buffer.length, sink);
21159
+ }
21057
21160
  populateVtableEntryRaw(element) {
21058
21161
  if (element.vtableIndex !== void 0 || element.typeID === 0) {
21059
21162
  return true;
@@ -26594,28 +26697,48 @@ var StepEntityBase = class {
26594
26697
  * @return {number} How many values were appended (0 when the field is
26595
26698
  * unset/optional-null).
26596
26699
  */
26597
- extractIntegerArrayInto(offset, baseOffset, depth, sink) {
26700
+ /**
26701
+ * Walk a reference-list field, handing each element's express ID to
26702
+ * `onReference` without resolving it to an entity.
26703
+ *
26704
+ * Lets hot loops decide per element how to read the referenced record
26705
+ * (see StepModelBase.extractIntegerArrayByExpressIDInto) instead of
26706
+ * paying for an entity per element the way the generated list getters
26707
+ * do. Inline (non-reference) elements yield `undefined`, and
26708
+ * `onReference` returning false aborts the walk — together those let
26709
+ * a caller bail out to the generated getter for anything it is not
26710
+ * prepared to handle.
26711
+ *
26712
+ * @param offset The offset in the vtable to extract from.
26713
+ * @param baseOffset The base offset of the class in the vtable.
26714
+ * @param depth The depth in the inheritance hierarchy.
26715
+ * @param onReference Receives each element's express ID, or undefined
26716
+ * for an inline element; return false to abort.
26717
+ * @return {boolean} False if the walk was aborted, true otherwise.
26718
+ */
26719
+ forEachReferenceInField(offset, baseOffset, depth, onReference) {
26598
26720
  let cursor = this.getOffsetCursor(offset, baseOffset, depth);
26599
26721
  const buffer = this.buffer;
26600
26722
  const endCursor = buffer.length;
26601
26723
  if (stepExtractOptional(buffer, cursor, endCursor) === null) {
26602
- return 0;
26724
+ return true;
26603
26725
  }
26604
- let count = 0;
26605
26726
  let signedCursor0 = stepExtractArrayBegin(buffer, cursor, endCursor);
26606
26727
  cursor = Math.abs(signedCursor0);
26607
26728
  while (signedCursor0 >= 0) {
26608
- const value = stepExtractNumber(buffer, cursor, endCursor);
26609
- if (value === void 0) {
26610
- throw new Error("Value in STEP was incorrectly typed");
26729
+ if (!onReference(stepExtractReference(buffer, cursor, endCursor))) {
26730
+ return false;
26611
26731
  }
26612
26732
  cursor = skipValue(buffer, cursor, endCursor);
26613
- sink.push(value);
26614
- ++count;
26615
26733
  signedCursor0 = stepExtractArrayToken(buffer, cursor, endCursor);
26616
26734
  cursor = Math.abs(signedCursor0);
26617
26735
  }
26618
- return count;
26736
+ return true;
26737
+ }
26738
+ extractIntegerArrayInto(offset, baseOffset, depth, sink) {
26739
+ const cursor = this.getOffsetCursor(offset, baseOffset, depth);
26740
+ const buffer = this.buffer;
26741
+ return extractIntegerArrayAt(buffer, cursor, buffer.length, sink);
26619
26742
  }
26620
26743
  /**
26621
26744
  * Extract a number at the particular vtable offset (i.e. the position
@@ -87166,47 +87289,6 @@ var yargs_default = Yargs;
87166
87289
  // compiled/src/ifc/ifc_command_line_main.js
87167
87290
  var import_fs = __toESM(require("fs"), 1);
87168
87291
 
87169
- // compiled/src/step/parsing/uint32_sink.js
87170
- var Uint32Sink = class {
87171
- /**
87172
- * @param initialCapacity Initial element capacity.
87173
- */
87174
- constructor(initialCapacity = 1024) {
87175
- this.length_ = 0;
87176
- this.data_ = new Uint32Array(Math.max(1, initialCapacity));
87177
- }
87178
- /** @return {number} Element count appended since the last reset. */
87179
- get length() {
87180
- return this.length_;
87181
- }
87182
- /**
87183
- * A view of exactly the appended elements. Only valid until the next
87184
- * append (which may reallocate) — copy it if it must outlive that.
87185
- *
87186
- * @return {Uint32Array} View over [0, length).
87187
- */
87188
- get view() {
87189
- return this.data_.subarray(0, this.length_);
87190
- }
87191
- /** Drop all appended elements, keeping the allocated capacity. */
87192
- reset() {
87193
- this.length_ = 0;
87194
- }
87195
- /**
87196
- * Append one value, growing geometrically when full.
87197
- *
87198
- * @param value The value to append.
87199
- */
87200
- push(value) {
87201
- if (this.length_ === this.data_.length) {
87202
- const grown = new Uint32Array(this.data_.length * 2);
87203
- grown.set(this.data_);
87204
- this.data_ = grown;
87205
- }
87206
- this.data_[this.length_++] = value;
87207
- }
87208
- };
87209
-
87210
87292
  // compiled/src/core/native_pool.js
87211
87293
  var ObjectPool = class {
87212
87294
  /**
@@ -87787,6 +87869,10 @@ function extractColorOrFactorMultiply(from, surfaceColor, alpha = 1) {
87787
87869
  ];
87788
87870
  }
87789
87871
  }
87872
+ var FACES_FIELD_OFFSET = 2;
87873
+ var FACES_FIELD_BASE_OFFSET = 1;
87874
+ var FACES_FIELD_DEPTH = 4;
87875
+ var COORD_INDEX_FIELD_OFFSET = 0;
87790
87876
  var POLYGONAL_INDEX_SINK_CAPACITY = 65536;
87791
87877
  var POLYGONAL_FACE_SINK_CAPACITY = 16384;
87792
87878
  var IfcGeometryExtraction = class _IfcGeometryExtraction {
@@ -88173,49 +88259,21 @@ var IfcGeometryExtraction = class _IfcGeometryExtraction {
88173
88259
  }
88174
88260
  }
88175
88261
  /**
88176
- * @param entity
88177
- * @param temporary
88178
- * @param isRelVoid
88179
- * @return {ExtractResult}
88180
- */
88181
- extractPolygonalFaceSet(entity, temporary = false, isRelVoid = false) {
88182
- const result = ExtractResult.COMPLETE;
88183
- if (this.polygonalSinksInUse_) {
88184
- throw new Error("extractPolygonalFaceSet re-entered: the shared index sinks are already in use");
88185
- }
88186
- this.polygonalSinksInUse_ = true;
88187
- const allIndices = this.polygonalIndexSink_;
88188
- const allStartIndices = this.polygonalStartIndexSink_;
88189
- const polygonalFaceBufferOffsets = this.polygonalFaceOffsetSink_;
88190
- const startIndicesBufferOffsets = this.polygonalStartOffsetSink_;
88191
- allIndices.reset();
88192
- allStartIndices.reset();
88193
- polygonalFaceBufferOffsets.reset();
88194
- startIndicesBufferOffsets.reset();
88195
- let indicesPerFace = -1;
88196
- entity.Faces.forEach((polygonalFace) => {
88197
- polygonalFaceBufferOffsets.push(allIndices.length);
88198
- startIndicesBufferOffsets.push(allStartIndices.length);
88199
- let coordIndex = 0;
88200
- if (polygonalFace instanceof IfcIndexedPolygonalFaceWithVoids) {
88201
- indicesPerFace = polygonalFace.CoordIndex.length;
88202
- allStartIndices.push(0);
88203
- coordIndex += indicesPerFace;
88204
- for (const index of polygonalFace.CoordIndex) {
88205
- allIndices.push(index);
88206
- }
88207
- polygonalFace.InnerCoordIndices.forEach((innerIndices) => {
88208
- allStartIndices.push(coordIndex);
88209
- for (const index of innerIndices) {
88210
- allIndices.push(index);
88211
- }
88212
- coordIndex += innerIndices.length;
88213
- });
88214
- } else {
88215
- indicesPerFace = polygonalFace.extractIntegerArrayInto(0, 0, 3, allIndices);
88216
- allStartIndices.push(0);
88217
- }
88218
- });
88262
+ * Hand a faceset's accumulated indices to wasm and register the
88263
+ * resulting mesh. Shared by the fast reference-level path and the
88264
+ * generated-getter fallback so they cannot diverge.
88265
+ *
88266
+ * @param entity The faceset.
88267
+ * @param temporary Is this a temporary (preview//operand) extraction?
88268
+ * @param isRelVoid Is this geometry a rel-void operand?
88269
+ * @param indicesPerFace Index count of the last face processed.
88270
+ * @param allIndices Face indices, concatenated.
88271
+ * @param allStartIndices Per-face start indices.
88272
+ * @param polygonalFaceBufferOffsets Per-face offsets into allIndices.
88273
+ * @param startIndicesBufferOffsets Per-face offsets into allStartIndices.
88274
+ * @return {ExtractResult} The extraction result.
88275
+ */
88276
+ finishPolygonalFaceSet_(entity, temporary, isRelVoid, indicesPerFace, allIndices, allStartIndices, polygonalFaceBufferOffsets, startIndicesBufferOffsets) {
88219
88277
  polygonalFaceBufferOffsets.push(allIndices.length);
88220
88278
  startIndicesBufferOffsets.push(allStartIndices.length);
88221
88279
  const indicesArray = allIndices.view;
@@ -88227,7 +88285,6 @@ var IfcGeometryExtraction = class _IfcGeometryExtraction {
88227
88285
  const startIndicesBufferOffsetsArray = startIndicesBufferOffsets.view;
88228
88286
  const startIndicesBufferOffsetsArrayPtr = this.arrayToWasmHeap(startIndicesBufferOffsetsArray);
88229
88287
  const polygonalFaceVector = this.wasmModule.buildIndexedPolygonalFaceVector(indicesArrayPtr, indicesArray.length, startIndicesArrayPtr, polygonalFaceBufferOffsetsArrayPtr, polygonalFaceBufferOffsetsArray.length, startIndicesBufferOffsetsArrayPtr, startIndicesBufferOffsetsArray.length);
88230
- this.polygonalSinksInUse_ = false;
88231
88288
  const pointsParseBuffer = this.conwayModel.nativeParseBuffer();
88232
88289
  if (!entity.Coordinates.extractParseBuffer(0, 0, 0, pointsParseBuffer, this.wasmModule, true)) {
88233
88290
  pointsParseBuffer.resize(0);
@@ -88258,6 +88315,102 @@ var IfcGeometryExtraction = class _IfcGeometryExtraction {
88258
88315
  } else {
88259
88316
  this.model.voidGeometry.add(canonicalMesh);
88260
88317
  }
88318
+ return ExtractResult.COMPLETE;
88319
+ }
88320
+ /**
88321
+ * Extract a polygonal faceset.
88322
+ *
88323
+ * The index sinks are extractor-scoped, so a nested faceset extraction
88324
+ * reached from inside this one would silently clobber them. Nothing
88325
+ * recurses there today, so this guards the invariant rather than a
88326
+ * live bug — but the release must survive a throw: per-record
88327
+ * extraction errors are caught upstream and are expected on malformed
88328
+ * models, and a leaked flag would turn one bad record into a failure
88329
+ * for every remaining faceset.
88330
+ *
88331
+ * @param entity The faceset.
88332
+ * @param temporary Is this a temporary (preview/operand) extraction?
88333
+ * @param isRelVoid Is this geometry a rel-void operand?
88334
+ * @return {ExtractResult} The extraction result.
88335
+ */
88336
+ extractPolygonalFaceSet(entity, temporary = false, isRelVoid = false) {
88337
+ if (this.polygonalSinksInUse_) {
88338
+ throw new Error("extractPolygonalFaceSet re-entered: the shared index sinks are already in use");
88339
+ }
88340
+ this.polygonalSinksInUse_ = true;
88341
+ try {
88342
+ return this.extractPolygonalFaceSetGuarded_(entity, temporary, isRelVoid);
88343
+ } finally {
88344
+ this.polygonalSinksInUse_ = false;
88345
+ }
88346
+ }
88347
+ /**
88348
+ * @param entity
88349
+ * @param temporary
88350
+ * @param isRelVoid
88351
+ * @return {ExtractResult}
88352
+ */
88353
+ extractPolygonalFaceSetGuarded_(entity, temporary, isRelVoid) {
88354
+ const result = ExtractResult.COMPLETE;
88355
+ const allIndices = this.polygonalIndexSink_;
88356
+ const allStartIndices = this.polygonalStartIndexSink_;
88357
+ const polygonalFaceBufferOffsets = this.polygonalFaceOffsetSink_;
88358
+ const startIndicesBufferOffsets = this.polygonalStartOffsetSink_;
88359
+ allIndices.reset();
88360
+ allStartIndices.reset();
88361
+ polygonalFaceBufferOffsets.reset();
88362
+ startIndicesBufferOffsets.reset();
88363
+ let indicesPerFace = -1;
88364
+ let fastPathOk = true;
88365
+ const facesWalked = entity.forEachReferenceInField(FACES_FIELD_OFFSET, FACES_FIELD_BASE_OFFSET, FACES_FIELD_DEPTH, (expressID) => {
88366
+ if (expressID === void 0) {
88367
+ fastPathOk = false;
88368
+ return false;
88369
+ }
88370
+ const count = this.model.extractIntegerArrayByExpressIDInto(expressID, COORD_INDEX_FIELD_OFFSET, entity_types_ifc_gen_default.IFCINDEXEDPOLYGONALFACE, allIndices);
88371
+ if (count === void 0) {
88372
+ fastPathOk = false;
88373
+ return false;
88374
+ }
88375
+ polygonalFaceBufferOffsets.push(allIndices.length - count);
88376
+ startIndicesBufferOffsets.push(allStartIndices.length);
88377
+ allStartIndices.push(0);
88378
+ indicesPerFace = count;
88379
+ return true;
88380
+ });
88381
+ if (fastPathOk && facesWalked) {
88382
+ this.finishPolygonalFaceSet_(entity, temporary, isRelVoid, indicesPerFace, allIndices, allStartIndices, polygonalFaceBufferOffsets, startIndicesBufferOffsets);
88383
+ return result;
88384
+ }
88385
+ allIndices.reset();
88386
+ allStartIndices.reset();
88387
+ polygonalFaceBufferOffsets.reset();
88388
+ startIndicesBufferOffsets.reset();
88389
+ indicesPerFace = -1;
88390
+ entity.Faces.forEach((polygonalFace) => {
88391
+ polygonalFaceBufferOffsets.push(allIndices.length);
88392
+ startIndicesBufferOffsets.push(allStartIndices.length);
88393
+ let coordIndex = 0;
88394
+ if (polygonalFace instanceof IfcIndexedPolygonalFaceWithVoids) {
88395
+ indicesPerFace = polygonalFace.CoordIndex.length;
88396
+ allStartIndices.push(0);
88397
+ coordIndex += indicesPerFace;
88398
+ for (const index of polygonalFace.CoordIndex) {
88399
+ allIndices.push(index);
88400
+ }
88401
+ polygonalFace.InnerCoordIndices.forEach((innerIndices) => {
88402
+ allStartIndices.push(coordIndex);
88403
+ for (const index of innerIndices) {
88404
+ allIndices.push(index);
88405
+ }
88406
+ coordIndex += innerIndices.length;
88407
+ });
88408
+ } else {
88409
+ indicesPerFace = polygonalFace.extractIntegerArrayInto(0, 0, 3, allIndices);
88410
+ allStartIndices.push(0);
88411
+ }
88412
+ });
88413
+ this.finishPolygonalFaceSet_(entity, temporary, isRelVoid, indicesPerFace, allIndices, allStartIndices, polygonalFaceBufferOffsets, startIndicesBufferOffsets);
88261
88414
  return result;
88262
88415
  }
88263
88416
  /**