Class4Steel DEV DOCS
// Developer Documentation

API & Deep Linking

Class4Steel exposes two integration surfaces: URL parameters for deep linking directly into a calculated section, and a global JavaScript interface for programmatic access from scripts, bots, or external applications. No registration, no API key, no rate limits.

✓ No authentication ✓ No rate limits ✓ Browser-native
// Authentication

No API key required

All calculations run entirely in the browser. There is no server-side API, no authentication layer, and no usage quota. Every URL you construct and every JavaScript call you make runs the same engine that powers the interactive calculator.

Because the engine is client-side, integrations must open the calculator in a browser context (iframe, popup, or direct navigation). Server-to-server HTTP calls are not applicable — see the JavaScript API section for in-page automation.

// Deep Linking

URL Parameters

Append parameters to https://www.class4steel.com/ to pre-load a specific cross-section. The calculator reads the parameters on page load, generates the polygon, runs the calculation, and renders the full results — no user interaction required.

Two modes are available: arbitrary vertex list and parametric preset.

// Mode 1

Arbitrary polygon — ?pts=

Pass a flat comma-separated list of x,y coordinate pairs. The engine closes the polygon automatically. Minimum 3 vertices. Both clockwise and counter-clockwise winding are accepted.

Syntax

Format https://www.class4steel.com/?pts=x1,y1,x2,y2,x3,y3,…

Examples

The pts list must contain an even number of values and at least 6 (3 vertices). If the count is odd or fewer than 6, the engine will display an error and no calculation will run.

// Mode 2

Standard profiles — ?preset=

Call any built-in parametric profile by name. Override individual dimensions via additional URL parameters. Any omitted parameter falls back to its built-in default value, so you only need to specify what differs. Fillet radii are applied automatically when supported by the profile.

Syntax

Format https://www.class4steel.com/?preset=preset_id&param=value&param=value

Examples

// Reference

Presets & parameters

All dimension values are in the same unit system as the coordinate input (mm, cm, or any consistent unit).

Preset ID Description URL Parameters
square Solid square a Side length
rectangle Solid rectangle with optional corner radius b Base  h Height  r Corner radius
triangle Isosceles triangle b Base  h Height
circle Solid circle (discretized polygon) D Diameter  n Discretization steps
lsection Angle / L-Section B Width  H Height  tf Thickness  r Root radius  r1 Toe radius
tsection Tee / T-Section B Flange width  H Height  tf Flange thick.  tw Web thick.  r Root radius  r1 Toe radius
isection I-Beam (IPE / HEB style) B Flange width  H Height  tf Flange thick.  tw Web thick.  r Root radius  r1 Toe radius
uchannel U-Channel (UPN style) B Width  H Height  tf Flange thick.  tw Web thick.  r Root radius  r1 Toe radius
rect_tube Rectangular Hollow Section (RHS) B Width  H Height  t Thickness  r Internal radius
circ_tube Circular Hollow Section (CHS) D Diameter  t Thickness  n Discretization steps
pentagon Regular pentagon r Circumradius
hexagon Regular hexagon r Circumradius
double_l_btb 2L Back-to-Back (twin angles, common web) B Width  H Height  tf Thickness  g Gap between webs  r Root radius  r1 Toe radius
double_l_star 2L Star / X-brace node (diagonal pair) B Width  H Height  tf Thickness  g Gap between webs  r Root radius  r1 Toe radius
quad_l_star 4L Star — telecom / lattice tower chord B Width  H Height  tf Thickness  g Gap between webs  r Root radius  r1 Toe radius

g highlighted in amber — see Gap parameter note below.

// JavaScript API

Global interface — window.class4steel

When the calculator page is open, the engine exposes a global object window.class4steel that allows external scripts (browser console, injected scripts, iframe postMessage bridges) to inject geometry and retrieve results programmatically.

Methods

JavaScript
// Set vertices and trigger calculation
const results = window.class4steel.setVertices([
  { x: 0,   y: 0   },
  { x: 100, y: 0   },
  { x: 100, y: 200 },
  { x: 0,   y: 200 }
]);

// Retrieve the last computed result without recalculating
const cached = window.class4steel.getResults();

setVertices(array) — accepts an array of {x, y} objects, updates the vertex table, runs the calculation engine, renders the polygon and results, and returns the result object synchronously.

