@rulecad/cad 0.7.81 → 0.7.83

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -5,6 +5,26 @@ print (a hole's diameter, a seat's depth, a part's outline). Each release lists
5
5
  its reason. A **fasten** is an entry in an assembly's `"fasten"` list: one screwed joint, naming the screw by thread
6
6
  and head, the parts it passes through and the part it ends in.
7
7
 
8
+ ## 0.7.83: stalled motors and joints swept together on the frame
9
+ ### Added
10
+
11
+ - A rail guide takes `"nut": "printed"` (issue 308): a printed carrier strip `<id>-nuts` in the slot under the rail,
12
+ a hex nut under each hole, its screws fastened into them. An MGN7 on a 2020 now checks clean this way.
13
+ - Frame checks (issue 302): moving joints on the frame's beams are swept together as well as one at a time
14
+ (`frame.together`); a motor driving a joint on the frame stalls against a hard stop at each end of the travel, its
15
+ holding torque pushing the stop and its own mount apart; a motor turning a hinge holds its torque at its mount.
16
+ Frames with two moving joints solve more poses (the arm in the tests: 11 to 27), and frames with motors more cases:
17
+ a sag, stress or join figure there can grow where a combined pose or a stall is worse than the poses before. No
18
+ printed size moved.
19
+ - The printed-beam options (`beam.printable`, issue 302) take a motor's stall against its stop as `frame.stress` and
20
+ `frame.deflection` do: a frame with a stalled motor no longer offers a printed beam with a margin it does not have.
21
+ ### Fixed
22
+
23
+ - `cad list` counted a `nut-carrier`'s nuts twice where a fasten placed them: once with the fasten and once as the
24
+ carrier's own hardware. They are counted once.
25
+ - A `nut-carrier` item stands inside its beam's envelope: the overlap check measures only what stands above the face,
26
+ and the screws and nuts in it may overlap that beam.
27
+
8
28
  ## 0.7.81: a folding sheet checked in an assembly's poses (#78)
9
29
  ### Tests
10
30
 
package/README.md CHANGED
@@ -850,7 +850,10 @@ address stands for the faces near it, as `item@anchor` does (`"within"`, 10 mm b
850
850
  A mass on a moving joint mounted on a beam, such as a carriage on a guide, is solved at each end of its travel
851
851
  and at its quarters between (`frame.sweep`, 4 steps), at every named pose and as drawn; the worst is named. A
852
852
  carriage's worst place for the sag at a point off a span's middle lies between the point and the middle, which
853
- the ends alone miss.
853
+ the ends alone miss. Two or more such joints are also swept together (`frame.together`, 32 poses at most):
854
+ every combination of their places where that fits, else of their ends and middles, else all at one share of
855
+ their travel at once, so a carriage at the middle of a beam that itself stands at the middle of its travel is
856
+ found. `frame.solve` says which way they were combined (`refs.together`).
854
857
  Each `"loads"` entry on a joint (a force on a slide, a torque on a hinge) and a belt guide's push at its
855
858
  carriage's acceleration is carried through the joint, held by its motor, into the beam the joint's chain is
856
859
  mounted on: a slide's force along its axis through the joint's place, as a force and its moment at that node, a
@@ -858,6 +861,15 @@ address stands for the faces near it, as `item@anchor` does (`"within"`, 10 mm b
858
861
  then the other (`as drawn, joint loads +`, `... joint loads -`), and `frame.solve` names them (`refs.onJoints`).
859
862
  A belt's share of its carriage's own weight along the travel is that weight, already on the frame, and is not
860
863
  counted again.
864
+ A motor that drives a joint mounted on the frame, the motor itself mounted on a still beam, adds two more:
865
+ - Stalled against a hard stop at each end of the travel, it pushes (or turns) with its holding torque through
866
+ its gearing: a lead screw's 2 pi T efficiency over its lead, a belt's 2 T over its pulley's pitch diameter. The
867
+ stop at the joint's place and the motor's mount take that push equal and opposite, along the joint's line, so
868
+ only the frame between them is loaded (cases `<joint> at <end>, <motor> stalled against its stop`,
869
+ `refs.stalls`). A NEMA 17's 0.59 N m through an 8 mm lead screw at 57% pushes 266 N.
870
+ - Turning a hinge, the torque it turns the arm with (its most at its working speed, through its gearing) is held
871
+ at its own mount, one way and then the other, as a joint load there.
872
+ A motor that rides on what it drives, or is on no beam, is named as not weighed on the frame.
861
873
  - `frame.deflection`: the sag at each load's point, at each place in `"frame": { "points": ["x2.top@50%"] }` and
862
874
  along every guide's travel, with the joins' springs and with the joins rigid, and the load's own share. The first
863
875
  rests on the joins' springs, estimates until the joint rig measures them, and the finding says so (`refs.restsOn`:
@@ -1336,6 +1348,12 @@ slotted face, its holes read from its own rule set (@rulecad/frames' README, Ser
1336
1348
  face from the beam's end a. Its screws are a fasten into the slot, one in each hole at the rail's pitch, so
1337
1349
  `fasten.length` chooses them, the slot nuts are placed with them (`"nut"` chooses their kind), and `cad list`
1338
1350
  counts both: an MGN12 cut to 300 mm takes twelve M3 cap screws 25 mm apart and twelve M3 slot nuts.
1351
+ - Where no slot nut is sold for the rail's thread (an MGN7's M2 in a 2020's 6 mm slot), `"nut": "printed"` puts a
1352
+ printed carrier strip in the slot under the rail instead: a `nut-carrier` fitting item `<id>-nuts`, one hex nut
1353
+ under each hole, slid in from the beam's end. The rail's screws go into its nuts as a fasten, and `cad list` counts
1354
+ the strip with its grams and each nut once. An MGN7 cut to 200 mm on a 2020 takes a 189 mm strip of 9.3 g of PLA,
1355
+ thirteen M2x8 cap screws and thirteen M2 hex nuts; each nut holds about 936 N straight out of the slot (an estimate
1356
+ until tested). Where no carrier fits the slot either, `guide.fit` fails and says why.
1339
1357
  - Each carriage (`"carriages"`, 1 by default) is a bought item `<id>-carriage-1`, ... on its own sliding joint
1340
1358
  `<id>-1`, ... along the beam, from 0 to its travel: its share of the rail less its length with its seals. The
1341
1359
  poses `<id>-a` and `<id>-b` put every carriage at the start and the end of its share; `cad check --sweep` slides
package/lib/fasten.mjs CHANGED
@@ -899,7 +899,10 @@ export function fastenOf(s, worlds, opts = {}) {
899
899
 
900
900
  // The hardware, each piece where it sits: its own frame, the item it moves with, the way it comes out, what it may overlap
901
901
  const host = (r) => r.parts[0], up = D.map((c) => -c), piece = (kind, m, o, P, Z, r, lift, allow, X) => sc.hardware.push({ kind, shape: shapeOf(F, kind, m, o), M: standing(P, Z, X), host: host(r), lift, allow });
902
- const ends = [...new Set(B.parts.map((p) => p.leaf))];
902
+ // (a printed nut carrier stands in a beam's slot, inside the beam's envelope, which the overlap check measures: the
903
+ // screw and nut in it may overlap that beam)
904
+ const carrierIn = (() => { const it = (s.a.items || []).find((q) => q.id === top(x.into)); if (it?.fitting?.kind !== 'nut-carrier' || typeof it.at !== 'string') return []; const b = it.at.split('.')[0]; return [...new Set(s.parts.filter((p) => p.item === b && !p.hardware).map((p) => p.leaf))]; })();
905
+ const ends = [...new Set([...B.parts.map((p) => p.leaf), ...carrierIn])];
903
906
  if (A) piece('screw', fx, { length: L, head: form, anyLength: true }, at(zHead), up, A, up, A.parts.some((p) => s.objects.find((o) => o.id === p.leaf)?.beam) ? [...ends, ...new Set(A.parts.map((p) => p.leaf))] : ends); // (a screw through a beam, or its head in a slot, is inside the beam's envelope, which the overlap check measures)
904
907
  else piece('screw', fx, { length: L, head: form, anyLength: true }, at(zSeat), up, B, up, ends);
905
908
  if (washer) piece('washer', fx.thread, {}, at(zSeat), up, A, up, []);
@@ -907,7 +910,7 @@ export function fastenOf(s, worlds, opts = {}) {
907
910
  else if (end.kind === 'nut') {
908
911
  let X = null;
909
912
  if (end.nut.corner) { const lp = end.nut.corner.seg.a.loop, pr = end.nut.corner.seg.of, v = lp.corner ? [lp.corner[0] - lp.c[0], lp.corner[1] - lp.c[1]] : lp.along, local = add(pr.x.map((c) => c * v[0]), pr.y, v[1]), pm = end.nut.corner.seg.part.m; X = pm ? [0, 1, 2].map((r) => pm[r] * local[0] + pm[4 + r] * local[1] + pm[8 + r] * local[2]) : local; }
910
- piece('nut', fx.thread, { kind: end.nut.kind }, at(end.nut.z), D, B, D, [], X);
913
+ piece('nut', fx.thread, { kind: end.nut.kind }, at(end.nut.z), D, B, D, carrierIn, X);
911
914
  }
912
915
  if (end.kind === 'insert' && end.insert) piece('insert', fx.thread, {}, at(end.mouth), up, B, up, ends);
913
916
  // fasten.access: the key's way to the head, along its axis, with every other part in place (said by fastenChecks, with the order)
package/lib/fittings.mjs CHANGED
@@ -33,9 +33,9 @@ const MORE = {
33
33
  };
34
34
  // the kinds whose tongue or stem stands in the slot, inside the beam's envelope: the overlap check measures them without it
35
35
  const TONGUED = ['panel-clip', 'magnet-catch', 'panel-corner', 'cable-clip', 'tie-anchor', 'spool-holder', 'rail-jig', 'slider', 'end-cap'];
36
- // parts that lie in a slot by design (an in-slot panel edge, a slot cover's strip): only what stands above the face is
36
+ // parts that lie in a slot by design (an in-slot panel edge, a slot cover's strip, a nut carrier): only what stands above the face is
37
37
  // measured by the overlap check, as a tongue is left out
38
- const IN_SLOT = ['panel-edge', 'slot-cover'];
38
+ const IN_SLOT = ['panel-edge', 'slot-cover', 'nut-carrier'];
39
39
  /** The kinds of fitting an item may name. */
40
40
  export const FITTING_KINDS = ['bracket', 'gusset', 'splice', ...Object.keys(MORE)];
41
41
  const shown = (v) => (v === undefined ? 'nothing' : JSON.stringify(v));
@@ -24,7 +24,7 @@ import { frame as solveFrame, subdivide } from '@rulecad/fea/frame';
24
24
  import { placeItems, jointValues, mul } from '@rulecad/model-link';
25
25
  import { paths } from './workspace.mjs';
26
26
  import { massesOf } from './loads.mjs';
27
- import { axisOf, workingSpeed } from './motors.mjs';
27
+ import { axisOf, workingSpeed, trainFrom, atCurrent, mountTorque } from './motors.mjs';
28
28
  import { joinStiffness, PANEL_DEFAULTS } from '@rulecad/frames';
29
29
  import { printableCheck, couponChecks, printedOption } from './frameprint.mjs';
30
30
 
@@ -53,6 +53,7 @@ export const FRAME_CHECK = {
53
53
  order: { value: ['gusset', 'brace', 'panel'], unit: '', rule: 'The changes that stiffen a bay against racking, cheapest first: gussets at its corners (four printed or bought plates), one diagonal brace (a length of the bay\'s own profile and two fittings), a panel (a sheet and its clips). The first in this order that brings the sway under the limit is advised, in one bay before every bay that way', kind: 'default', source: 'A working order of @rulecad/cad, by the parts each needs; cad list prices them', checked: '2026-11-17' },
54
54
  clip: { value: 200, unit: 'N/mm', rule: 'How stiffly one panel clip holds the sheet\'s edge from sliding along the beam: the clip grips the sheet by friction and its edge sits half a millimetre off the step, so this is a guess at the friction\'s stiffness, the weak link of a panel as a shear web', kind: 'estimate', source: 'A working guess of @rulecad/cad, with no measurement behind it: a panel on the joint rig would measure it', checked: '2026-11-17' },
55
55
  band: { value: 0.2, unit: '', rule: 'A mode within this share of a frequency the machine dwells at (a stepper\'s full-step rate at its working speed) is near enough to ring', kind: 'estimate', source: 'A working figure of @rulecad/cad: a lightly damped mode amplifies a forcing within about ±20% of it several times over', checked: '2026-11-17' },
56
+ together: { value: 32, unit: 'poses', rule: 'Where two or more moving joints are mounted on the frame\'s beams, they are also swept together: every joint at each end and each step of frame.sweep, all combined, where that makes no more than this many poses; else each at its ends and middle combined, where that makes no more than this many; else every joint at the same share of its travel at once, and at its ends in every combination that fits under this many. So a gantry\'s carriage at the middle of a beam that is itself at the middle of its travel is found', kind: 'default', source: 'A working figure of @rulecad/cad: each pose is a solve of the whole frame, so the combinations are held to a number a check takes seconds over', checked: '2026-11-25' },
56
57
  sweep: { value: 4, unit: 'steps', rule: 'A moving joint mounted on a beam is solved at each end of its travel and at this many equal steps of it between (its quarters), so a worst place between the ends is found: a carriage between two supports at its middle, an arm on a hinge where it lies level', kind: 'default', source: 'A working figure of @rulecad/cad: quarters hold a middle and the quarter points, each step one more solve of every check', checked: '2026-11-24' },
57
58
  ramp: { value: 500, unit: 'mm/s²', rule: 'Where the task gives no accel, the acceleration a move ramps at: a move at the task\'s speed ramps for speed over this many seconds, and shakes the frame at about one over that time', kind: 'default', source: 'The same default as cad machine\'s task.accel (lib/machine.mjs)', checked: '2026-11-17' },
58
59
  };
@@ -236,6 +237,28 @@ export function frameModelOf(s, helpers) {
236
237
  const [lo, hi] = j.dofs[0], drawn = base[j.id]?.[0], between = Array.from({ length: steps - 1 }, (_, k) => lo + ((hi - lo) * (k + 1)) / steps).filter((v) => !(drawn != null && Math.abs(drawn - v) < 1e-6));
237
238
  for (const v of [lo, hi, ...between]) poses.push({ label: `${j.id} at ${n3(v, 1)}`, values: { ...base, [j.id]: [v] } });
238
239
  }
240
+ // and swept together (frame.together): every combination of their steps, else of their ends and middles, else all at
241
+ // one share of their travel at once and their ends combined; a combination already solved is not solved again
242
+ const together = { joints: movers.map((j) => j.id), how: null };
243
+ if (movers.length > 1) {
244
+ const cap = FRAME_CHECK.together.value, at = (j, share) => j.dofs[0][0] + (j.dofs[0][1] - j.dofs[0][0]) * share;
245
+ const shares = (n) => Array.from({ length: n + 1 }, (_, k) => k / n), grid = (sh) => movers.reduce((acc, j) => acc.flatMap((c) => sh.map((x) => [...c, [j, at(j, x)]])), [[]]);
246
+ let combos;
247
+ if ((steps + 1) ** movers.length <= cap) { combos = grid(shares(steps)); together.how = `every combination of their ${steps + 1} places each`; }
248
+ else if (3 ** movers.length <= cap) { combos = grid(shares(2)); together.how = 'every combination of their ends and middles'; }
249
+ else {
250
+ combos = shares(steps).map((x) => movers.map((j) => [j, at(j, x)]));
251
+ if (2 ** movers.length <= cap) combos.push(...grid([0, 1]));
252
+ together.how = `all at one share of their travel at once, in ${steps} steps${2 ** movers.length <= cap ? ', and their ends in every combination' : ''} (too many joints to combine every place: ${3 ** movers.length} poses for their ends and middles alone)`;
253
+ }
254
+ const seen = new Set(poses.map((c) => JSON.stringify(movers.map((j) => r3(c.values[j.id]?.[0] ?? 0)))));
255
+ for (const c of combos) {
256
+ const key = JSON.stringify(c.map(([, v]) => r3(v)));
257
+ if (seen.has(key)) continue;
258
+ seen.add(key);
259
+ poses.push({ label: c.map(([j, v]) => `${j.id} at ${n3(v, 1)}`).join(', '), values: { ...base, ...Object.fromEntries(c.map(([j, v]) => [j.id, [v]])) } });
260
+ }
261
+ }
239
262
  // what a joint must push or turn against ("loads" on joints: a force on a slide, a torque on a hinge, and a belt's
240
263
  // push at its carriage's acceleration), carried through the joint, held by its motor, into the beam its chain is
241
264
  // mounted on: each in every pose, one way and then the other (none says which way it acts). A belt's share of its
@@ -248,7 +271,28 @@ export function frameModelOf(s, helpers) {
248
271
  if (!mt) { loose.push(`the load on ${j.id}`); continue; }
249
272
  onJoints.push({ joint: j, value: Math.abs(l.value), unit: j.type === 'prismatic' ? 'N' : 'N m', note: l.note ?? null, belt: l.belt ?? null, mount: mt });
250
273
  }
251
- const cases = onJoints.length ? poses.flatMap((c) => [{ ...c, label: `${c.label}, joint loads +`, push: 1 }, { ...c, label: `${c.label}, joint loads -`, push: -1 }]) : poses;
274
+ // a motor turning a joint mounted on a beam, the motor itself on a still beam: what it does to the frame. Driving a
275
+ // hinge, the torque it turns the arm with is held at its own mount (the arm's inertia pushes back through it): its
276
+ // most torque at its working speed, through its gearing, one way and the other in every pose, as a joint's load at the
277
+ // motor's mount. Run into a hard stop at an end of the travel, it stalls there with its holding torque: the stop and
278
+ // the motor's mount take that push (or turn) equal and opposite, a pair inside the frame, along the joint's line
279
+ const stalls = [];
280
+ for (const d of motion.drives || []) {
281
+ if (!d.joint) continue;
282
+ const fg = (x) => d.model?.figures?.[x]?.value, hold = atCurrent(d.model, d.spec, fg('holding_torque') ?? fg('stall_torque') ?? 0);
283
+ for (const j of motion.joints.filter((x) => moving(x) && x.dofs?.length === 1 && !motion.joints.some((y) => y.follow?.[0] === x.id))) {
284
+ let t; try { t = trainFrom(motion, j.id); } catch { continue; }
285
+ if (t.root !== d.joint) continue;
286
+ const mt = mountOf(j.child), mm = mountOf(d.item);
287
+ if (!mt) continue;
288
+ if (!mm || mm.mover) { loose.push(`${d.id}'s push on ${j.id} (the motor moves with what it drives, or is on no beam)`); continue; }
289
+ const out = (T) => (t.slide != null ? (T * t.ratio * t.efficiency * 1000 * Math.PI) / (180 * t.slide) : T * t.ratio * t.efficiency), unit = t.slide != null ? 'N' : 'N m';
290
+ if (j.type === 'revolute') { let avail = 0; try { avail = mountTorque(d); } catch { avail = 0; } if (avail > 0) onJoints.push({ joint: j, value: out(avail), unit, note: `${d.id}'s reaction, the most torque it turns ${j.id} with`, belt: null, mount: mm, motor: d.id }); }
291
+ if (hold > 0) for (const [end, sign] of [[j.dofs[0][0], -1], [j.dofs[0][1], 1]]) stalls.push({ joint: j, motor: d.id, value: out(hold), unit, sign, end, mount: mt, motorMount: mm, hold, label: `${j.id} at ${n3(end, 1)}, ${d.id} stalled against its stop` });
292
+ }
293
+ }
294
+ const cases = [...(onJoints.length ? poses.flatMap((c) => [{ ...c, label: `${c.label}, joint loads +`, push: 1 }, { ...c, label: `${c.label}, joint loads -`, push: -1 }]) : poses),
295
+ ...stalls.map((x) => ({ label: x.label, values: { ...base, [x.joint.id]: [x.end] }, stall: x }))];
252
296
 
253
297
  // what weighs on the frame: items (beams' own weight is the elements'), and the masses of "loads"
254
298
  const masses = massesOf(s, { placeItems, jointValues }), carried = [], unknown = [];
@@ -287,6 +331,7 @@ export function frameModelOf(s, helpers) {
287
331
  loads.push({ index: i, kg: l.mass, where, item: l.item, point, mount: mt, note: l.note });
288
332
  });
289
333
  for (const c of [...carried, ...loads.filter((l) => l.mount), ...onJoints]) for (const cs of poses) snap(c.mount.beam, mountStation(c.mount, cs.values));
334
+ for (const x of stalls) { const v = { ...base, [x.joint.id]: [x.end] }; snap(x.mount.beam, mountStation(x.mount, v)); snap(x.motorMount.beam, mountStation(x.motorMount, v)); }
290
335
  // named points, and every guide's travel
291
336
  const points = (opts.points ?? []).map((p, i) => {
292
337
  const t = String(p), id = t.split('.')[0], b = beams.get(id);
@@ -418,7 +463,7 @@ export function frameModelOf(s, helpers) {
418
463
  }
419
464
  }
420
465
  // the loads at each pose: every carried item's and load's weight as a force and a moment at its node
421
- const nodeLoads = (values, only, push) => {
466
+ const nodeLoads = (values, only, push, stall) => {
422
467
  const W = placeItems(motion, values), out = [];
423
468
  const put = (b, z, C, kg) => { const n = nodeAt(b, z); if (!n) throw new Error(`frame: no node on ${b.id} at ${n3(z)} mm for a load (a pose this check did not foresee)`); const F = scale(down, kg * G); out.push({ node: n, force: F, moment: cross(sub(C, nodes[n]), F) }); };
424
469
  for (const c of only ? [] : carried.filter(keep)) put(c.mount.beam, mountStation(c.mount, values), rowsAt(W[c.item], c.centre), c.kg);
@@ -433,6 +478,17 @@ export function frameModelOf(s, helpers) {
433
478
  const { O, Z } = axisOf(motion, W, x.joint, mul), F = x.unit === 'N' ? scale(Z, push * x.value) : [0, 0, 0];
434
479
  out.push({ node: n, force: F, moment: x.unit === 'N' ? cross(sub(O, nodes[n]), F) : scale(Z, push * x.value * 1000) });
435
480
  }
481
+ // a motor stalled against a stop: the push (or turn) on the stop at the joint's place, and back on the motor's mount,
482
+ // both along the joint's line, so they cancel in the whole and load the frame between them
483
+ if (stall && !only && keep(stall) && keep({ mount: stall.motorMount })) {
484
+ const { O, Z } = axisOf(motion, W, stall.joint, mul);
485
+ for (const [mt, k] of [[stall.mount, 1], [stall.motorMount, -1]]) {
486
+ const n = nodeAt(mt.beam, mountStation(mt, values));
487
+ if (!n) throw new Error(`frame: no node on ${mt.beam.id} for ${stall.motor}'s stall (a pose this check did not foresee)`);
488
+ const F = stall.unit === 'N' ? scale(Z, k * stall.sign * stall.value) : [0, 0, 0];
489
+ out.push({ node: n, force: F, moment: stall.unit === 'N' ? cross(sub(O, nodes[n]), F) : scale(Z, k * stall.sign * stall.value * 1000) });
490
+ }
491
+ }
436
492
  return out;
437
493
  };
438
494
  // the same masses for a modal solve: each at the node it is carried at, in kg (its offset's rotary inertia left out)
@@ -449,7 +505,7 @@ export function frameModelOf(s, helpers) {
449
505
  // what is mounted only on beams left out (not held by a support through joins): not weighed, and named
450
506
  const off = [...new Map([...carried, ...loads].filter((c) => !keep(c) && !kept.has(c.id)).map((c) => [c.id ?? `load ${c.index + 1} at ${c.where}`, (c.mount?.beam ?? c.beam).id]))].map(([id, on]) => ({ id, on }));
451
507
  return { beams, left, missing, loose, unknown, off, riding: rides.filter((x) => kept.has(x.id)), carried: carried.filter(keep), loads: loads.filter(keep), points, guides: guides.filter(keep), supports: supports.filter(keep), joins: joins.filter((x) => beams.has(x.A.id)),
452
- cases, poses, onJoints: onJoints.filter(keep), down, nodes, nodeAt, guess, model: withSprings(false), rigid: withSprings(true), nodeLoads, nodeMasses, bays, webs, sheets: heldSheets, laid, elements, mountStation, worlds, axisOf: (j) => axisOf(motion, worlds, j, mul) };
508
+ cases, poses, onJoints: onJoints.filter(keep), stalls: stalls.filter((x) => keep(x) && keep({ mount: x.motorMount })), together, down, nodes, nodeAt, guess, model: withSprings(false), rigid: withSprings(true), nodeLoads, nodeMasses, bays, webs, sheets: heldSheets, laid, elements, mountStation, worlds, axisOf: (j) => axisOf(motion, worlds, j, mul) };
453
509
  }
454
510
 
455
511
  // the downward movement of a node, and along a beam between two stations (the worst of the element stations there)
@@ -498,8 +554,8 @@ export function frameChecks(s, f, helpers) {
498
554
  ? said(level, `${text}. This rests on supports guessed, not given: ${guessHeld}, where on pinned feet nothing would hold it: ${guessSaid}`, card, { ...extra, refs: { ...extra.refs, guessed: guess.supports.map((x) => x.where) } })
499
555
  : said(level, text, card, extra));
500
556
  }
501
- f(guessedOnly ? 'warn' : 'info', `the frame is solved as ${fm.beams.size} beam${fm.beams.size > 1 ? 's' : ''} on ${Object.keys(fm.nodes).length} nodes, held at ${fm.supports.map((x) => `${x.where} (${x.how}, ${x.why})`).join(', ')}, under its own weight${fm.carried.length ? `, ${new Set(fm.carried.map((c) => c.id)).size} item${new Set(fm.carried.map((c) => c.id)).size > 1 ? 's' : ''} mounted on it` : ''}${fm.loads.length ? ` and ${fm.loads.length} load${fm.loads.length > 1 ? 's' : ''}` : ''}${fm.onJoints.length ? `, with ${fm.onJoints.map((x) => `${n3(x.value, 3)} ${x.unit} on ${x.joint.id}${x.belt ? ` (${x.note})` : ''}`).join(', ')} carried into ${[...new Set(fm.onJoints.map((x) => x.mount.beam.id))].join(', ')} through ${fm.onJoints.length > 1 ? 'their joints, each' : 'its joint,'} one way and then the other` : ''}, in ${fm.poses.length} pose${fm.poses.length > 1 ? 's' : ''}${fm.onJoints.length ? ` (${fm.cases.length} cases)` : ''}; ${restsJoins}${estimates ? `, ${estimates} of them an estimate until the joint rig (issue 264) measures it, so each figure is given with the joins rigid too` : ''}${fm.riding.length ? `. ${fm.riding.map((x) => `${x.id} rides on ${x.joint}, its ${n3(x.kg, 3)} kg weighed on the frame${x.on.length > 1 ? `, shared as it lies: ${x.on.map((q) => `${n3(q.share * 100, 0)}% on ${q.beam}`).join(', ')}` : `, all of it on ${x.on[0].beam}, the beam its joint is on`}`).join('; ')}` : ''}${fm.webs.length ? `. ${fm.webs.map((w) => `${w.id} is a shear web on its bay, ${n3(w.k, 0)} N/mm along its diagonal (${w.clips} clips, their grip an estimate)`).join('; ')}` : ''}${fm.laid.length ? `. ${fm.laid.map((p) => `${p.id} lies on ${p.beams.join(', ')}, which are not joined round it as a bay: its ${n3(p.kg, 3)} kg is spread along them, and it is no shear web`).join('; ')}` : ''}${held.length ? `. Nothing holds it one way: ${heldSaid}, with nothing resisting. Its loads do not move it that way, so it is held there for the sag and the stresses; its modes and buckling count it free (frame.frequency, frame.buckling), and a push that way finds it free (frame.rack). Hold it with "frame": { "supports" } fixed or resting, or join it into a box` : ''}${fm.left.length ? `. Left out: ${fm.left.join(', ')} (not held by a support through joins)` : ''}${fm.off.length ? `. Not weighed on the frame, as the beam carrying it is left out: ${fm.off.map((x) => `${x.id} (on ${x.on})`).join(', ')}` : ''}${fm.loose.length ? `. Not on a beam, so not weighed on the frame: ${fm.loose.join(', ')}` : ''}${fm.unknown.length ? `. No mass known for ${fm.unknown.join(', ')}` : ''}${guess ? `. Its supports are guessed: nothing says where it is held (no feet, no "frame": { "supports" }), and on its lowest ends pinned, as a foot stands on a floor, nothing would hold it: ${guessSaid}. So it is solved with ${guessHeld}${pinnedGuess.length ? ` (${and(pinnedGuess)} pinned, a guess too)` : ''}, and every sag, rack, buckling and frequency figure rests on those ends held from turning, which nothing in the assembly gives. Give it feet, or say how it is held in "frame": { "supports" }` : guessedOnly ? `. Its supports are guessed: nothing says where it is held (no feet, no "frame": { "supports" }), so it stands on its lowest ends, ${and(pinnedGuess)}, pinned, as feet stand on a floor, and every figure rests on that. Give it feet, or say how it is held in "frame": { "supports" }` : ''}`, guessedOnly ? 'frame: supports guessed' : null,
502
- { code: 'frame.solve', values: { beams: fm.beams.size, nodes: Object.keys(fm.nodes).length, cases: fm.cases.length, poses: fm.poses.length, joins: fm.joins.length, estimates }, refs: { supports: fm.supports.map((x) => x.where), ...(guess ? { guessed: [...guess.supports.map((x) => x.where), ...pinnedGuess], free: guess.free, how: guessHow.map((h) => h.says) } : guessedOnly ? { guessed: pinnedGuess } : {}), left: fm.left, off: fm.off, onJoints: fm.onJoints.map((x) => ({ joint: x.joint.id, value: r3(x.value), unit: x.unit, beam: x.mount.beam.id, note: x.note })), held, ...(held.length ? { how: heldHow.map((h) => h.says) } : {}), laid: fm.laid.map((p) => ({ id: p.id, kg: r3(p.kg), beams: p.beams })), riding: fm.riding.map((x) => ({ ...x, kg: r3(x.kg) })), loose: fm.loose, rests } });
557
+ f(guessedOnly ? 'warn' : 'info', `the frame is solved as ${fm.beams.size} beam${fm.beams.size > 1 ? 's' : ''} on ${Object.keys(fm.nodes).length} nodes, held at ${fm.supports.map((x) => `${x.where} (${x.how}, ${x.why})`).join(', ')}, under its own weight${fm.carried.length ? `, ${new Set(fm.carried.map((c) => c.id)).size} item${new Set(fm.carried.map((c) => c.id)).size > 1 ? 's' : ''} mounted on it` : ''}${fm.loads.length ? ` and ${fm.loads.length} load${fm.loads.length > 1 ? 's' : ''}` : ''}${fm.onJoints.length ? `, with ${fm.onJoints.map((x) => `${n3(x.value, 3)} ${x.unit} on ${x.joint.id}${x.belt || x.motor ? ` (${x.note})` : ''}`).join(', ')} carried into ${[...new Set(fm.onJoints.map((x) => x.mount.beam.id))].join(', ')} through ${fm.onJoints.length > 1 ? 'their joints, each' : 'its joint,'} one way and then the other` : ''}${fm.stalls.length ? `, and ${[...new Map(fm.stalls.map((x) => [`${x.motor} ${x.joint.id}`, x])).values()].map((x) => `${x.motor} stalled against ${x.joint.id}'s stop at each end of its travel (${n3(x.value, 3)} ${x.unit} from its ${n3(x.hold, 3)} N m holding torque, on the stop and back on its mount on ${x.motorMount.beam.id})`).join(', ')}` : ''}, in ${fm.poses.length} pose${fm.poses.length > 1 ? 's' : ''}${fm.together.how ? ` (${fm.together.joints.join(', ')} each swept and then together: ${fm.together.how})` : ''}${fm.onJoints.length || fm.stalls.length ? ` (${fm.cases.length} cases)` : ''}; ${restsJoins}${estimates ? `, ${estimates} of them an estimate until the joint rig (issue 264) measures it, so each figure is given with the joins rigid too` : ''}${fm.riding.length ? `. ${fm.riding.map((x) => `${x.id} rides on ${x.joint}, its ${n3(x.kg, 3)} kg weighed on the frame${x.on.length > 1 ? `, shared as it lies: ${x.on.map((q) => `${n3(q.share * 100, 0)}% on ${q.beam}`).join(', ')}` : `, all of it on ${x.on[0].beam}, the beam its joint is on`}`).join('; ')}` : ''}${fm.webs.length ? `. ${fm.webs.map((w) => `${w.id} is a shear web on its bay, ${n3(w.k, 0)} N/mm along its diagonal (${w.clips} clips, their grip an estimate)`).join('; ')}` : ''}${fm.laid.length ? `. ${fm.laid.map((p) => `${p.id} lies on ${p.beams.join(', ')}, which are not joined round it as a bay: its ${n3(p.kg, 3)} kg is spread along them, and it is no shear web`).join('; ')}` : ''}${held.length ? `. Nothing holds it one way: ${heldSaid}, with nothing resisting. Its loads do not move it that way, so it is held there for the sag and the stresses; its modes and buckling count it free (frame.frequency, frame.buckling), and a push that way finds it free (frame.rack). Hold it with "frame": { "supports" } fixed or resting, or join it into a box` : ''}${fm.left.length ? `. Left out: ${fm.left.join(', ')} (not held by a support through joins)` : ''}${fm.off.length ? `. Not weighed on the frame, as the beam carrying it is left out: ${fm.off.map((x) => `${x.id} (on ${x.on})`).join(', ')}` : ''}${fm.loose.length ? `. Not on a beam, so not weighed on the frame: ${fm.loose.join(', ')}` : ''}${fm.unknown.length ? `. No mass known for ${fm.unknown.join(', ')}` : ''}${guess ? `. Its supports are guessed: nothing says where it is held (no feet, no "frame": { "supports" }), and on its lowest ends pinned, as a foot stands on a floor, nothing would hold it: ${guessSaid}. So it is solved with ${guessHeld}${pinnedGuess.length ? ` (${and(pinnedGuess)} pinned, a guess too)` : ''}, and every sag, rack, buckling and frequency figure rests on those ends held from turning, which nothing in the assembly gives. Give it feet, or say how it is held in "frame": { "supports" }` : guessedOnly ? `. Its supports are guessed: nothing says where it is held (no feet, no "frame": { "supports" }), so it stands on its lowest ends, ${and(pinnedGuess)}, pinned, as feet stand on a floor, and every figure rests on that. Give it feet, or say how it is held in "frame": { "supports" }` : ''}`, guessedOnly ? 'frame: supports guessed' : null,
558
+ { code: 'frame.solve', values: { beams: fm.beams.size, nodes: Object.keys(fm.nodes).length, cases: fm.cases.length, poses: fm.poses.length, joins: fm.joins.length, estimates }, refs: { supports: fm.supports.map((x) => x.where), ...(guess ? { guessed: [...guess.supports.map((x) => x.where), ...pinnedGuess], free: guess.free, how: guessHow.map((h) => h.says) } : guessedOnly ? { guessed: pinnedGuess } : {}), left: fm.left, off: fm.off, onJoints: fm.onJoints.map((x) => ({ joint: x.joint.id, value: r3(x.value), unit: x.unit, beam: x.mount.beam.id, note: x.note })), stalls: fm.stalls.map((x) => ({ joint: x.joint.id, motor: x.motor, end: r3(x.end), value: r3(x.value), unit: x.unit, hold: r3(x.hold), stop: x.mount.beam.id, mount: x.motorMount.beam.id })), together: fm.together, held, ...(held.length ? { how: heldHow.map((h) => h.says) } : {}), laid: fm.laid.map((p) => ({ id: p.id, kg: r3(p.kg), beams: p.beams })), riding: fm.riding.map((x) => ({ ...x, kg: r3(x.kg) })), loose: fm.loose, rests } });
503
559
 
504
560
  // ---- frame.deflection: each load's point, each named point, every guide ----
505
561
  const worst = (fn) => { let w = null; for (const r of results) { const v = fn(r.spring, r), v0 = fn(r.rigid, r); if (!w || v.sag > w.sag) w = { ...v, rigid: v0.sag, case: { ...r.case, alone: r.alone } }; } return w; };
@@ -836,7 +892,7 @@ function solveAll(fm) {
836
892
  }
837
893
  function solveCases(fm, fs, fr) {
838
894
  const results = fm.cases.map((c) => {
839
- const loads = fm.nodeLoads(c.values, null, c.push), spring = fs.statics({ loads }), rigid = fr.statics({ loads }), out = { case: c, loads, spring, rigid, values: c.values };
895
+ const loads = fm.nodeLoads(c.values, null, c.push, c.stall), spring = fs.statics({ loads }), rigid = fr.statics({ loads }), out = { case: c, loads, spring, rigid, values: c.values };
840
896
  { out.alone = new Map(); for (const l of fm.loads) { const ll = fm.nodeLoads(c.values, l), n = ll[0]?.node; if (!n) continue; out.alone.set(l, { sag: sagAt(fs.statics({ loads: ll, gravity: [0, 0, 0] }), n, fm.down), rigid: sagAt(fr.statics({ loads: ll, gravity: [0, 0, 0] }), n, fm.down) }); } }
841
897
  return out;
842
898
  });
@@ -94,7 +94,7 @@ const alongOf = (b, ctx) => ({ what: `${b.id} along its length`, beam: b, from:
94
94
  function drawnSags(fm, ctx, targets) {
95
95
  const solver = solveFrame(fm.model), out = new Map(), all = [...targets, ...[...fm.beams.values()].map((b) => alongOf(b, ctx))];
96
96
  for (const cs of fm.cases) {
97
- const res = stamp(fm, fm.model, solver.statics({ loads: fm.nodeLoads(cs.values, null, cs.push) }));
97
+ const res = stamp(fm, fm.model, solver.statics({ loads: fm.nodeLoads(cs.values, null, cs.push, cs.stall) }));
98
98
  for (const t of all) out.set(`${t.what}|${cs.label}`, t.node ? ctx.sagAt(res, t.node(cs.values), fm.down) : ctx.sagAlong(res, t.beam, t.from, t.to, fm.down).sag);
99
99
  }
100
100
  const missed = [];
@@ -115,7 +115,7 @@ function evaluate(s, fm, ctx, cands, targets, drawn) {
115
115
  let def = null, creepSag = null;
116
116
  const per = new Map(cands.map((c) => [c.b.id, { stress: 0, compression: 0, case: null }]));
117
117
  for (const cs of fm.cases) {
118
- const loads = fm.nodeLoads(cs.values, null, cs.push), res = stamp(fm, model, solver.statics({ loads })), cr = stamp(fm, creep, creeper.statics({ loads }));
118
+ const loads = fm.nodeLoads(cs.values, null, cs.push, cs.stall), res = stamp(fm, model, solver.statics({ loads })), cr = stamp(fm, creep, creeper.statics({ loads }));
119
119
  for (const t of all) {
120
120
  // where the frame as drawn already misses this sag, the printed beam is held to the drawn frame's own figure
121
121
  const base = drawn.get(`${t.what}|${cs.label}`) ?? 0, missed = base > t.limit.value + 1e-12, lim = missed ? base * (1 + DRAWN_SLACK) : t.limit.value;
package/lib/framesize.mjs CHANGED
@@ -183,7 +183,7 @@ export function frameSizing(s, helpers, given) {
183
183
  const limits = { ...(deflection.length ? { deflection } : {}), stress: { margin: stress }, buckling: { factor, euler: FRAME_CHECK.euler.value }, ...(Hz != null ? { frequency: { Hz } } : {}) };
184
184
  // every beam's alloy carries its strength, so the beams outside the groups are held to it too
185
185
  const withStrength = (model) => ({ ...model, materials: Object.fromEntries(Object.entries(model.materials).map(([k, v]) => [k, fm.beams.get(k)?.strength ? { ...v, strength: fm.beams.get(k).strength } : v])) });
186
- const cases = [...fm.cases.map((c) => ({ label: c.label, loads: fm.nodeLoads(c.values, null, c.push), inertia: fm.nodeMasses(c.values) })), ...rackCases];
186
+ const cases = [...fm.cases.map((c) => ({ label: c.label, loads: fm.nodeLoads(c.values, null, c.push, c.stall), inertia: fm.nodeMasses(c.values) })), ...rackCases];
187
187
  const byName = new Map(choices.map((c) => [c.name, c]));
188
188
  // every join a group's beam makes must go together with the profiles chosen (joinFit): a design where one does not is
189
189
  // never solved, and a lighter choice that breaks one is what set the group. A join as drawn is not asked again
package/lib/guides.mjs CHANGED
@@ -215,7 +215,16 @@ export function expandGuides(a, num, context = framesContext(), material = 'pla'
215
215
  const fit = guideFit(m, B.profile, { face, from, beam: B.length, keep, ...(g.nut ? { nut: g.nut } : {}), given: givenFor(context, B.profile.name) });
216
216
  const rid = id, record = { id, kind: 'rail', beam: bid, face: q.name, from, length, model: m, fit, carriages: [], joints: [], keep, note: g.note ?? null };
217
217
  added.push({ id: rid, bought: m.set, _guide: { part: 'rail', model: m }, at: `${bid}.${q.name}@${r3(from)}`, guideOf: id });
218
- // its screws into the slot, at its holes: only where a nut is made for them (else guide.fit says why)
218
+ // its screws into the slot, at its holes: only where a nut is made for them (else guide.fit says why); or, with
219
+ // "nut": "printed", into hex nuts in a printed carrier strip in the slot under the rail, a nut under each hole
220
+ if (fit.carrier) {
221
+ const nid = `${id}-nuts`, c = fit.carrier;
222
+ if (ids.has(nid)) throw new Error(`${what}: ${nid} is an item already: give the guide another id`);
223
+ ids.add(nid);
224
+ added.push({ id: nid, fitting: { kind: 'nut-carrier', profile: B.profile.name, face, thread: m.rail.thread, count: c.count, ...(c.count > 1 ? { pitch: c.pitch } : {}) }, at: `${bid}.${q.name}@${r3(from + m.holes[0] - c.at[0])}`, guideOf: id });
225
+ fasten.push({ screw: `${m.rail.thread} cap`, through: [rid], into: nid, at: m.screws.map((x) => `${rid}.${x.name}`), note: `${id}: the rail into the hex nuts in ${nid}, a screw every ${mm(m.rail.pitch)} mm`, guideOf: id });
226
+ fits.push({ a: nid, b: bid, fastens: true, min: -100, note: `${nid} in ${bid}'s ${q.name} slot, held there by the rail's screws` });
227
+ }
219
228
  if (fit.nut) fasten.push({ screw: `${m.rail.thread} cap`, through: [rid], into: `${bid}.${q.name}`, at: m.screws.map((x) => `${rid}.${x.name}`), nut: g.nut ?? fit.nut.nutKind, note: `${id}: the rail into ${bid}'s ${q.name} slot, a screw every ${mm(m.rail.pitch)} mm`, guideOf: id });
220
229
  // the carriages, each on its own slide along the beam, from the start of its share of the rail
221
230
  const normal = [q.normal[0], q.normal[1], 0], terms = (() => { try { return railTerms(m, B.profile, { beam: B.length, face, given: givenFor(context, B.profile.name) }); } catch { return m.terms; } })();
package/lib/list.mjs CHANGED
@@ -77,7 +77,9 @@ export function shoppingList(s) {
77
77
  add(m.name, m.count, `${m.item} on ${m.other} (its mount, a fit that fastens)`, { kind: 'screw', thread: m.thread, length: m.length, head: m.head, grams });
78
78
  }
79
79
  // what a printed fitting takes besides its screws: a hinge's pin and its nut, a catch's magnet and strike (lib/fittings.mjs)
80
- for (const o of s.objects) if (o.fitting?.hardware && !o.unplaced) for (const h of o.fitting.hardware) add(h.name, h.count ?? 1, `${o.id} (${h.why ?? 'its fitting'})`, { kind: h.kind, thread: h.thread ?? null, length: h.length ?? null, head: h.head ?? null, grams: null });
80
+ // (a nut carrier's nuts that a fasten placed in it are listed with that fasten, not again)
81
+ const placedIn = (o, h) => (o.fitting.fitting === 'nut-carrier' ? s.parts.filter((p) => p.hardware?.kind === h.kind && p.hardware.thread === h.thread && p.moves === o.id).length : 0);
82
+ for (const o of s.objects) if (o.fitting?.hardware && !o.unplaced) for (const h of o.fitting.hardware) { const n = (h.count ?? 1) - placedIn(o, h); if (n > 0) add(h.name, n, `${o.id} (${h.why ?? 'its fitting'})`, { kind: h.kind, thread: h.thread ?? null, length: h.length ?? null, head: h.head ?? null, grams: null }); }
81
83
  // (pins and magnets a fit names by the schema's form: by name, with their mass and whether they are bought, cut from filament or printed)
82
84
  for (const x of s.fits) if (x.fastener && x.fasten == null) {
83
85
  let more = {}; if (x.pin) try { const m = pinModel(x.fastener, { material: mat.name }); more = { kind: 'pin', made: m.made, thread: null, length: m.length, grams: m.grams }; } catch {}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rulecad/cad",
3
- "version": "0.7.81",
3
+ "version": "0.7.83",
4
4
  "description": "The cad command: JSCAD designs from traceable rules, checked for printing and fit, versioned by what fits, shared as links and exported as Bambu 3MF.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -65,7 +65,7 @@
65
65
  "@rulecad/model-link": "^0.3.2",
66
66
  "@rulecad/versions": "^0.1.6",
67
67
  "@rulecad/shapes": "^0.4.8",
68
- "@rulecad/rules": "^0.3.23",
68
+ "@rulecad/rules": "^0.3.25",
69
69
  "@jscad/modeling": "^2.12.0",
70
70
  "three": "^0.186.1",
71
71
  "@rulecad/fea": "^0.2.14",
@@ -75,7 +75,7 @@
75
75
  "@rulecad/motors": "^0.1.6",
76
76
  "@rulecad/fixings": "^0.1.7",
77
77
  "@rulecad/robots": "^0.1.4",
78
- "@rulecad/frames": "^0.1.12"
78
+ "@rulecad/frames": "^0.1.13"
79
79
  },
80
80
  "peerDependencies": {
81
81
  "@rulecad/pcb": "^0.1.0 || ^0.2.0 || ^0.3.0 || ^0.4.0 || ^0.5.0"
@@ -20,7 +20,7 @@
20
20
  "fits": { "type": "array", "items": { "$ref": "#/$defs/fit" } },
21
21
  "fasten": { "type": "array", "description": "Screwed joints: each names its screw, the parts it passes through in order, and the part it ends in. The holes are read from the parts as drawn and each screw followed along one axis; a fasten holds its parts as a fit that fastens does, lines their holes up as a holes fit does, and puts its screws on the shopping list. Draw the holes with v.fixings, and name the screw with no length: the check chooses one", "items": { "$ref": "#/$defs/fasten" }, "defaultSnippets": [{ "label": "fasten", "description": "A screwed joint", "body": [{ "screw": "${1:M3 cap}", "through": ["${2:bracket}"], "into": "${3:base}", "at": ["${4:bracket.h1}", "${5:bracket.h2}"] }] }] },
22
22
  "joins": { "type": "array", "description": "How beams are joined: each names an end of one beam (a) and a place on another (b), and its kind. A join puts its operations on both beams (a tap in a's end, an access or clearance hole across b), its screws into fasten, and a spring for the frame's solve; join.geometry checks the end meets the face square and flush where b says", "items": { "$ref": "#/$defs/join" }, "defaultSnippets": [{ "label": "join", "description": "A blind join: a's end tapped, its screw's head in b's slot", "body": [{ "kind": "${1:blind}", "a": "${2:y1.a}", "b": "${3:x1.back@120}" }] }] },
23
- "guides": {"type": "array", "description": "Linear motion on a beam. A rail: a miniature rail screwed down on a beam's slotted face into slot nuts at its hole pitch, its carriages each riding its own share of the rail on a sliding joint with its true travel (<id>-1, <id>-2 ..; poses <id>-a and <id>-b put them at either end), their loads held to their ratings as joint.moment. Wheels: a printed plate (<id>-carriage-1) over a beam's face on V-wheels (<id>-wheel-1 ..) in the V tracks of the faces either side, rolling on a sliding joint (<id>-1) through the stretch from..from + length; refused on a face with no V track. A slider: a printed slider (<id>-carriage-1) in or over a slot, on a sliding joint through its stretch. Rods: two smooth rods along a face in printed holders at the stretch's ends (<id>-holder-a, <id>-holder-b, saddles screwed into the slots either side), a printed carriage (<id>-carriage-1) on two linear bearings on a sliding joint; an endstop's printed mount at a side face's address and a flag on the carriage set the joint's home. A screw: a lead screw driving a rods guide's carriage from a printed motor plate (<id>-plate) at its end a, the motor (<id>-motor) a motor item whose lead screw comes from the screw's set, a coupler, the screw, its bearings in the holders and the lead nut on the carriage. A belt: a GT2 belt driving a rail guide's one carriage, from a pulley (<id>-pulley) on a motor (<id>-motor) under a printed plate (<id>-plate) past the beam's end a, round a toothed idler (<id>-idler) on a printed block (<id>-idler-block, the tensioner: two screws in slots along the beam) past the rail's end, both belt ends in a printed clamp (<id>-clamp) on the carriage; the belt (<id>-belt) goes on the list rounded to whole metres, its ratio and the carriage's acceleration to the motor's checks, its stretch to the error budget", "items": {"type": "object", "required": ["kind"], "additionalProperties": false, "properties": {"id": {"type": "string", "description": "Its name (default g1, g2 ..): the rail item takes it"}, "kind": {"enum": ["rail", "wheels", "slider", "rods", "screw", "belt"], "description": "rail (a miniature linear rail, which needs rail), wheels (a plate on V-wheels in a V-slot's tracks), slider (a printed slider in or over a slot), rods (two rods in printed holders and a printed carriage on linear bearings) screw (a lead screw and its motor driving a rods guide, which needs guide and motor) or belt (a timing belt and its motor driving a rail guide's carriage, which needs guide and motor); every kind but screw and belt needs on and length"}, "rail": {"type": "string", "description": "The rail's rule set: rail-mgn7, rail-mgn9, rail-mgn12, rail-mgn15"}, "carriage": {"type": "string", "description": "The carriage, a variant of the rail's set: MGN12C (standard, the default) or MGN12H (long)"}, "on": {"type": "string", "description": "A rail's or a slider's slotted face (x1.top, x1.top.2); for wheels, the face the plate lies over (x1.top), its wheels in the slots either side"}, "from": {"$ref": "#/$defs/expr", "description": "Where the rail or the stretch starts, mm from the beam's end a (default 0)"}, "length": {"$ref": "#/$defs/expr", "description": "The rail as it is cut, mm; for wheels and a slider, the stretch of the beam it runs along, mm"}, "carriages": {"type": "integer", "minimum": 1, "maximum": 8, "description": "How many carriages ride it (default 1)"}, "nut": {"type": "string", "description": "A rail or rods: the slot nuts' kind (slide-in, drop-in, roll-in, square, hammer, t-bolt), for the rail's screws, or the rods' holders, motor plate and endstop mount; between two joins that close a slot at both ends, a slide-in nut is shut in (frame.nut), so give drop-in. A screw: the lead nut's rule set (t8-nut, the default)"}, "note": {"type": "string"}, "wheel": {"type": "string", "description": "Wheels: the V-wheel's rule set, v-wheel-solid (the default) or v-wheel-mini"}, "wheels": {"enum": [3, 4], "description": "Wheels: 4 (two a side, the default) or 3 (one on an eccentric)"}, "pitch": {"$ref": "#/$defs/expr", "description": "Wheels: their spacing along the beam, mm (default a wheel's diameter and 15 mm, rounded up to 5)"}, "load": {"$ref": "#/$defs/expr", "description": "Wheels or a slider: the printed part's design load, N (default 50 for a plate, 20 for a slider)"}, "mode": {"enum": ["over", "in"], "description": "A slider: over the slot (a shoe on the face, keyed into the opening; the default) or in it (a block held under its lips)"}, "size": {"$ref": "#/$defs/expr", "description": "A slider: its own length along the beam, mm (default 30)"}, "rod": {"type": "string", "description": "Rods: the rods' rule set (rod-8, the default)"}, "bearing": {"type": "string", "description": "Rods: the linear bearings' rule set (lm8uu, the default, or lm8luu)"}, "spacing": {"$ref": "#/$defs/expr", "description": "Rods: their distance apart across the face, mm (default room for the bearings and a lead nut's flange between)"}, "height": {"$ref": "#/$defs/expr", "description": "Rods: the rods' and screw's height over the face, mm (default the least that clears the carriage, the nut, the screw's bearing, the coupler and the motor). A belt: the belt's middle over the face, mm (default the least that both the clamp's floor over the carriage and the idler's block, its M5 insert under the idler, take; give more for room under the return run for what is screwed to the carriage)"}, "endstop": {"type": "object", "required": ["at"], "additionalProperties": false, "description": "Rods: an endstop on a printed mount; its lever meets a flag on the carriage, and the joint homes there", "properties": {"at": {"type": "string", "description": "An address on a face beside the rods: x1.front@80"}, "switch": {"type": "string", "description": "The switch's rule set (endstop-10t85, the default)"}}}, "guide": {"type": "string", "description": "A screw: the id of the rods guide whose carriage it drives; a belt: the id of the rail guide whose one carriage it drives"}, "pulley": {"type": "string", "description": "A belt: the pulley's rule set on the motor's shaft (pulley-gt2-20, the default, or pulley-gt2-16)"}, "idler": {"type": "string", "description": "A belt: the idler's rule set (idler-gt2-toothed-20, the default)"}, "belt": {"type": "string", "description": "A belt: the belt's rule set (gt2-belt-6, the default)"}, "tension": {"$ref": "#/$defs/expr", "description": "A belt: each span's tension, N (default 25, an estimate)"}, "accel": {"$ref": "#/$defs/expr", "description": "A belt: the carriage's acceleration it is checked at, mm/s² (default the task's accel, else 1000)"}, "cut": {"$ref": "#/$defs/expr", "description": "A belt: its length as cut, mm (default the whole teeth that set its tension with the idler's block in the middle of its slots)"}, "across": {"$ref": "#/$defs/expr", "description": "A belt: the idler's axle off the line that squares the belt to the travel, mm (default 0)"}, "idlerAt": {"$ref": "#/$defs/expr", "description": "A belt: where the idler's block starts, mm from the beam's end a (default it ends at end b)"}, "screw": {"type": "string", "description": "A screw: the lead screw's rule set (t8-screw, the default)"}, "support": {"type": ["string", "null"], "description": "A screw: the ball bearing each holder takes the screw in (bearing-608, the default), or null for none"}, "coupler": {"type": "string", "description": "A screw: the coupler from the motor's shaft to the screw (coupler-5-8, the default)"}, "motor": {"type": "object", "required": ["model"], "description": "A screw or a belt: the motor item's spec ({ \"model\": \"28byj48\", \"microsteps\": 1 }): its drives and leadscrew come from the guide"}, "friction": {"$ref": "#/$defs/expr", "description": "A screw: the nut's friction on the screw (default the screw's set's, an estimate)"}}}, "defaultSnippets": [{"label": "rail", "description": "An MGN12 rail on a beam's top face", "body": [{"kind": "rail", "rail": "${1:rail-mgn12}", "on": "${2:x1.top}", "from": 0, "length": "${3:300}"}]}, {"label": "wheels", "description": "A plate on four V-wheels over a V-slot beam's top face", "body": [{"kind": "wheels", "wheel": "${1:v-wheel-solid}", "on": "${2:x1.top}", "from": 0, "length": "${3:400}"}]}, {"label": "a rail and a belt", "description": "An MGN12H rail on a 2020's top face, its carriage driven by a NEMA 17 through a GT2 belt", "body": [{"kind": "rail", "rail": "rail-mgn12", "carriage": "MGN12H", "on": "${1:x1.top}", "from": "${2:40}", "length": "${3:300}"}, {"kind": "belt", "guide": "g1", "motor": {"model": "${4:nema17}"}}]}, {"label": "rods and a screw", "description": "Two 8 mm rods on a beam's top face, a carriage on LM8UUs, driven by a 28BYJ-48 through a T8 screw", "body": [{"kind": "rods", "on": "${1:x1.top}", "from": "${2:60}", "length": "${3:120}"}, {"kind": "screw", "guide": "g1", "screw": "t8-screw", "motor": {"model": "${4:28byj48}"}}]}]},
23
+ "guides": {"type": "array", "description": "Linear motion on a beam. A rail: a miniature rail screwed down on a beam's slotted face into slot nuts at its hole pitch, its carriages each riding its own share of the rail on a sliding joint with its true travel (<id>-1, <id>-2 ..; poses <id>-a and <id>-b put them at either end), their loads held to their ratings as joint.moment. Wheels: a printed plate (<id>-carriage-1) over a beam's face on V-wheels (<id>-wheel-1 ..) in the V tracks of the faces either side, rolling on a sliding joint (<id>-1) through the stretch from..from + length; refused on a face with no V track. A slider: a printed slider (<id>-carriage-1) in or over a slot, on a sliding joint through its stretch. Rods: two smooth rods along a face in printed holders at the stretch's ends (<id>-holder-a, <id>-holder-b, saddles screwed into the slots either side), a printed carriage (<id>-carriage-1) on two linear bearings on a sliding joint; an endstop's printed mount at a side face's address and a flag on the carriage set the joint's home. A screw: a lead screw driving a rods guide's carriage from a printed motor plate (<id>-plate) at its end a, the motor (<id>-motor) a motor item whose lead screw comes from the screw's set, a coupler, the screw, its bearings in the holders and the lead nut on the carriage. A belt: a GT2 belt driving a rail guide's one carriage, from a pulley (<id>-pulley) on a motor (<id>-motor) under a printed plate (<id>-plate) past the beam's end a, round a toothed idler (<id>-idler) on a printed block (<id>-idler-block, the tensioner: two screws in slots along the beam) past the rail's end, both belt ends in a printed clamp (<id>-clamp) on the carriage; the belt (<id>-belt) goes on the list rounded to whole metres, its ratio and the carriage's acceleration to the motor's checks, its stretch to the error budget", "items": {"type": "object", "required": ["kind"], "additionalProperties": false, "properties": {"id": {"type": "string", "description": "Its name (default g1, g2 ..): the rail item takes it"}, "kind": {"enum": ["rail", "wheels", "slider", "rods", "screw", "belt"], "description": "rail (a miniature linear rail, which needs rail), wheels (a plate on V-wheels in a V-slot's tracks), slider (a printed slider in or over a slot), rods (two rods in printed holders and a printed carriage on linear bearings) screw (a lead screw and its motor driving a rods guide, which needs guide and motor) or belt (a timing belt and its motor driving a rail guide's carriage, which needs guide and motor); every kind but screw and belt needs on and length"}, "rail": {"type": "string", "description": "The rail's rule set: rail-mgn7, rail-mgn9, rail-mgn12, rail-mgn15"}, "carriage": {"type": "string", "description": "The carriage, a variant of the rail's set: MGN12C (standard, the default) or MGN12H (long)"}, "on": {"type": "string", "description": "A rail's or a slider's slotted face (x1.top, x1.top.2); for wheels, the face the plate lies over (x1.top), its wheels in the slots either side"}, "from": {"$ref": "#/$defs/expr", "description": "Where the rail or the stretch starts, mm from the beam's end a (default 0)"}, "length": {"$ref": "#/$defs/expr", "description": "The rail as it is cut, mm; for wheels and a slider, the stretch of the beam it runs along, mm"}, "carriages": {"type": "integer", "minimum": 1, "maximum": 8, "description": "How many carriages ride it (default 1)"}, "nut": {"type": "string", "description": "A rail or rods: the slot nuts' kind (slide-in, drop-in, roll-in, square, hammer, t-bolt), for the rail's screws, or the rods' holders, motor plate and endstop mount; between two joins that close a slot at both ends, a slide-in nut is shut in (frame.nut), so give drop-in. A rail: printed puts a printed carrier strip in the slot under it, a hex nut at each hole (<id>-nuts), where no slot nut is sold for its thread. A screw: the lead nut's rule set (t8-nut, the default)"}, "note": {"type": "string"}, "wheel": {"type": "string", "description": "Wheels: the V-wheel's rule set, v-wheel-solid (the default) or v-wheel-mini"}, "wheels": {"enum": [3, 4], "description": "Wheels: 4 (two a side, the default) or 3 (one on an eccentric)"}, "pitch": {"$ref": "#/$defs/expr", "description": "Wheels: their spacing along the beam, mm (default a wheel's diameter and 15 mm, rounded up to 5)"}, "load": {"$ref": "#/$defs/expr", "description": "Wheels or a slider: the printed part's design load, N (default 50 for a plate, 20 for a slider)"}, "mode": {"enum": ["over", "in"], "description": "A slider: over the slot (a shoe on the face, keyed into the opening; the default) or in it (a block held under its lips)"}, "size": {"$ref": "#/$defs/expr", "description": "A slider: its own length along the beam, mm (default 30)"}, "rod": {"type": "string", "description": "Rods: the rods' rule set (rod-8, the default)"}, "bearing": {"type": "string", "description": "Rods: the linear bearings' rule set (lm8uu, the default, or lm8luu)"}, "spacing": {"$ref": "#/$defs/expr", "description": "Rods: their distance apart across the face, mm (default room for the bearings and a lead nut's flange between)"}, "height": {"$ref": "#/$defs/expr", "description": "Rods: the rods' and screw's height over the face, mm (default the least that clears the carriage, the nut, the screw's bearing, the coupler and the motor). A belt: the belt's middle over the face, mm (default the least that both the clamp's floor over the carriage and the idler's block, its M5 insert under the idler, take; give more for room under the return run for what is screwed to the carriage)"}, "endstop": {"type": "object", "required": ["at"], "additionalProperties": false, "description": "Rods: an endstop on a printed mount; its lever meets a flag on the carriage, and the joint homes there", "properties": {"at": {"type": "string", "description": "An address on a face beside the rods: x1.front@80"}, "switch": {"type": "string", "description": "The switch's rule set (endstop-10t85, the default)"}}}, "guide": {"type": "string", "description": "A screw: the id of the rods guide whose carriage it drives; a belt: the id of the rail guide whose one carriage it drives"}, "pulley": {"type": "string", "description": "A belt: the pulley's rule set on the motor's shaft (pulley-gt2-20, the default, or pulley-gt2-16)"}, "idler": {"type": "string", "description": "A belt: the idler's rule set (idler-gt2-toothed-20, the default)"}, "belt": {"type": "string", "description": "A belt: the belt's rule set (gt2-belt-6, the default)"}, "tension": {"$ref": "#/$defs/expr", "description": "A belt: each span's tension, N (default 25, an estimate)"}, "accel": {"$ref": "#/$defs/expr", "description": "A belt: the carriage's acceleration it is checked at, mm/s² (default the task's accel, else 1000)"}, "cut": {"$ref": "#/$defs/expr", "description": "A belt: its length as cut, mm (default the whole teeth that set its tension with the idler's block in the middle of its slots)"}, "across": {"$ref": "#/$defs/expr", "description": "A belt: the idler's axle off the line that squares the belt to the travel, mm (default 0)"}, "idlerAt": {"$ref": "#/$defs/expr", "description": "A belt: where the idler's block starts, mm from the beam's end a (default it ends at end b)"}, "screw": {"type": "string", "description": "A screw: the lead screw's rule set (t8-screw, the default)"}, "support": {"type": ["string", "null"], "description": "A screw: the ball bearing each holder takes the screw in (bearing-608, the default), or null for none"}, "coupler": {"type": "string", "description": "A screw: the coupler from the motor's shaft to the screw (coupler-5-8, the default)"}, "motor": {"type": "object", "required": ["model"], "description": "A screw or a belt: the motor item's spec ({ \"model\": \"28byj48\", \"microsteps\": 1 }): its drives and leadscrew come from the guide"}, "friction": {"$ref": "#/$defs/expr", "description": "A screw: the nut's friction on the screw (default the screw's set's, an estimate)"}}}, "defaultSnippets": [{"label": "rail", "description": "An MGN12 rail on a beam's top face", "body": [{"kind": "rail", "rail": "${1:rail-mgn12}", "on": "${2:x1.top}", "from": 0, "length": "${3:300}"}]}, {"label": "wheels", "description": "A plate on four V-wheels over a V-slot beam's top face", "body": [{"kind": "wheels", "wheel": "${1:v-wheel-solid}", "on": "${2:x1.top}", "from": 0, "length": "${3:400}"}]}, {"label": "a rail and a belt", "description": "An MGN12H rail on a 2020's top face, its carriage driven by a NEMA 17 through a GT2 belt", "body": [{"kind": "rail", "rail": "rail-mgn12", "carriage": "MGN12H", "on": "${1:x1.top}", "from": "${2:40}", "length": "${3:300}"}, {"kind": "belt", "guide": "g1", "motor": {"model": "${4:nema17}"}}]}, {"label": "rods and a screw", "description": "Two 8 mm rods on a beam's top face, a carriage on LM8UUs, driven by a 28BYJ-48 through a T8 screw", "body": [{"kind": "rods", "on": "${1:x1.top}", "from": "${2:60}", "length": "${3:120}"}, {"kind": "screw", "guide": "g1", "screw": "t8-screw", "motor": {"model": "${4:28byj48}"}}]}]},
24
24
  "joints": { "type": "array", "items": { "$ref": "#/$defs/joint" } },
25
25
  "loops": { "type": "array", "items": { "$ref": "#/$defs/loop" } },
26
26
  "planetary": { "type": "array", "items": { "$ref": "#/$defs/planetary" } },