brepjs-bim 0.15.0 → 0.15.1

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.
@@ -7508,6 +7508,12 @@ var FILE_NAME_RE = /(FILE_NAME\('[^']*','[^']*',)(?:\$|\(\$\)),(?:\$|\(\$\)),('[
7508
7508
  function stepString(value) {
7509
7509
  return `'${value.replace(/'/g, "''")}'`;
7510
7510
  }
7511
+ var STRING_OR_BARE_REAL_RE = /'(?:[^']|'')*'|(?<![\d.])(-?\d+)E([+-]?\d+)/g;
7512
+ function normalizeStepReals(bytes) {
7513
+ const text = new TextDecoder().decode(bytes);
7514
+ const fixed = text.replace(STRING_OR_BARE_REAL_RE, (match, mantissa, exponent) => mantissa === void 0 || exponent === void 0 ? match : `${mantissa}.E${exponent}`);
7515
+ return fixed === text ? bytes : new TextEncoder().encode(fixed);
7516
+ }
7511
7517
  var IfcWriter = class IfcWriter {
7512
7518
  #api;
7513
7519
  #modelId;
@@ -7563,7 +7569,7 @@ var IfcWriter = class IfcWriter {
7563
7569
  if (this.#closed) return (0, brepjs.err)(ifcError("IFC_ALREADY_SAVED", "Model has already been saved and closed"));
7564
7570
  try {
7565
7571
  const bytes = this.#api.SaveModel(this.#modelId);
7566
- return (0, brepjs.ok)(this.#patchHeader(bytes));
7572
+ return (0, brepjs.ok)(normalizeStepReals(this.#patchHeader(bytes)));
7567
7573
  } catch (e) {
7568
7574
  return (0, brepjs.err)(ifcError("IFC_SAVE_FAILED", "Failed to serialize IFC model", e));
7569
7575
  } finally {
@@ -7485,6 +7485,12 @@ var FILE_NAME_RE = /(FILE_NAME\('[^']*','[^']*',)(?:\$|\(\$\)),(?:\$|\(\$\)),('[
7485
7485
  function stepString(value) {
7486
7486
  return `'${value.replace(/'/g, "''")}'`;
7487
7487
  }
7488
+ var STRING_OR_BARE_REAL_RE = /'(?:[^']|'')*'|(?<![\d.])(-?\d+)E([+-]?\d+)/g;
7489
+ function normalizeStepReals(bytes) {
7490
+ const text = new TextDecoder().decode(bytes);
7491
+ const fixed = text.replace(STRING_OR_BARE_REAL_RE, (match, mantissa, exponent) => mantissa === void 0 || exponent === void 0 ? match : `${mantissa}.E${exponent}`);
7492
+ return fixed === text ? bytes : new TextEncoder().encode(fixed);
7493
+ }
7488
7494
  var IfcWriter = class IfcWriter {
7489
7495
  #api;
7490
7496
  #modelId;
@@ -7540,7 +7546,7 @@ var IfcWriter = class IfcWriter {
7540
7546
  if (this.#closed) return err(ifcError("IFC_ALREADY_SAVED", "Model has already been saved and closed"));
7541
7547
  try {
7542
7548
  const bytes = this.#api.SaveModel(this.#modelId);
7543
- return ok(this.#patchHeader(bytes));
7549
+ return ok(normalizeStepReals(this.#patchHeader(bytes)));
7544
7550
  } catch (e) {
7545
7551
  return err(ifcError("IFC_SAVE_FAILED", "Failed to serialize IFC model", e));
7546
7552
  } finally {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "brepjs-bim",
3
- "version": "0.15.0",
3
+ "version": "0.15.1",
4
4
  "description": "BIM layer for brepjs — IFC4-aligned parametric building elements",
5
5
  "keywords": [
6
6
  "bim",