Steel Floor Beam

A steel floor beam as a BIM model: an IfcBeam with a rolled I profile between two column stubs, with fin plates, bolts, shear studs and a strip of the slab with its mesh. The sections, the fin plate, the bolts, the studs and the mesh are published figures, and the kernel measures the mass of the beam for each metre against the section table. The view shows each M20 bolt as a screw with a helical thread in its nut, and the IFC file keeps it as a plain proxy. The span, the column stubs and the slab strip are a display model.
Code
This is the full program. The playground runs it in your browser without a change.
import { BimModel, placedSolids, toIfc } from 'brepjs-bim';
import { box, clone, compound, cutAll, cylinder, extrude, fuseAll, getSolids, line, loft, measureVolume, polygon, rotate, translate, unwrap, wire } from 'brepjs/quick';
import { color, present } from 'brepjs/playground';
// Steel floor beam as a BIM model: an IfcBeam with a rolled I profile between two column stubs, with its fin
// plates, bolts, shear studs and a strip of the slab with its mesh. The sections, the fin plate, the bolts, the
// studs and the mesh are published figures. The span, the stubs and the slab strip are a display model.
// Units are millimetres. Y is along the beam and z = 0 is the top of the steel.
interface BeamParams {
section?: Size; // the beam, from the IPE series
span?: number; // distance between the column lines
slab?: number; // part of the slab width to show, 0 to 1. The IFC file keeps the whole slab
}
// ---- published figures
// European rolled sections: depth, width, web, flange, root radius, and the table mass in kg for each metre.
const IPE = {
'IPE 240': { h: 240, b: 120, tw: 6.2, tf: 9.8, r: 15, kg: 30.7 },
'IPE 300': { h: 300, b: 150, tw: 7.1, tf: 10.7, r: 15, kg: 42.2 },
'IPE 400': { h: 400, b: 180, tw: 8.6, tf: 13.5, r: 21, kg: 66.3 },
};
type Size = keyof typeof IPE;
const HE200B = { h: 200, b: 200, tw: 9, tf: 15, r: 18 };
const STEEL = 7850e-9; // kg in each mm3
// Standard fin plate: a 10 mm plate, M20 bolts in 22 mm holes at 70 mm centres, 10 mm between beam and column.
const FIN = { plate: 10, width: 100, hole: 22, pitch: 70, end: 40, edge: 50, gap: 10, top: 50 };
const M20 = { d: 20, minor: 17.294, pitch: 2.5, flats: 30, head: 12.5, nut: 18, washer: 37, washerHole: 21, washerT: 3 }; // metric coarse thread, right hand
const STUD = { d: 19, height: 100, head: 32, headT: 10 }; // 100 mm high after it is welded to the flange
const MESH = { wire: 6, pitch: 200 }; // fabric A142: 6 mm wires at 200 mm centres, both ways
// ---- display model
const STUB = { below: 320, above: 320 }; // the columns go on: the model shows a piece of each
const STRIP = { width: 800, depth: 150, studPitch: 190, cover: 30 };
const PLAY = 0.1; // radial play between the thread of a bolt and of its nut
const COLORS = { beam: '#12b5b0', column: '#c3c9d1', plate: '#ff5a1f', bolt: '#f5f2ea', stud: '#d3a956', mesh: '#a8623f', slab: '#cfcabb' };
type Tone = keyof typeof COLORS;
type P3 = [number, number, number];
type Body = ReturnType<typeof box>;
type Id = Extract<ReturnType<BimModel['addBeam']>, { ok: true }>['value']; // the id of an element in the model
const X: P3 = [1, 0, 0], Y: P3 = [0, 1, 0], Z: P3 = [0, 0, 1];
function beamModel({ section = 'IPE 300', span = 2000, slab = 0.5 }: BeamParams = {}) {
const model = new BimModel(), owned: { delete(): void }[] = [];
const own = <T extends { delete(): void }>(s: T): T => { owned.push(s); return s; };
try {
model.init({ name: 'Beam example' });
// The spatial structure makes this a BIM model: project, site, building, storey.
const project = model.getProject();
const site = unwrap(model.addSite({ name: 'Site' }));
const building = unwrap(model.addBuilding({ name: 'Building' }));
const storey = unwrap(model.addStorey({ name: 'Level 1', elevation: 0 }));
if (project) model.aggregate(project.localId, site);
model.aggregate(site, building);
model.aggregate(building, storey);
const tones = new Map<Id, Tone>();
const put = (tone: Tone, made: ReturnType<BimModel['addBeam']>): Id => {
const id = unwrap(made);
model.placeIn(id, storey);
tones.set(id, tone);
return id;
};
// The beam. The profile carries the figures of the section table. filletRadius is the root radius between the
// web and the flanges. The beam stops 10 mm short of each column face.
const s = IPE[section], face = span / 2 - HE200B.h / 2, length = 2 * (face - FIN.gap);
const beam = put('beam', model.addBeam({
length,
profile: { kind: 'I_BEAM', overallWidth: s.b, overallDepth: s.h, flangeThickness: s.tf, webThickness: s.tw, filletRadius: s.r },
origin: [0, -length / 2, -s.h / 2],
axisX: Y,
axisZ: Z,
materialName: 'Steel S355',
}));
// Two column stubs. Their flanges face the beam.
const column = { kind: 'I_BEAM', overallWidth: HE200B.b, overallDepth: HE200B.h, flangeThickness: HE200B.tf, webThickness: HE200B.tw, filletRadius: HE200B.r } as const;
for (const side of [-1, 1])
put('column', model.addColumn({ height: s.h + STUB.below + STUB.above, profile: column, origin: [0, side * span / 2, -s.h - STUB.below], axisX: X, axisZ: Z, materialName: 'Steel S355' }));
// A slab strip on the top flange, between the column faces.
const deck = put('slab', model.addSlab({ length: STRIP.width, width: 2 * face, thickness: STRIP.depth, origin: [-STRIP.width / 2, -face, 0], axisX: X, axisZ: Z, predefinedType: 'FLOOR', materialName: 'Concrete C30/37' }));
// Parts with no class in this library go in as proxies: the model owns their solids.
// A boolean gives a compound, and a proxy takes a solid: one() copies the solid out.
const one = (shape: Parameters<typeof getSolids>[0]): Body => unwrap(clone(getSolids(own(shape))[0]!)) as Body;
const part = (tone: Tone, name: string, solid: Body, materialName: string): Id => put(tone, model.addProxy({ name, solid, materialName }));
const hex = (flats: number, x: number, depth: number): Body => {
const r = flats / Math.sqrt(3);
const ring = own(unwrap(polygon(Array.from({ length: 6 }, (_, i): P3 => [x, r * Math.cos(i * Math.PI / 3), r * Math.sin(i * Math.PI / 3)]))));
return own(unwrap(extrude(ring, [depth, 0, 0]))) as Body;
};
// One bolt along X, with x = 0 at the outer face of the plate: washer and head, shank, washer and nut.
const grip = FIN.plate + s.tw, w = M20.washerT, shank = grip + w + M20.nut + 8;
const bolt = own(one(unwrap(fuseAll([
own(cylinder(M20.washer / 2, w, { axis: X })), hex(M20.flats, w, M20.head),
own(cylinder(M20.d / 2, shank, { at: [-shank, 0, 0], axis: X })),
own(cylinder(M20.washer / 2, w, { at: [-grip - w, 0, 0], axis: X })), hex(M20.flats, -grip - w - M20.nut, M20.nut),
]))));
// The view draws each bolt as a real screw: a core with one helical tooth, and a nut with the mating tooth, half a
// pitch out of phase. The proxy in the IFC file keeps the plain solid above. A tooth is a smooth loft about Z, turned to X.
const tooth = (core: number, tip: number, from: number, to: number, ref: number): Body => {
const root = tip > core ? core / 0.998 : core * 0.998, half = 0.42 * M20.pitch; // a hair clear of the core or the bore
const start = from + half, span = to - from - 2 * half, pieces = Math.ceil(span / (4 * M20.pitch));
const n = Math.round(span / pieces / M20.pitch * 24); // 24 loft sections in each turn
const section = (z: number) => {
const a = 2 * Math.PI * (z - ref) / M20.pitch;
const pts = [[root, -half], [tip, 0], [root, half]].map(([r, dz]): P3 => [r! * Math.cos(a), r! * Math.sin(a), z + dz!]);
return own(unwrap(wire(pts.map((q, i) => own(line(q, pts[(i + 1) % 3]!))))));
};
// A row of lofts of 4 turns or less, end to end on one helix: a long loft is slow to mesh.
const lofts = Array.from({ length: pieces }, (_, k) => own(unwrap(loft(Array.from({ length: n + 1 }, (_, j) => section(start + span * (k + j / n) / pieces)), { ruled: false }))));
return own(rotate(own(compound(lofts)), 90, { axis: Y })) as Body;
};
const bore = M20.d / 2 + PLAY, nutX = -grip - w - M20.nut;
const drilled = (body: Body, r: number, x: number, depth: number): Body => own(unwrap(cutAll(body, [own(cylinder(r, depth + 2, { at: [x - 1, 0, 0], axis: X }))]))) as Body;
const washer = (x: number): Body => drilled(own(cylinder(M20.washer / 2, w, { at: [x, 0, 0], axis: X })), M20.washerHole / 2, x, w);
const screw = own(compound([
washer(0), hex(M20.flats, w, M20.head), own(cylinder(M20.minor / 2, shank + w, { at: [-shank, 0, 0], axis: X })), tooth(M20.minor / 2, M20.d / 2, -shank, w, 0),
washer(-grip - w), drilled(hex(M20.flats, nutX, M20.nut), bore, nutX, M20.nut), tooth(bore, M20.minor / 2 + PLAY, nutX, nutX + M20.nut, M20.pitch / 2),
]));
const boltAt: P3[] = [];
// A fin plate on each column, on the +X side of the web. Its depth is 0.6 of the beam depth or more.
const rows = Math.ceil((0.6 * s.h - 2 * FIN.end) / FIN.pitch) + 1, depth = (rows - 1) * FIN.pitch + 2 * FIN.end;
const holes: Body[] = [];
for (const side of [-1, 1]) {
const at = (i: number): P3 => [s.tw / 2 + FIN.plate, side * (face - FIN.edge), -FIN.top - FIN.end - i * FIN.pitch];
const blank = own(box(FIN.plate, FIN.width, depth, { at: [s.tw / 2 + FIN.plate / 2, side * (face - FIN.width / 2), -FIN.top - depth / 2] }));
const drills = Array.from({ length: rows }, (_, i) => own(cylinder(FIN.hole / 2, 60, { at: [-30, at(i)[1], at(i)[2]], axis: X })));
holes.push(...drills);
part('plate', 'Fin plate', one(unwrap(cutAll(blank, drills))), 'Steel S275');
for (let i = 0; i < rows; i++) {
const position = at(i);
boltAt.push(position);
part('bolt', 'Bolt M20 8.8', translate(bolt, position), 'Steel 8.8');
}
}
// Headed studs on the centre line of the top flange. They tie the slab to the beam.
const stud = own(one(unwrap(fuseAll([own(cylinder(STUD.d / 2, STUD.height - STUD.headT)), own(cylinder(STUD.head / 2, STUD.headT, { at: [0, 0, STUD.height - STUD.headT] }))]))));
const count = Math.floor((length - 300) / STRIP.studPitch) + 1;
for (let i = 0; i < count; i++) part('stud', 'Shear stud 19 x 100', translate(stud, [0, (i - (count - 1) / 2) * STRIP.studPitch, 0]), 'Steel');
// The mesh in the slab: wires along the beam, and cross wires welded on top of them.
const wires: Body[] = [], zWire = STRIP.depth - STRIP.cover - MESH.wire, across = Math.floor(STRIP.width / MESH.pitch), along = Math.floor(2 * face / MESH.pitch);
for (let j = 0; j < across; j++) wires.push(own(cylinder(MESH.wire / 2, 2 * face - 40, { at: [(j - (across - 1) / 2) * MESH.pitch, -face + 20, zWire], axis: Y })));
for (let i = 0; i < along; i++) wires.push(own(cylinder(MESH.wire / 2, STRIP.width - 40, { at: [-STRIP.width / 2 + 20, (i - (along - 1) / 2) * MESH.pitch, zWire + MESH.wire - 1], axis: X })));
const mesh = part('mesh', 'Fabric A142', one(unwrap(fuseAll(wires))), 'Steel B500');
// The view. placedSolids() gives each element in its place, as the IFC file has it. The view then drills the
// web for the bolts, cuts the slab back along the beam to show the studs and the mesh in it, and puts the
// screw with its helical thread in the place of each bolt proxy.
const share = Math.min(Math.max(slab, 0), 1), behind = -STUD.head / 2 - 4;
const raw = (share - 0.5) * STRIP.width, edge = share < 1 && Math.abs(raw) < -behind ? behind : raw; // not through a stud
const cutSlab = share > 0 && share < 1;
const open = cutSlab ? [own(box(STRIP.width, 2 * face + 2, STRIP.depth + 2, { at: [edge + STRIP.width / 2, 0, STRIP.depth / 2] }))] : [];
const kept = cutSlab ? [own(box(STRIP.width, 2 * face + 2, STRIP.depth + 2, { at: [edge - STRIP.width / 2, 0, STRIP.depth / 2] }))] : [];
const groups: Record<Tone, Body[]> = { beam: [], column: [], plate: [], bolt: [], stud: [], mesh: [], slab: [] };
let kg = 0;
for (const el of model.getAllElements()) {
const tone = tones.get(el.localId);
if (!tone) continue;
const placed = unwrap(placedSolids(el)).map((body) => own(body));
if (el.localId === beam) {
kg = unwrap(measureVolume(placed[0]!)) * STEEL / (length / 1000);
groups.beam.push(own(unwrap(cutAll(placed[0]!, holes))));
} else if (el.localId === deck) {
if (share > 0) groups.slab.push(cutSlab ? own(unwrap(cutAll(placed[0]!, open))) : placed[0]!);
} else if (el.localId === mesh) {
if (share < 1) groups.mesh.push(cutSlab ? own(unwrap(cutAll(placed[0]!, kept))) : placed[0]!);
} else if (tone !== 'bolt' && (tone !== 'stud' || edge < 0)) groups[tone].push(...placed);
}
groups.bolt = boltAt.map((at) => own(translate(screw, at)) as Body);
const shown = (Object.keys(COLORS) as Tone[]).filter((tone) => groups[tone].length > 0).map((tone) => color(compound(groups[tone]), COLORS[tone]));
return { model, shown, kg, table: s.kg, section, rows };
} catch (error) {
model[Symbol.dispose]();
throw error;
} finally {
owned.splice(0).forEach((body) => body.delete());
}
}
// Try beamModel({ section: 'IPE 400' }), beamModel({ span: 3600 }) or beamModel({ slab: 0 }).
const scene = beamModel();
console.log(scene.section + ': the kernel measures ' + scene.kg.toFixed(1) + ' kg/m, the section table gives ' + scene.table + ' kg/m. ' + scene.rows + ' bolt rows in each fin plate.');
// The tree panel shows the IFC structure. The IFC button saves the model as a file.
export default present(scene.shown, {
bimTree: scene.model.toTreeSummary(),
ifc: async () => unwrap(await toIfc(scene.model, { applicationName: 'brepjs playground', applicationVersion: '1.0' })),
});Functions used
placedSolids toIfc box clone compound cutAll cylinder extrude fuseAll getSolids line loft measureVolume polygon rotate translate unwrap wire color present