Writes the steel parts, holes, copes, mitre cuts, bolts, footings, bars and grids of the model as an IFC4 file.
How the precision is kept
Geometry is taken from the built model in 64-bit, but every real number in the file is written with six decimals: coordinates and sizes in millimeters, weights in kilograms, and also the components of direction vectors. Values smaller than 1e-9 are written as zero, and a value that is not finite is written as zero as well.
Open item. Write direction vectors, and preferably all reals, with full 64-bit precision instead of six decimals.
Calculations under this policy
10 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.
The value is rounded to six decimals with toFixed before it is written, whatever it measures. For a coordinate in millimeters that is a millionth of a millimeter; for a component of a unit direction it is six digits. A value that is not finite is written as 0. with no warning.
ifc.js
lines 49 to 56
DetailCraft 0.8.1
/** A STEP real: always with a decimal point. */
export function R(v) {
if (!Number.isFinite(v)) return '0.';
let s = Number((Math.abs(v) < 1e-9 ? 0 : v).toFixed(6)).toString();
if (s.includes('e')) { const [m, e] = s.split('e'); s = (m.includes('.') ? m : m + '.') + 'E' + e; }
else if (!s.includes('.')) s += '.';
return s;
}
Storey of an element
64-bit
Which storey an element is put in: the highest level at or below its lowest point.
level z ≤ lowest point + 0.5 mm
An absolute 0.5 mm allowance on the height comparison.
ifc.js
line 113
DetailCraft 0.8.1
const storeyFor = (z) => { let s = storeys[0]; for (const t of storeys) if (t.lv.z <= z + 0.5) s = t; return s; };
Placement of a part
64-bit
The origin and the two axes each part is placed with, relative to its storey.
location = (p_x, p_y, p_z − level z); Axis = part x; RefDirection = part u
One subtraction for the height, then the point and both unit axes go through the six-decimal writer. The same direction text is written once and shared.
ifc.js
lines 115 to 119
DetailCraft 0.8.1
/** Local placement relative to a storey: origin p (world), axis z, ref x. */
const place = (st, p, axis, ref) => {
const loc = w.pt([p[0], p[1], p[2] - st.lv.z]);
return w.add('IFCLOCALPLACEMENT(' + st.lp + ',' + w.add('IFCAXIS2PLACEMENT3D(' + loc + ',' + w.dir(axis) + ',' + w.dir(ref) + ')') + ')');
};
Profile dimensions
64-bit
The section dimensions written for each profile type.
The profile's stored dimensions are written as they are, to six decimals. A round tube's radius is its diameter divided by 2.
The position, direction, depth and radius of each hole's opening.
depth = thickness + 2; start = center − axis·depth ÷ 2; radius = d ÷ 2
The opening is centered on the material and made 2 mm longer than the thickness, 1 mm out of each face. The hole's diameter and position are the stored values.
The box is 1 mm oversize on the sides where it leaves the part. Its inner faces work out to the cope's stored length and depth: the half millimeter in the center and the extra millimeter in the size cancel on the inside.
The placement, diameter and length written for each bolt and rod.
Head position, axis, diameter and length are the built values, written to six decimals. The second axis of the placement is any direction square to the bolt.
The center line of each placed bar as lines and true arcs, with the bar's radius.
point = origin + s·ŝ + t·t̂; arc through start, middle and end; radius = d_b ÷ 2
Bends are written as three-point arcs, not as short straight pieces. The bar length written beside the shape is the schedule's cut length, not a length measured from this curve.
Each part is an extruded parametric profile placed by its frame; holes and copes are openings; mitre ends are half-space clippings; bars are swept disks along lines and true arcs.
Number types
64-bit numbers, written as decimal text with at most six decimals.
Tolerances
Storey assignment: 0.5 mm above a level still counts as on it. The file declares a geometric precision of 1.E-05.
Limits
A unit direction rounded to six decimals per component can point off by up to about one millionth of a radian, which moves the far end of a 10 m part by up to about 0.01 mm. Openings are made 1 mm oversize where they leave the part so that they cut cleanly.
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.