Rows file formats
Rows are JSON files a person supplies: in the studio's Library, or attached in the chat. Shop rows explains why, and what uses each kind.
The file
Its shape. A rows file is one of:
- an array of rows;
- an object with a
rowsarray (not for fits or bend tables); - for fits, an object with a
tablesarray.
It holds 1 to 4,096 rows.
Limits. A file must be named
.jsonand is at most 256 KiB. A conversation takes at most 32 files and 1 MiB in all.Sources. Every row names its
source, or is marked"estimate": true. Where a kind requires a source, an estimate isn't enough.Units. Public length fields use millimetres, including fit and bearing deviations. Angles use degrees. Source labels keep the units printed by their source. The mount row fields are listed separately below.
Validation. A row is checked when it is loaded. A row with a missing or out-of-range value is refused, and the refusal says which row and why.
Provenance. Each loaded row keeps a receipt naming its file, its turn in the conversation and the file's SHA-256.
Row kinds
fastener-sizes
One row per metric thread size. It says how that size is drawn and holed.
| Field | Meaning (mm unless noted) |
|---|---|
id | The size, as M6 |
d, pitch | Nominal diameter (must match the id), coarse pitch |
s | Hex across flats, for bolt heads and nuts |
k, m | Hex bolt head height, nut height |
dk, ks, socket | Socket head diameter and height, hex key size |
wd1, wd2, wh | Washer inside and outside diameters, thickness |
cdk, ck, csocket | Countersunk head diameter, height, socket size |
lengths, capLengths, cskLengths | Lengths offered, shortest first: hex bolts, cap screws, countersunk screws (overall) |
clearance | Clearance holes: fine, medium, coarse |
tap | Tap drill for the internal thread |
source or estimate | Where the row comes from |
fieldSources | Where a field comes from, when not the row's source |
unchecked | Fields not cross-checked against a second source |
fasteners
Bought screws, bolts, nuts and washers, as your supplier lists them:
id;kind:hex-bolt,socket-screw,csk-screw,hex-nutorwasher;size, such asM6;length, for screws and bolts;- optional
designation,partNumberandsupplier; sourceorestimate.
casting-rules
Two shapes, each for die-casting or sand-casting:
- A limit:
id,process,key,value,unit,description,source, and optionalpage. - A pattern allowance table:
allowance:shrink(by alloy family, in inches per foot by size band) ormachining(by class, in inches by size band);- with its
label,bandsandpage.
A page is { url, read, label }: the address, the date read, and the page's own label for the value.
fits
Fit tables. Each table has an id, optional sources ({ id, label, url?, read?, note? }) and rows. Each row is:
class: an ISO 286 class such asH7org6;overandupTo: the size range, over < size ≤ up to;upperandlower: the deviations in mm;- and
sourceorestimate.
If a source quotes a deviation in µm, divide it by 1000 before writing the row's mm value. Keep the source record.
bearings
id, optionaldesignation;bore,outside,width, optionalchamfer;- the shoulder limits
daMin,daMax,DaMax,raMax; - the deviations
boreDeviationandoutsideDeviation, each[upper, lower]in mm; sourceorestimate.
orings
id, optional dash, insideDiameter, crossSection, and source or estimate.
rings
Retaining rings: id, optional designation, shaftDiameter, grooveDiameter, grooveWidth, and source or estimate.
drives
Belts, chains and couplings, by kind:
kind | Required | Optional |
|---|---|---|
chain | pitch, rollerDiameter | innerWidth, plateHeight |
timing-belt | pitch, pitchLineOffset, groove | thickness |
v-belt | angle, datumWidth, aboveDatum, belowDatum, spacing, edge | thickness |
flat-belt | width, thickness | — |
coupling | bore, outside, length | type, boreStep, partNumber, supplier |
Each also has an id, and source or estimate.
connectors
id, optionalname;opening:{ shape, width, height, cornerRadius?, depth }, whereshapeisstadium,rectorround;- an optional mating
body(the same section, withlength); - an optional
keepOut:{ margin, depth }; sourceorestimate.
sections
Your frame section library: id, optional name, section, and source or estimate. The section is one of the typed sections that Frames and weldments lists (a rectangular or round tube, an angle, a channel, an I/H beam or a T-slot), by its dimensions.
mounts
How a motor, a servo or a bearing unit fixes to a flat face, one row per model from its datasheet.
| Field | Meaning (mm; start in degrees) |
|---|---|
id, type, designation? | The row; type is motor, servo or bearing-unit |
holes | The bolt pattern, with each hole's diameter: { pattern: "square", spacing }, { pattern: "rect", spacing: [along, across] }, or { pattern: "circle", pcd, count, start? } |
pilot, pilotDepth | The register diameter on the mounting face, and how far it stands out |
shaft, shaftOffset, shaftHeight | The shaft's diameter; where it stands from the pattern's centre, [along, across]; its axis above the face |
body | A servo's body cut-out sizes, [along, across], through the face. A servo requires it; other types may not have it |
clearance | Added all round to the pilot, shaft and body cut-outs |
bearing | For a bearing unit, a bearings row id. Its bore must equal shaft |
source or estimate, fieldSources, unchecked | As for fastener sizes |
The limits:
- Sizes. A hole's diameter is 1 to 30 mm,
clearanceis 0 to 5 mm, a circle has 2 to 12 holes, and lengths are at most 2,000 mm. - Holes. They must be further apart than their diameter.
- Pilot and shaft. A pilot must be wider than the shaft, and
pilotDepthneeds apilot. - Clearance. The pilot's or shaft's cut, with its clearance, must stay clear of the holes.
Each refusal is [MOUNT_RANGE], and names the row and the field. A placed part uses the mount rows of the document it is placed in.
The shipped mount example keeps its estimates, unchecked fields and field sources. This check reads those existing rows; it does not supply a new hardware row:
const mounts = read('mounts.json');
for (const row of mounts.rows) assert.deepEqual(checkMountRow(row), []);
const motor = mounts.rows.find(row => row.id === 'nema17');
assert.deepEqual([motor.pilot, motor.pilotDepth, motor.shaftHeight], [22, 2, 0]); // mm
assert.equal(motor.estimate, true); // the shipped estimate remains an estimate
assert.ok(motor.unchecked.includes('pilot'));
assert.ok(motor.fieldSources.pilot.includes('estimate'));
const bearing = mounts.rows.find(row => row.id === 'ucp204');
assert.equal(bearing.holes.pcd, 95); // mm, pitch-circle diameterstock
Stock for machining, each with a source:
- a block:
{ id, kind: "block", size: [x, y, z] }; - a bar:
{ id, kind: "bar", diameter, maxLength? }.
frame-stock
Stock lengths for frame members: id, length, optional count and section, and source.
bend
A sheet-metal bend table. It has an id, optional material and sources, and rows. Each row is:
thicknessandradius, with optionalangle;- one of
kFactor,allowanceordeduction; sourceorestimate.
The shipped samples
@barocss/cad-model ships three samples, at samples/rows/:
fastener-sizes.json: M3 to M12;casting-rules.json: die and sand casting;mounts.json: mounts, described in Shop rows.
Each file has an about note and its rows. They are examples taken from the sources each row names, not a standard.
const sizes = read('fastener-sizes.json'); // { about, rows: [...] }
assert.deepEqual(sizes.rows.map(r => r.id), ['M3', 'M4', 'M5', 'M6', 'M8', 'M10', 'M12']);
for (const row of sizes.rows) assert.deepEqual(checkFastenerSizeRow(row), []); // no problems
const m6 = sizes.rows.find(r => r.id === 'M6');
assert.deepEqual([m6.d, m6.pitch, m6.tap], [6, 1, 5]); // mm
const casting = read('casting-rules.json');
for (const row of casting.rows) assert.deepEqual(checkCastingRuleRow(row), []);
assert.ok(casting.rows.every(r => r.page?.url)); // each rule names the page it was read fromassert.deepEqual(checkFastenerSizeRow({ id: '6mm' }),
[{ code: 'FASTENER_SIZE_ROW', message: '[FASTENER_SIZE_ROW] a fastener size row\'s id is its thread size, as "M6"' }]);