Resources Numerical accuracy Calculation policy

MEP openings and clearances shown and exported

Brings run points into the viewer frame and writes the opening sizes and positions to the screen list, the CSV and the BCF.

How the precision is kept

Positions are brought into the viewer frame in 64-bit (millimeters divided by 1000, then 4x4 matrices). The numbers a person reads in the CSV and the BCF text are rounded to whole millimeters, so the export carries 1 mm resolution.

Calculations under this policy

4 calculations in 1 source file. The code is read from the released app when this page loads. It is the calculation people run, not a copy kept for this page.

mep/structure-ui.js BimCraft 0.8.1 64-bit 4 calculations Reviewed

Tests None found by the review

Run point to viewer frame

64-bit

A run point in the viewer frame in meters.

p = Lm · C · (storey · p ÷ 1000)

Applies the storey matrix, divides by 1000, swaps to the coordination axes and applies the two 4x4 matrices; each step is a 64-bit sum of products.

  • mep/structure-ui.js
  • lines 44 to 46
  • BimCraft 0.8.1
const ap = (M, v) => [M[0] * v[0] + M[4] * v[1] + M[8] * v[2] + M[12], M[1] * v[0] + M[5] * v[1] + M[9] * v[2] + M[13], M[2] * v[0] + M[6] * v[1] + M[10] * v[2] + M[14]];
const worldMm = (st, p) => ap(sw(st), p);
const toViewer = (st, p) => { const q = worldMm(st, p).map((x) => x / 1000); return ap(Lm || [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], ap(C, [q[0], q[2], -q[1]])); };

Opening rows in the CSV

64-bit

The insulation, size, X, Y, Z and through length of an opening as written in the CSV.

v = round(mm)

Every value goes through Math.round, so the file holds whole millimeters; the size text uses Math.round of width and height too.

  • mep/structure-ui.js
  • lines 89 to 90
  • BimCraft 0.8.1
const r1 = (v) => Math.round(v);
const data = openingsCsv(S.open, head, (r) => [r.n, t(r.kind === 'duct' ? 'mep.run.duct' : 'mep.run.pipe'), systemLabel(r.kind, r.system), r.sizeLabel, r1(r.insulation), sizeText(r), ctx.nameOfKey(r.element), guidOf(r.element) || '', levelName(r.storey), r1(r.at[0]), r1(r.at[1]), r1(r.at[2]), r1(r.through)]);

Opening text in the BCF

64-bit

The insulation, gap and position written into the BCF description.

The description rounds insulation, gap, x, y and z with Math.round; the BCF position itself is the 64-bit world point divided by 1000 (meters) in worldOf.

  • mep/structure-ui.js
  • lines 97 to 98
  • BimCraft 0.8.1
description: (r) => t('mep.st.bcf.desc', { run: t(r.kind === 'duct' ? 'mep.run.duct' : 'mep.run.pipe') + ' ' + r.sizeLabel + ' ' + systemLabel(r.kind, r.system), size: sizeText(r), ins: Math.round(r.insulation), gap: Math.round(r.gap), level: levelName(r.storey), x: Math.round(r.at[0]), y: Math.round(r.at[1]), z: Math.round(r.at[2]) }),
author: ctx.author?.() || 'BimCraft', now, guidOf, worldOf: (r) => r.world.map((x) => x / 1000), newGuid,   // i18n-ignore: author fallback written into the file

Gap and need shown for a soft clash

64-bit

The gap and the needed clearance shown in the list in the display unit.

Meters are multiplied by 1000 to millimeters and passed to lenMark with the display unit; the unit conversion and rounding are in model-units.js, which is not in this review.

  • mep/structure-ui.js
  • line 118
  • BimCraft 0.8.1
el('span', {}, t('clash.row', { a: ctx.nameOfKey(c.a), b: ctx.nameOfKey(c.b) })), el('span', { className: 'n' }, t('mep.st.soft.gap.u', { gap: lenMark(c.gap * 1000, getDisplayUnits()), need: lenMark(c.need * 1000, getDisplayUnits()) })))))));

In detail

Method
world mm ÷ 1000 to meters, then coordination matrix and model matrix; export values rounded with Math.round.
Number types
64-bit numbers.
Tolerances
None in this file; the clearance and opening sizes are computed in other files.
Limits
CSV and BCF description columns (insulation, gap, X, Y, Z, through length, size) are rounded to whole millimeters before they are written.

Approach: 64-bit, stated limit

The arithmetic is 64-bit, but the method or the data sets the accuracy: a solver tolerance, a mesh, a step size, a datum shift, a table. The limit is stated where the result is shown.

Every policy that takes this approach