getResults() — returns the last computed result object without triggering a new calculation. Returns null if no calculation has been run yet.

// Result Object

Returned properties

Both setVertices() and getResults() return the same object:

area
Cross-sectional area (units²)
perimeter
Total perimeter length (units)
Cx, Cy
Centroid coordinates (units)
Ix, Iy
Second moments of area about centroidal axes (units⁴)
Ixy
Product of inertia about centroidal axes (units⁴)
I1, I2
Principal moments of inertia — max and min (units⁴)
Iavg, R
Mohr's circle centre and radius (units⁴)
theta_deg
Principal axis angle θp from centroidal x̄ axis (degrees)
rx, ry
Radii of gyration about centroidal axes (units)
r1, r2
Radii of gyration about principal axes (units)
Wpl_x, Wpl_y
Plastic section modulus about x̄ and ȳ axes (units³)
PNA_y, PNA_x
Plastic neutral axis coordinates (units)
pts
Array of {x,y} vertex objects as used by the engine
n
Number of vertices
// Code Examples

Integration examples

Console / DevTools

JavaScript — Browser Console
// Open class4steel.com, then in DevTools console:
const r = window.class4steel.setVertices([
  {x:0, y:0}, {x:120, y:0}, {x:120, y:14},
  {x:59, y:14}, {x:59, y:186}, {x:120, y:186},
  {x:120, y:200}, {x:0, y:200}, {x:0, y:186},
  {x:61, y:186}, {x:61, y:14}, {x:0, y:14}
]);

console.log(`Area:  ${r.area.toFixed(2)} mm²`);
console.log(`Ix:    ${r.Ix.toFixed(0)} mm⁴`);
console.log(`Wpl,x: ${r.Wpl_x.toFixed(0)} mm³`);

Iframe integration

HTML
<!-- Embed a pre-calculated section directly -->
<iframe
  src="https://www.class4steel.com/?preset=isection&B=100&H=200&tf=14&tw=8"
  width="100%"
  height="700"
  style="border:none"
  title="I-beam HEB200 section properties"
></iframe>

Generating a shareable link from your application

JavaScript
function buildClass4SteelURL(vertices) {
  const flat = vertices.flatMap(v => [v.x, v.y]).join(',');
  return `https://www.class4steel.com/?pts=${flat}`;
}

function buildClass4SteelPresetURL(presetId, params) {
  const qs = new URLSearchParams({ preset: presetId, ...params });
  return `https://www.class4steel.com/?${qs}`;
}

// Examples:
buildClass4SteelURL([{x:0,y:0},{x:100,y:0},{x:50,y:80}]);
// → "https://www.class4steel.com/?pts=0,0,100,0,50,80"

buildClass4SteelPresetURL('isection', {B:100, H:200, tf:14, tw:8});
// → "https://www.class4steel.com/?preset=isection&B=100&H=200&tf=14&tw=8"
// Technical Notes

Hollow sections & stitching seams

Profiles like rect_tube, circ_tube, double_l_btb and the star variants simulate internal voids by generating a continuous polygon with a stitching seam — a zero-width cut that connects the outer and inner contours.

This allows the Shoelace / surveyor integration to treat hollow sections as a single closed polygon without modifying the core mathematical engine. The seam introduces no geometric error: the two edges of the seam are co-linear and cancel out in the area integral.

When passing hollow section vertices via ?pts=, you must include the stitching seam manually. The recommended pattern is to close the outer contour, add a bridge point with ε = 1×10⁻⁴ offset, traverse the inner contour in the opposite winding direction, and close back to the start.

// Technical Notes

The g gap parameter

The g parameter is unique to the double and quad angle presets. It defines the clear distance between the back-to-back webs, typically used to account for:

  • The thickness of a gusset plate between the angles
  • The thickness of a packing plate (presilla)
  • A physical gap required for bolted connections

Use g=0 for angles in direct contact (theoretical case, common in welded assemblies). The stitching seam connecting the two contours has a width of 1×10⁻⁴ units regardless of g, which is negligible relative to any practical section dimension.

Example — 2L with 10 mm gusset plate
// g=10 → each web is offset 5 mm from the centroidal axis
https://www.class4steel.com/?preset=double_l_btb&B=80&H=120&tf=12&g=10&r=10&r1=5