Resources Numerical accuracy Calculation policy

Weight totals in the status line and panels

Adds up the steel and reinforcing bar weights shown in the status line, the model summary and the selection panel.

How the precision is kept

Each total is one 64-bit sum of the parts' weights in list order, kept unrounded. Only the text shown is rounded, to 0.1 kg with toFixed. The part weights themselves are computed when the model is built, outside this file.

Calculations under this policy

3 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.

detailcraft.js DetailCraft 0.8.1 64-bit 3 calculations Reviewed

Tests None found by the review

Steel and bar weight in the status line

64-bit

The total weight of all steel parts and of all reinforcing bars, shown under the drawing.

steel = Σ part weight; bars = Σ row total weight

Two running sums in list order. The totals are rounded only when written as text, with toFixed(1).

  • detailcraft.js
  • lines 493 to 494
  • DetailCraft 0.8.1
const steel = built.parts.reduce((s, p) => s + p.weight, 0), bars = schedule.rows.reduce((s, r) => s + r.totalWeight, 0);
ui.counts.textContent = tr('app.bar.counts', { parts: built.parts.length, bolts: built.bolts.length, steel: kg(steel) }) + (bars ? ' ' + tr('app.bar.counts.rebar', { rebar: kg(bars) }) : '');

Steel weight of a selection

64-bit

The weight of the selected members plus the main plate of each selected connection.

steel = Σ weight of selected members and connection plates

Only the part named '<connection>.plate' is counted for a connection; its other plates, stiffeners and bolts are not in this figure. One running sum, shown with one decimal.

  • detailcraft.js
  • line 1317
  • DetailCraft 0.8.1
const steel = [...mem.map((m) => built.byId.get(m.id)), ...conns.map((id) => built.byId.get(id + '.plate'))].reduce((t, p) => t + (p ? p.weight : 0), 0);

Cut length and weight of one part

64-bit

The cut length, weight and weight per meter shown for a selected member.

The stored values are shown, not recomputed: the length rounded to 0.1 mm with Math.round, the weight to 0.1 kg and the weight per meter to 0.01 kg with toFixed.

  • detailcraft.js
  • line 1474
  • DetailCraft 0.8.1
const rows = [[tr('app.k.part-mark'), marks.partMark.get(m.id)], [tr('app.k.assembly'), marks.asmMark.get(marks.asmOf.get(m.id))], [tr('app.k.cut-length'), tr('app.unit.mm', { v: r1(part.length) })], [tr('app.k.weight'), tr('app.member.weight', { kg: kg(part.weight), mass: part.profile.mass.toFixed(2) })], [tr('app.k.profile-from'), part.profile.massPub !== undefined ? PROFILE_SOURCES[part.profile.source] : part.profile.massFrom]];

In detail

Method
Running sum in list order.
Number types
64-bit numbers; text with one decimal.
Limits
A plain running sum: with many parts the last digits depend on the order, far below the 0.1 kg shown.

Approach: 64-bit, direct

Every value is a 64-bit number from input to result. Formulas are closed form or a direct solve, and every comparison uses a stated tolerance.

Every policy that takes this approach