@rulecad/cad 0.7.60 → 0.7.62
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/AGENTS.md +22 -5
- package/CHANGELOG.md +61 -0
- package/EXAMPLES.md +29 -49
- package/README.md +104 -2
- package/bin/cad.mjs +97 -15
- package/lib/assembly.mjs +2 -0
- package/lib/belts.mjs +62 -0
- package/lib/edit.mjs +493 -36
- package/lib/errors.mjs +1 -1
- package/lib/fasten.mjs +1 -1
- package/lib/fittings.mjs +11 -1
- package/lib/guides.mjs +100 -9
- package/lib/motors.mjs +16 -8
- package/lib/schema.mjs +2 -2
- package/lib/versions.mjs +6 -2
- package/package.json +2 -2
- package/schemas/assembly.schema.json +2 -2
- package/schemas/project.schema.json +31 -0
package/lib/fittings.mjs
CHANGED
|
@@ -29,6 +29,7 @@ const MORE = {
|
|
|
29
29
|
'rail-jig': ['railJigModel', 'railJig'], 'wheel-plate': ['wheelsModel', 'wheelPlate'], slider: ['sliderModel', 'slider'],
|
|
30
30
|
'nut-carrier': ['carrierModel', 'carrier', { pose: { fit: 'slot', print: 'print' } }],
|
|
31
31
|
'rod-holder': ['rodHolderModel', 'rodHolder'], 'rod-carriage': ['rodCarriageModel', 'rodCarriage'], 'motor-plate': ['motorPlateModel', 'motorPlate'], 'endstop-mount': ['endstopMountModel', 'endstopMount'],
|
|
32
|
+
'belt-plate': ['beltPlateModel', 'beltPlate'], 'belt-clamp': ['beltClampModel', 'beltClamp', { profile: false }], 'belt-idler': ['beltIdlerModel', 'beltIdler'],
|
|
32
33
|
};
|
|
33
34
|
// the kinds whose tongue or stem stands in the slot, inside the beam's envelope: the overlap check measures them without it
|
|
34
35
|
const TONGUED = ['panel-clip', 'magnet-catch', 'panel-corner', 'cable-clip', 'tie-anchor', 'spool-holder', 'rail-jig', 'slider', 'end-cap'];
|
|
@@ -62,12 +63,21 @@ export const fittingCache = {
|
|
|
62
63
|
export function plasticOf(project) {
|
|
63
64
|
let raw;
|
|
64
65
|
try { raw = JSON.parse(fs.readFileSync(path.join(paths.project(project), 'project.json'), 'utf8')).material; } catch { return 'pla'; }
|
|
66
|
+
return plasticNamed(raw, `project ${project}`);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* A plastic by the name a project.json gives it: pla or petg, or a rule set (the workspace's rules/, then the kit's)
|
|
71
|
+
* that gives strength, modulus and density; refused by name otherwise. Used by plasticOf and by cad set's check.
|
|
72
|
+
* @param {any} raw the material as written @param {string} [where] what names it, for the refusal @returns {string | object}
|
|
73
|
+
*/
|
|
74
|
+
export function plasticNamed(raw, where = 'the project') {
|
|
65
75
|
const m = String(raw || 'pla').trim().toLowerCase().split(/\s/)[0];
|
|
66
76
|
if (['pla', 'petg'].includes(m)) return m;
|
|
67
77
|
let set = null; try { set = peekRuleSet(m); } catch {}
|
|
68
78
|
const lacks = ['strength', 'modulus', 'density'].filter((k) => !(typeof set?.rules?.[k]?.value === 'number'));
|
|
69
79
|
if (set && !lacks.length) return set;
|
|
70
|
-
throw new Error(
|
|
80
|
+
throw new Error(`${where}: its material is ${JSON.stringify(raw)}, and printed fittings are sized from their plastic's strength, modulus and density: ${set ? `rules/${m}.json gives no ${lacks.join(', ')}` : `the kit has pla and petg, and there is no rules/${m}.json`}. Give rules/${m}.json with all three, or set the material to pla or petg`);
|
|
71
81
|
}
|
|
72
82
|
|
|
73
83
|
/**
|
package/lib/guides.mjs
CHANGED
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
// V tracks either side over the stretch from..from + length; wheels on a face with no V track are refused with why. A
|
|
13
13
|
// slider is a printed part (the fitting slider) on its sliding joint along the slot "on" names. Units: mm, N, N m, kg.
|
|
14
14
|
import jscad from '@jscad/modeling';
|
|
15
|
-
import { railModel, rail, carriage, carriageMargin, guideFit, railTerms, railJigModel, GUIDE_DEFAULTS, vWheel, wheelMargin, rodsLayout, rodMargin, ROD_DEFAULTS } from '@rulecad/frames';
|
|
15
|
+
import { railModel, rail, carriage, carriageMargin, guideFit, railTerms, railJigModel, GUIDE_DEFAULTS, vWheel, wheelMargin, rodsLayout, rodMargin, ROD_DEFAULTS, beltLayout, beltRub, BELT_DEFAULTS } from '@rulecad/frames';
|
|
16
16
|
import { beamOf, framesContext } from './beams.mjs';
|
|
17
17
|
import { givenFor } from './frames.mjs';
|
|
18
18
|
import { named } from './parts.mjs';
|
|
@@ -20,11 +20,13 @@ import { referenceBuilt } from './bought.mjs';
|
|
|
20
20
|
import { fittingModel } from './fittings.mjs';
|
|
21
21
|
|
|
22
22
|
const KEYS = { rail: ['id', 'kind', 'rail', 'carriage', 'on', 'from', 'length', 'carriages', 'nut', 'note'], wheels: ['id', 'kind', 'wheel', 'wheels', 'pitch', 'load', 'on', 'from', 'length', 'note'], slider: ['id', 'kind', 'mode', 'size', 'load', 'on', 'from', 'length', 'note'],
|
|
23
|
-
rods: ['id', 'kind', 'rod', 'bearing', 'spacing', 'height', 'load', 'on', 'from', 'length', 'endstop', 'nut', 'note'], screw: ['id', 'kind', 'guide', 'screw', 'nut', 'support', 'coupler', 'motor', 'friction', 'note']
|
|
24
|
-
|
|
23
|
+
rods: ['id', 'kind', 'rod', 'bearing', 'spacing', 'height', 'load', 'on', 'from', 'length', 'endstop', 'nut', 'note'], screw: ['id', 'kind', 'guide', 'screw', 'nut', 'support', 'coupler', 'motor', 'friction', 'note'],
|
|
24
|
+
belt: ['id', 'kind', 'guide', 'motor', 'pulley', 'idler', 'belt', 'tension', 'accel', 'cut', 'across', 'idlerAt', 'height', 'nut', 'note'] };
|
|
25
|
+
const { cylinder, cuboid, polygon } = jscad.primitives, { translate, rotateZ } = jscad.transforms, { subtract, union } = jscad.booleans, { extrudeRotate } = jscad.extrusions;
|
|
25
26
|
const shown = (v) => (v === undefined ? 'nothing' : JSON.stringify(v));
|
|
27
|
+
const up2 = (x, step) => Math.ceil(x / step - 1e-9) * step;
|
|
26
28
|
const mm = (x) => String(+Number(x).toFixed(2)), r3 = (x) => +x.toFixed(3), n3 = (x, d = 2) => String(Number(Number(x).toFixed(d)));
|
|
27
|
-
const strip = (e) => String(e?.message ?? e).replace(/^(railModel|guideFit|railTerms|railJigModel|wheelsModel|sliderModel|rodsLayout): /, '');
|
|
29
|
+
const strip = (e) => String(e?.message ?? e).replace(/^(railModel|guideFit|railTerms|railJigModel|wheelsModel|sliderModel|rodsLayout|beltLayout|beltPlateModel|beltClampModel|beltIdlerModel): /, '');
|
|
28
30
|
const G = 9.80665;
|
|
29
31
|
const SETS_OF = (m) => ({ diameter: r3(2 * (m.seat.axle + m.seat.depth)) });
|
|
30
32
|
const SETS_KIND = (L) => `${L.bearing.set}'s ratings as its set gives them: a single bush's moment capacity is worked as a couple along it, an estimate`;
|
|
@@ -77,7 +79,7 @@ export function expandGuides(a, num, context = framesContext(), material = 'pla'
|
|
|
77
79
|
for (const k of Object.keys(g)) if (!KEYS.screw.includes(k)) throw new Error(`${what}: a screw guide has no "${k}": it takes ${KEYS.screw.join(', ')}`);
|
|
78
80
|
const target = list.find((x) => x && (x.id ?? `g${list.indexOf(x) + 1}`) === g.guide);
|
|
79
81
|
if (!target) throw new Error(`${what}: guide names the rods guide whose carriage the screw drives, by its id (got ${shown(g.guide)}; guides: ${list.map((x, k) => x?.id ?? `g${k + 1}`).join(', ')})`);
|
|
80
|
-
if (target.kind !== 'rods') throw new Error(`${what}: a screw drives a rods guide's carriage, and ${g.guide} is a ${target.kind} guide; a belt and screws on rails or wheels are not built yet`);
|
|
82
|
+
if (target.kind !== 'rods') throw new Error(`${what}: a screw drives a rods guide's carriage, and ${g.guide} is a ${target.kind} guide; a rail guide's carriage is driven by a belt, and screws on rails or wheels are not built yet`);
|
|
81
83
|
if (screws.has(g.guide)) throw new Error(`${what}: ${g.guide} is driven by another screw already: one drive to a carriage`);
|
|
82
84
|
if (!g.motor || typeof g.motor !== 'object' || typeof g.motor.model !== 'string') throw new Error(`${what}: motor is the motor item's spec, as { "model": "28byj48", "microsteps": 1 }: its drives and leadscrew come from the guide (got ${shown(g.motor)})`);
|
|
83
85
|
for (const k of ['drives', 'leadscrew', 'belt']) if (g.motor[k] != null) throw new Error(`${what}: motor.${k} comes from the guide: leave it out`);
|
|
@@ -184,8 +186,8 @@ export function expandGuides(a, num, context = framesContext(), material = 'pla'
|
|
|
184
186
|
list.forEach((g, i) => {
|
|
185
187
|
const what = `guide ${g?.id ?? i + 1}`;
|
|
186
188
|
if (!g || typeof g !== 'object' || Array.isArray(g)) throw new Error(`${what} is { "kind": "rail", "rail": "rail-mgn12", "on": "x1.top", "length": 300 } (got ${shown(g)})`);
|
|
187
|
-
if (!KEYS[g.kind]) throw new Error(`${what}: kind is rail (a miniature linear 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, a printed carriage on linear bearings)
|
|
188
|
-
if (g.kind === 'screw') return; // (worked out with the rods guide it drives)
|
|
189
|
+
if (!KEYS[g.kind]) throw new Error(`${what}: kind is rail (a miniature linear 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, a printed carriage on linear bearings) screw (a lead screw and its motor driving a rods guide's carriage) or belt (a timing belt and its motor driving a rail guide's carriage) (got ${shown(g.kind)})`);
|
|
190
|
+
if (g.kind === 'screw' || g.kind === 'belt') return; // (a screw worked out with the rods guide it drives, a belt once the rail it drives is)
|
|
189
191
|
for (const k of Object.keys(g)) if (!KEYS[g.kind].includes(k)) throw new Error(`${what}: a ${g.kind} guide has no "${k}": it takes ${KEYS[g.kind].join(', ')}`);
|
|
190
192
|
const id = g.id ?? `g${i + 1}`;
|
|
191
193
|
if (!/^[a-z][\w-]*$/.test(id) || ids.has(id)) throw new Error(`${what}: id ${shown(id)} is ${ids.has(id) ? 'an item already' : 'not a name (letters, digits, - or _)'}`);
|
|
@@ -211,7 +213,7 @@ export function expandGuides(a, num, context = framesContext(), material = 'pla'
|
|
|
211
213
|
keep.push({ from: r3(d - half), to: r3(d + half), what: `${other} joined at ${j.b}` });
|
|
212
214
|
}
|
|
213
215
|
const fit = guideFit(m, B.profile, { face, from, beam: B.length, keep, ...(g.nut ? { nut: g.nut } : {}), given: givenFor(context, B.profile.name) });
|
|
214
|
-
const rid = id, record = { id, beam: bid, face: q.name, from, length, model: m, fit, carriages: [], joints: [], keep, note: g.note ?? null };
|
|
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 };
|
|
215
217
|
added.push({ id: rid, bought: m.set, _guide: { part: 'rail', model: m }, at: `${bid}.${q.name}@${r3(from)}`, guideOf: id });
|
|
216
218
|
// its screws into the slot, at its holes: only where a nut is made for them (else guide.fit says why)
|
|
217
219
|
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 });
|
|
@@ -230,6 +232,52 @@ export function expandGuides(a, num, context = framesContext(), material = 'pla'
|
|
|
230
232
|
try { record.jig = railJigModel(B.profile, { rail: m.set, face, given: givenFor(context, B.profile.name) }); } catch (e) { record.jig = { error: String(e.message).replace(/^railJigModel: /, '') }; }
|
|
231
233
|
guides.push(record);
|
|
232
234
|
});
|
|
235
|
+
// a belt drives a rail guide's one carriage: worked out once the rail is, from its carriage's place and travel
|
|
236
|
+
const belts = new Set();
|
|
237
|
+
list.forEach((g, i) => {
|
|
238
|
+
if (g?.kind !== 'belt') return;
|
|
239
|
+
const id = g.id ?? `g${i + 1}`, what = `guide ${g.id ?? i + 1}`;
|
|
240
|
+
for (const k of Object.keys(g)) if (!KEYS.belt.includes(k)) throw new Error(`${what}: a belt guide has no "${k}": it takes ${KEYS.belt.join(', ')}`);
|
|
241
|
+
if (!/^[a-z][\w-]*$/.test(id) || ids.has(id)) throw new Error(`${what}: id ${shown(id)} is ${ids.has(id) ? 'an item already' : 'not a name (letters, digits, - or _)'}`);
|
|
242
|
+
const named_ = list.map((x, k) => x?.id ?? `g${k + 1}`), target = guides.find((x) => x.id === g.guide);
|
|
243
|
+
if (!target) throw new Error(`${what}: guide names the rail guide whose carriage the belt drives, by its id (got ${shown(g.guide)}; guides: ${named_.join(', ')})`);
|
|
244
|
+
if (target.kind !== 'rail') throw new Error(`${what}: a belt drives a rail guide's carriage, and ${g.guide} is a ${target.kind} guide; a rods guide is driven by a screw`);
|
|
245
|
+
if (target.carriages.length !== 1) throw new Error(`${what}: a belt drives one carriage, and ${g.guide} has ${target.carriages.length}: give it "carriages": 1`);
|
|
246
|
+
if (belts.has(g.guide)) throw new Error(`${what}: ${g.guide} is driven by another belt already: one drive to a carriage`);
|
|
247
|
+
belts.add(g.guide);
|
|
248
|
+
if (!g.motor || typeof g.motor !== 'object' || typeof g.motor.model !== 'string') throw new Error(`${what}: motor is the motor item's spec, as { "model": "nema17", "microsteps": 16 }: its drives and its belt come from the guide (got ${shown(g.motor)})`);
|
|
249
|
+
for (const k of ['drives', 'leadscrew', 'belt']) if (g.motor[k] != null) throw new Error(`${what}: motor.${k} comes from the guide: leave it out`);
|
|
250
|
+
ids.add(id);
|
|
251
|
+
const bid = target.beam, B = beamOf(beams.get(bid), num, context).model, q = B.places.find((x) => x.name === target.face), face = B.places.filter((x) => x.face === q.face).length > 1 ? q.name : q.face;
|
|
252
|
+
const m = target.model, c = m.carriage, ln = m.lanes[0], opt = (k) => (g[k] != null ? { [k]: num(g[k]) } : {}), set = (k) => (g[k] != null ? { [k]: String(g[k]) } : {});
|
|
253
|
+
let L;
|
|
254
|
+
try {
|
|
255
|
+
L = beltLayout(B.profile.name, { face, beam: B.length, rail: { from: target.from, length: target.length, width: m.rail.width, height: m.rail.height }, carriage: { top: c.height, width: c.width, length: c.lengthMax ?? c.length, clearance: c.clearance, holes: c.holes, thread: c.thread, depth: c.depth, rest: ln.rest, travel: ln.travel },
|
|
256
|
+
motor: g.motor.model, ...set('pulley'), ...set('idler'), ...set('belt'), ...set('nut'), ...opt('tension'), ...opt('across'), ...opt('idlerAt'), ...opt('cut'), ...opt('height'), material, given: givenFor(context, B.profile.name) });
|
|
257
|
+
} catch (e) { throw new Error(`${what}: ${strip(e)}`); }
|
|
258
|
+
const own = (x) => { if (ids.has(x)) throw new Error(`${what}: ${x} is an item already: give the guide another id`); ids.add(x); return x; };
|
|
259
|
+
const plate = own(`${id}-plate`), mo = own(`${id}-motor`), pu = own(`${id}-pulley`), cl = own(`${id}-clamp`), blk = own(`${id}-idler-block`), il = own(`${id}-idler`), bt = own(`${id}-belt`);
|
|
260
|
+
const cid = target.carriages[0], jid = target.joints[0], S = L.sets, at0 = `${bid}.${q.name}@0`;
|
|
261
|
+
added.push({ id: plate, fitting: { kind: 'belt-plate', profile: B.profile.name, ...L.specs.plate }, at: at0, guideOf: id });
|
|
262
|
+
added.push({ id: mo, motor: { ...g.motor, drives: jid, belt: { teeth: S.pulley.teeth, pitch: S.belt.pitch, stiffness: S.belt.kw, width: S.belt.width, length: L.span, load: 0 } }, at: `${plate}.motor`, guideOf: id });
|
|
263
|
+
added.push({ id: pu, bought: S.pulley.set, _guide: { part: 'pulley', ...S.pulley }, at: `${plate}.pulley`, guideOf: id });
|
|
264
|
+
added.push({ id: cl, fitting: { kind: 'belt-clamp', ...L.specs.clamp }, at: `${cid}.top`, guideOf: id });
|
|
265
|
+
added.push({ id: blk, fitting: { kind: 'belt-idler', profile: B.profile.name, ...L.specs.idler }, at: `${bid}.${q.name}@${L.idler.block}`, guideOf: id });
|
|
266
|
+
added.push({ id: il, bought: S.idler.set, _guide: { part: 'idler', ...S.idler }, at: `${blk}.axle`, guideOf: id });
|
|
267
|
+
// the belt itself: drawn where the carriage is at the start of its travel, left out of the overlap check (its runs
|
|
268
|
+
// move with the carriage, so belt.rub holds them to the parts they pass through the whole travel)
|
|
269
|
+
const drawn = L.drawn(target.from + ln.rest), tb = S.belt.thickness;
|
|
270
|
+
added.push({ id: bt, bought: S.belt.set, _guide: { part: 'belt', set: S.belt.set, length: L.buy, cut: L.cut, height: L.height, width: S.belt.width, thickness: tb, runs: drawn.runs, wraps: drawn.wraps }, at: at0, guideOf: id });
|
|
271
|
+
const pm = L.plate, bm = L.block, cm = L.clamp, screwsOf = (x, mdl) => mdl.screws.map((_, k) => `${x}.b${k + 1}`);
|
|
272
|
+
fasten.push({ screw: `${pm.thread} ${pm.head}`, through: [plate], into: `${bid}.${q.name}`, at: screwsOf(plate, pm), nut: g.nut ?? pm.screws[0].nutKind, note: `${id}: the motor's plate into ${bid}'s ${q.name} slot`, guideOf: id });
|
|
273
|
+
fasten.push({ screw: `${cm.thread} cap`, through: [cl], into: cid, at: screwsOf(cl, cm), note: `${id}: the belt's clamp into ${cid}'s tapped holes`, guideOf: id });
|
|
274
|
+
fasten.push({ screw: `${bm.thread} cap`, through: [blk], into: `${bid}.${q.name}`, at: screwsOf(blk, bm), nut: g.nut ?? bm.screws[0].nutKind, note: `${id}: the idler's block into ${bid}'s ${q.name} slot, slid along it to tension the belt`, guideOf: id });
|
|
275
|
+
fits.push({ a: mo, b: plate, fastens: true, min: -0.1, note: 'The motor\'s face under its plate' }, { a: mo, b: pu, min: -100, note: 'The motor\'s shaft in the pulley' }, { a: il, b: blk, fastens: true, min: -0.1, note: 'The idler on its axle, on the block\'s ring' });
|
|
276
|
+
const spec = joints.find((x) => x.id === jid);
|
|
277
|
+
if (spec) spec._guide.belt = id;
|
|
278
|
+
guides.push({ id, kind: 'belt', guide: g.guide, on: bid, face: q.name, layout: L, rub: beltRub(L), motor: mo, carriage: cid, items: { plate, motor: mo, pulley: pu, clamp: cl, block: blk, idler: il, belt: bt },
|
|
279
|
+
accel: g.accel != null ? num(g.accel) : null, tensionGiven: g.tension != null, carriages: [], joints: [jid], wheels: [], note: g.note ?? null, fasten: [] });
|
|
280
|
+
});
|
|
233
281
|
const out = { ...a, items: [...items, ...added], ...(fasten.length ? { fasten: [...(a.fasten || []), ...fasten] } : {}), ...(fits.length ? { fits: [...(a.fits || []), ...fits] } : {}), joints: [...(a.joints || []), ...joints], poses: { ...(a.poses || {}), ...poses } };
|
|
234
282
|
for (const r of guides) r.fasten = fasten.map((x, k) => (x.guideOf === r.id ? first + k : -1)).filter((k) => k >= 0);
|
|
235
283
|
return { a: out, guides };
|
|
@@ -242,6 +290,25 @@ export function expandGuides(a, num, context = framesContext(), material = 'pla'
|
|
|
242
290
|
*/
|
|
243
291
|
export function guideBuilt(it, id) {
|
|
244
292
|
const { part, model: m } = it._guide;
|
|
293
|
+
// a belt drive's bought parts: the pulley and the idler, drawn round their own z from their sets' figures; the belt
|
|
294
|
+
// along its path as drawn, in its frame on the face (out of the overlap check: belt.rub holds it through the travel)
|
|
295
|
+
if (part === 'pulley' || part === 'idler') {
|
|
296
|
+
const g = it._guide, body = subtract(translate([0, 0, g.body / 2], cylinder({ radius: g.od / 2, height: g.body, segments: 48 })), translate([0, 0, g.body / 2], cylinder({ radius: g.bore / 2, height: g.body + 2, segments: 24 })));
|
|
297
|
+
const parts = named({ body }, { body: { label: `${g.set}` } }), anchors = { origin: { at: [0, 0, 0], axis: [0, 0, 1], ref: [1, 0, 0] } };
|
|
298
|
+
return referenceBuilt({ id, key: `guide-${part}`, objName: `${part}:${g.set}`, name: g.set, parts, anchors, entries: [], values: { pitch_diameter: g.pd, outer_diameter: g.od, body_width: g.body, bore: g.bore, ...(g.teeth ? { teeth: g.teeth } : {}) }, extra: { bought: { set: g.set, variant: null, part, mass: null } } });
|
|
299
|
+
}
|
|
300
|
+
if (part === 'belt') {
|
|
301
|
+
const g = it._guide, z0 = g.height - g.width / 2, t = g.thickness, pieces = [];
|
|
302
|
+
for (const r of g.runs) {
|
|
303
|
+
const dx = r.to[0] - r.from[0], dy = r.to[1] - r.from[1], len = Math.hypot(dx, dy);
|
|
304
|
+
if (len < 0.01) continue;
|
|
305
|
+
pieces.push(translate([(r.from[0] + r.to[0]) / 2, (r.from[1] + r.to[1]) / 2, g.height], rotateZ(Math.atan2(dy, dx), cuboid({ size: [len, t, g.width] }))));
|
|
306
|
+
}
|
|
307
|
+
for (const w of g.wraps) pieces.push(translate([w.at[0], w.at[1], 0], extrudeRotate({ segments: 48, startAngle: w.from, angle: Math.min(w.angle, 2 * Math.PI - 1e-3) }, polygon({ points: [[w.r - t / 2, z0], [w.r + t / 2, z0], [w.r + t / 2, z0 + g.width], [w.r - t / 2, z0 + g.width]] }))));
|
|
308
|
+
const parts = named({ body: union(...pieces) }, { body: { label: `${g.set} x ${mm(g.cut)} mm, cut from ${mm(g.length)} mm` } });
|
|
309
|
+
parts[0].collide = jscad.geometries.geom3.create();
|
|
310
|
+
return referenceBuilt({ id, key: 'guide-belt', objName: `belt:${g.set}:${g.cut}`, name: g.set, parts, anchors: { origin: { at: [0, 0, 0], axis: [0, 0, 1], ref: [1, 0, 0] } }, entries: [], values: { length: g.length, cut: g.cut, width: g.width }, extra: { bought: { set: g.set, variant: null, part: 'belt', mass: null, length: g.length } } });
|
|
311
|
+
}
|
|
245
312
|
// a screw drive's bought parts, drawn from their sets' figures along their own z: the coupler, the screw, the lead nut
|
|
246
313
|
if (part === 'coupler' || part === 'screw' || part === 'nut') {
|
|
247
314
|
const g = it._guide, rod = (r, z0, z1, seg = 48) => translate([0, 0, (z0 + z1) / 2], cylinder({ radius: r, height: z1 - z0, segments: seg }));
|
|
@@ -269,7 +336,8 @@ export function guideBuilt(it, id) {
|
|
|
269
336
|
const c = m.carriage, parts = named({ body: carriage(m) }, { body: { label: `${m.set} carriage ${c.variant ?? ''}`.trim() } });
|
|
270
337
|
const anchors = { slide: { at: [0, 0, 0], axis: [1, 0, 0], ref: [0, 0, 1] }, top: { at: [0, 0, c.height], axis: [0, 0, 1], ref: [1, 0, 0] }, ...Object.fromEntries(c.holes.map(([x, y], k) => [`t${k + 1}`, { at: [x, y, c.height], axis: [0, 0, -1] }])) };
|
|
271
338
|
const values = { length: c.length, width: c.width, height: c.height, travel: m.travel, static_rating: c.ratings.C0, moment_roll: c.ratings.MR, moment_pitch: c.ratings.MP, moment_yaw: c.ratings.MY, ...(c.mass != null ? { mass: c.mass } : {}) };
|
|
272
|
-
|
|
339
|
+
// (its tapped holes are its mount: a fasten into the carriage ends in its own thread, held to the depth its maker gives)
|
|
340
|
+
return referenceBuilt({ id, key: 'guide-carriage', objName: `carriage:${m.set}:${c.variant}`, name: `${m.set} ${c.variant}`, parts, anchors, entries: [], values, extra: { guide: m, bought: { set: m.set, variant: c.variant, part: 'carriage', mass: c.mass ?? null, mount: { thread: c.thread, holes: c.holes, reach: c.depth } } } });
|
|
273
341
|
}
|
|
274
342
|
|
|
275
343
|
/**
|
|
@@ -286,6 +354,7 @@ export function guideFindings(s, f) {
|
|
|
286
354
|
if (r.endstop) f('info', `${r.id}: ${r.endstop.switch} on its printed mount at ${r.endstop.at}; the carriage's flag meets its lever ${mm(r.endstop.home)} mm along the travel, where the joint homes (the lever's place is an estimate: measure your switch's lever and its pretravel)`, null, { code: 'guide.endstop', values: { home: r.endstop.home, lever: r.endstop.model.lever }, refs: { ...refs, switch: r.endstop.switch, mount: r.endstop.mount } });
|
|
287
355
|
continue;
|
|
288
356
|
}
|
|
357
|
+
if (r.kind === 'belt') { beltFindings(r, f); continue; }
|
|
289
358
|
if (r.kind === 'screw') {
|
|
290
359
|
const L = r.layout, refs = { guide: r.id, drives: r.guide, motor: r.motor, ...r.items };
|
|
291
360
|
f('info', `${r.id}: ${L.motor.set} on a printed plate ${mm(r.from)} mm along ${r.beam}, through ${L.coupler.set} to ${mm(r.length)} mm of ${L.screw.set} (a ${mm(r.lead)} mm lead${L.support ? `, in a ${L.support.set} at each holder` : ''}), the ${L.nut.set} on ${r.guide}'s carriage; the lead and the nut's friction μ ${n3(r.friction, 3)} (${r.frictionKind ?? 'default'}) go to the motor's checks as a lead screw`, null, { code: 'guide.drive', values: { lead: r.lead, length: r.length, friction: r.friction, engaged: r.plate.engaged }, refs });
|
|
@@ -352,3 +421,25 @@ export function carriageChecks(s, f, helpers, { masses, beyond, poses }) {
|
|
|
352
421
|
f(r.level, text, r.level === 'pass' ? null : `${j.id}: carriage ${n3(r.margin, 1)}×`, { code: 'joint.moment', at: O, refs: { joint: j.id, carriage: spec._guide.carriage, guide: spec._guide.id, rail: m.set }, values: { force: load.force, moment: load.moment, ratios: r.ratios, margin: r.margin, carried: kg, pose: p.label, ratings: c } });
|
|
353
422
|
}
|
|
354
423
|
}
|
|
424
|
+
|
|
425
|
+
// A belt drive's findings: what it is and its ratio, its length to cut and to buy, its tension, whether its runs rub
|
|
426
|
+
// what they pass through the travel, whether it lies square, and what is left of the tensioner's travel
|
|
427
|
+
function beltFindings(r, f) {
|
|
428
|
+
const L = r.layout, S = L.sets, B = S.belt, refs = { guide: r.id, drives: r.guide, carriage: r.carriage, ...r.items }, T = L.tension;
|
|
429
|
+
f('info', `${r.id}: ${S.pulley.set} on ${r.motor} under its printed plate past ${r.on}'s end a, ${B.set} round ${S.idler.set} on its printed block at ${mm(L.idler.block)} mm, both ends in the clamp on ${r.carriage}: ${S.pulley.teeth} teeth × ${mm(B.pitch)} mm is ${mm(L.mmPerTurn)} mm of travel a turn, the belt ${mm(L.height)} mm over the face; the motor's checks read it as a belt`, null, { code: 'guide.drive', values: { mmPerTurn: L.mmPerTurn, teeth: S.pulley.teeth, pitch: B.pitch, height: L.height }, refs });
|
|
430
|
+
f('info', `${r.id}: the belt's path is ${mm(L.length)} mm by its pitch line (the working runs, ${mm(L.pulley.r * 2)} and ${mm(L.idler.r * 2)} mm pitch circles, the return run and the ends in the clamp); cut it ${mm(L.cut)} mm, ${mm(L.cut / B.pitch)} teeth, which stretches ${mm(L.stretch)} mm at ${mm(T)} N; buy ${mm(L.buy / 1000)} m (${BELT_DEFAULTS.sold.rule.split(':')[0].toLowerCase()}: an estimate)`, null, { code: 'belt.length', values: { path: L.length, cut: L.cut, buy: L.buy, stretch: L.stretch, teeth: L.cut / B.pitch }, refs });
|
|
431
|
+
// (the belt carries the push and, off level, the weight's part along the travel: the two together at their worst)
|
|
432
|
+
const push = r.force ?? 0, W = r.weight ?? 0, F = push + W, slack = T - F / 2, tight = T + F / 2, lo = B.least ?? 0, hi = B.rated ?? Infinity, ok = slack >= lo - 1e-9 && tight <= hi + 1e-9;
|
|
433
|
+
f(ok ? 'pass' : 'fail', `${r.id}: each span at ${mm(T)} N (${r.tensionGiven ? 'given' : 'BELT_DEFAULTS.tension, an estimate'}); pushing ${r.carried != null ? `${n3(r.carried * 1000, 0)} g at ${n3(r.accelUsed, 0)} mm/s²` : 'the carriage'} takes ${n3(push, 2)} N${W ? `, and its weight along the travel ${n3(W, 2)} N more` : ''}, so the spans run from ${n3(slack, 2)} to ${n3(tight, 2)} N, ${ok ? 'within' : 'outside'} ${B.set}'s ${mm(lo)} N least static and ${mm(hi)} N rated tension${ok ? '' : slack < lo ? ': more tension' : `: less tension or less ${W ? 'weight or ' : ''}acceleration`}`, ok ? null : `${r.id}: belt tension`, { code: 'belt.tension', values: { tension: T, force: F, push, weight: W, slack, tight, least: lo, rated: hi }, refs });
|
|
434
|
+
// (what the carriage carries, by its box: a part on its free holes rubs the return run unless it stays under the belt's
|
|
435
|
+
// band or the belt is raised over it, height; the room under the band is said either way)
|
|
436
|
+
const carried = r.carriedParts ?? [], under = r3(L.height - B.width / 2 - L.carriage.top), raise = (top) => Math.ceil((top + B.width / 2 + 1) * 2) / 2;
|
|
437
|
+
for (const x of r.rub.rubs) f('fail', x.carried ? `${r.id}: ${x.run} rubs ${x.part}, which ${r.carriage} carries, ${mm(x.depth)} mm into its box with the carriage at ${mm(x.at)} mm along ${r.on}: the belt's band is ${mm(under)} mm over the carriage's top. Raise the belt over it with "height": ${mm(raise(x.top))} (1 mm clear of its ${mm(x.top)} mm top), or keep the part under the band or clear of the run across the carriage`
|
|
438
|
+
: `${r.id}: ${x.run} rubs ${x.part}, ${mm(x.depth)} mm into it with the carriage at ${mm(x.at)} mm along ${r.on}: move the idler or the pulley back onto the belt's square line, or the part out of its way`, `${r.id}: belt rubs ${x.part}`, { code: 'belt.rub', values: { depth: x.depth, carriage: x.at, under, ...(x.carried ? { top: x.top, height: raise(x.top) } : {}) }, refs: { ...refs, run: x.run, part: x.part } });
|
|
439
|
+
if (!r.rub.rubs.length) f('pass', `${r.id}: through the carriage's travel the belt's runs clear the beam, the rail, the carriage${carried.length ? `, the clamp and what the carriage carries (${carried.join(', ')}, by their boxes)` : ' and the clamp'}, by ${mm(r.rub.least.clearance)} mm at least (${r.rub.least.run} and ${r.rub.least.part}, the carriage at ${mm(r.rub.least.at)} mm; the belt ${mm(B.thickness)} mm thick, an estimate). The return run passes ${mm(under)} mm over the carriage's top: a part screwed to its free holes stays under that, or the belt goes higher ("height")`, null, { code: 'belt.rub', values: { clearance: r.rub.least.clearance, carriage: r.rub.least.at, under }, refs: { ...refs, ...(carried.length ? { carried } : {}) } });
|
|
440
|
+
const lim = BELT_DEFAULTS.line.value, square = L.line <= lim + 1e-9;
|
|
441
|
+
f(square ? 'pass' : 'fail', `${r.id}: the idler's top is ${mm(L.across)} mm off the pulley's line along the travel, ${n3(L.line, 3)}° off square, ${square ? 'within' : 'past'} the ${lim}° the belt is held to (BELT_DEFAULTS.line, an estimate)${square ? '' : ': move the idler back onto the line'}`, square ? null : `${r.id}: belt off square`, { code: 'belt.line', values: { angle: L.line, across: L.across, limit: lim }, refs });
|
|
442
|
+
const d = L.idler.offset, room = d >= 0 ? L.idler.room.b : L.idler.room.a, way = d >= 0 ? 'toward the beam\'s end b' : 'toward the rail', fits = Math.abs(d) <= room + 1e-9;
|
|
443
|
+
f(fits ? 'pass' : 'fail', `${r.id}: cut ${mm(L.cut)} mm, the belt sets its tension with the idler's block ${mm(Math.abs(d))} mm ${way} from where it is drawn, along the slot, which leaves it ${mm(room)} mm that way${fits ? `: ${mm(room - Math.abs(d))} mm of the tensioner's travel left` : `: the tensioner's travel is used up; cut the belt ${mm(up2(2 * (Math.abs(d) - room), B.pitch))} mm ${d >= 0 ? 'shorter' : 'longer'}, or move the block`}`, fits ? null : `${r.id}: tensioner used up`, { code: 'belt.tensioner', values: { offset: d, room: L.idler.room, left: r3(room - Math.abs(d)) }, refs });
|
|
444
|
+
f('info', `${r.id}: the belt holds the carriage on two spans, the pulley's side a and the idler's side b; at its least stiff they act as ${mm(L.span)} mm of belt (a·b/(a+b), the most of it through the travel); at ${n3(B.k, 0)} N a unit of strain (${B.set}'s stiffness, ${B.kKind ?? 'its kind not given'}), ${n3(F, 2)} N${W ? ` (the push and the weight along the travel)` : ''} stretches it ${n3((F * L.span) / B.k, 4)} mm: the belt stretch term of the error budget where a task is given`, null, { code: 'belt.stretch', values: { span: L.span, stiffness: B.k, force: F, stretch: (F * L.span) / B.k }, refs });
|
|
445
|
+
}
|
package/lib/motors.mjs
CHANGED
|
@@ -118,15 +118,18 @@ const cross = (a, b) => [a[1] * b[2] - a[2] * b[1], a[2] * b[0] - a[0] * b[2], a
|
|
|
118
118
|
function loadAt(motion, loads, worlds, j, mul) {
|
|
119
119
|
const { O, Z } = axisOf(motion, worlds, j, mul), byChild = new Map(motion.joints.map((x) => [x.child, x]));
|
|
120
120
|
const beyond = (k) => { for (let i = k, n = 0; i >= 0 && n < 99; n++) { const x = byChild.get(i); if (!x) return false; if (x === j) return true; i = x.parent; } return false; };
|
|
121
|
-
let total = 0;
|
|
121
|
+
let total = 0, push = 0;
|
|
122
122
|
for (const l of loads) {
|
|
123
|
-
if (l.joint === j.id)
|
|
123
|
+
if (l.joint === j.id && l.belt) push += Math.abs(l.value);
|
|
124
|
+
else if (l.joint === j.id) total += l.value;
|
|
124
125
|
else if (l.mass != null && beyond(l.item)) {
|
|
125
126
|
const X = rowsAt(worlds[l.item], [l.frame[3], l.frame[7], l.frame[11]]), g = motion.gravity || [0, 0, -1], F = g.map((c) => (c * l.mass * G) / Math.hypot(...g));
|
|
126
127
|
total += j.type === 'prismatic' ? dot(Z, F) : dot(Z, cross(sub(X, O), F)) / 1000;
|
|
127
128
|
}
|
|
128
129
|
}
|
|
129
|
-
|
|
130
|
+
// (a belt's push at the carriage's acceleration goes either way along the travel, so it adds to the rest in the
|
|
131
|
+
// direction that makes it worse: on a vertical axis, the weight plus the push upward, never the weight less it)
|
|
132
|
+
return push ? total + (total < 0 ? -push : push) : total;
|
|
130
133
|
}
|
|
131
134
|
|
|
132
135
|
// The worst load on a joint: at each named pose, and with the motor run through its range
|
|
@@ -174,8 +177,11 @@ export function motorChecks(s, f, helpers, materialName) {
|
|
|
174
177
|
// Its shaft on the joint's axis
|
|
175
178
|
const j = motion.joints.find((x) => x.id === d.joint), { O, Z } = axisOf(motion, worlds, j, mul), S = rowsAt(W, m.anchors.shaft.origin), A = [W[2], W[6], W[10]];
|
|
176
179
|
const off = cross(sub(S, O), Z), apart = Math.hypot(...off), tilt = Math.abs(1 - Math.abs(dot(A, Z)));
|
|
177
|
-
|
|
178
|
-
|
|
180
|
+
// (a belt's pulley turns square to the slide, the belt's line tangent to it: belt.line holds that line; a check drawn
|
|
181
|
+
// with the motor on the slide's axis, as before, still passes)
|
|
182
|
+
if (j.slide?.kind === 'belt' && Math.abs(dot(A, Z)) < 1e-6) { f('pass', `${d.id}'s shaft turns square to ${d.joint}'s travel, as a belt's pulley does`, null, { code: 'motor.axis', at: S }); }
|
|
183
|
+
else if (apart > 0.05 || tilt > 1e-6) { f('fail', `${d.id}'s shaft isn't on ${d.joint}'s axis: ${n3(apart, 2)} mm off${tilt > 1e-6 ? ', and not parallel to it' : ''}`, `${d.id}: shaft off axis`, { code: 'motor.axis', at: S, refs: { item: d.id, joint: d.joint } }); continue; }
|
|
184
|
+
else f('pass', `${d.id}'s shaft is on ${d.joint}'s axis`, null, { code: 'motor.axis', at: S });
|
|
179
185
|
// Everything it drives that carries a load
|
|
180
186
|
const driven = motion.joints.filter((x) => trainFrom(motion, x.id).root === d.joint).map((x) => ({ j: x, t: trainFrom(motion, x.id), load: worstLoad(motion, loads, x, d, helpers) })).filter((x) => x.load.torque > 0);
|
|
181
187
|
const motorSpeed = workingSpeed(m, d.spec), loaded = driven.length ? driven : [];
|
|
@@ -189,14 +195,16 @@ export function motorChecks(s, f, helpers, materialName) {
|
|
|
189
195
|
const lines = [], at = (x) => axisOf(motion, worlds, x, mul).O;
|
|
190
196
|
let locked = null;
|
|
191
197
|
for (const { j: x, t, load } of loaded) {
|
|
192
|
-
// the lead's torque for a load here: a slide's force through the pinion, a revolute's torque down the ratio
|
|
193
|
-
|
|
198
|
+
// the lead's torque for a load here: a slide's force through the pinion, a revolute's torque down the ratio; what
|
|
199
|
+
// holds it still reads only the loads there at rest (a belt's push at the carriage's acceleration is not, lib/belts.mjs)
|
|
200
|
+
const lead = (q) => (t.slide != null ? (q * t.slide * 180) / Math.PI / 1000 : q), atLead = lead(load.torque);
|
|
201
|
+
const still = loads.some((l) => l.belt && l.joint === x.id) ? lead(worstLoad(motion, loads.filter((l) => !l.belt), x, d, helpers).torque) : atLead;
|
|
194
202
|
const unit = t.slide != null ? 'N' : 'N m', reduction = t.ratio;
|
|
195
203
|
const η = t.efficiency, needed = atLead / (reduction * η);
|
|
196
204
|
need += needed; const ηback = Math.max(0, 2 - 1 / η);
|
|
197
205
|
if (t.locks) locked = t.locks;
|
|
198
206
|
else if (η <= 0.5) locked = `the gears (${n3(η * 100, 0)}% forwards, under the 50% where they can't be driven backwards)`;
|
|
199
|
-
back += (
|
|
207
|
+
back += (still / reduction) * ηback; backOn += still / reduction;
|
|
200
208
|
lines.push({ x, t, load, unit, reduction, atLead, η });
|
|
201
209
|
}
|
|
202
210
|
const speedOut = motorSpeed / loaded[0].t.ratio, rated = performance(m, { speed: motorSpeed }), avail = mountTorque(d), margin = need ? avail / need : Infinity;
|
package/lib/schema.mjs
CHANGED
|
@@ -8,7 +8,7 @@ import { near } from './errors.mjs';
|
|
|
8
8
|
|
|
9
9
|
const DIR = path.join(path.dirname(fileURLToPath(import.meta.url)), '..', 'schemas');
|
|
10
10
|
const cache = new Map();
|
|
11
|
-
/** A schema by name: object, assembly, rules, layout, problem or outline. @param {'object' | 'assembly' | 'rules' | 'layout' | 'problem' | 'outline'} name */
|
|
11
|
+
/** A schema by name: object, assembly, project, rules, layout, problem or outline. @param {'object' | 'assembly' | 'project' | 'rules' | 'layout' | 'problem' | 'outline'} name */
|
|
12
12
|
export function schema(name) {
|
|
13
13
|
if (!cache.has(name)) cache.set(name, JSON.parse(fs.readFileSync(path.join(DIR, `${name}.schema.json`), 'utf8')));
|
|
14
14
|
return cache.get(name);
|
|
@@ -58,7 +58,7 @@ export function validate(value, s, root = s, at = '') {
|
|
|
58
58
|
return out;
|
|
59
59
|
}
|
|
60
60
|
|
|
61
|
-
/** Problems with a file's JSON as findings (code schema), for cad check. @param {any} json @param {'object' | 'assembly' | 'rules' | 'layout' | 'problem'} kind @param {string} file */
|
|
61
|
+
/** Problems with a file's JSON as findings (code schema), for cad check. @param {any} json @param {'object' | 'assembly' | 'project' | 'rules' | 'layout' | 'problem'} kind @param {string} file */
|
|
62
62
|
export function schemaFindings(json, kind, file) {
|
|
63
63
|
return validate(json, schema(kind)).map((x) => ({ level: 'fail', text: `${file}: ${x.path}: ${x.message}`, code: 'schema', refs: { file, path: x.path } }));
|
|
64
64
|
}
|
package/lib/versions.mjs
CHANGED
|
@@ -82,9 +82,13 @@ export function packageVersion(name, from = import.meta.url) {
|
|
|
82
82
|
const ENGINE_LIBS = ['@tscircuit/capacity-autorouter', '@tscircuit/footprinter', '@tscircuit/checks', 'schematic-symbols'];
|
|
83
83
|
const engineLibs = () => ENGINE_LIBS.map((n) => `${n}@${packageVersion(n, import.meta.resolve('@rulecad/pcb'))}`).join(' ');
|
|
84
84
|
const engineHash = (code) => crypto.createHash('sha256').update(`${code.trimEnd()}\n${engineLibs()}`).digest('hex').slice(0, 16);
|
|
85
|
+
// The board engine's code: @rulecad/pcb's modules, and @rulecad/smooth's, which a board's build runs too (smoothing its
|
|
86
|
+
// tracks, finishing them): a change to either is a change to what a board builds, so it must miss the cache
|
|
87
|
+
const sources = (dir) => fs.readdirSync(dir).filter((f) => f.endsWith('.mjs') && f !== 'test.mjs').sort().map((f) => fs.readFileSync(path.join(dir, f), 'utf8')).join('\n');
|
|
85
88
|
export const engineId = () => {
|
|
86
|
-
const
|
|
87
|
-
|
|
89
|
+
const pcb = import.meta.resolve('@rulecad/pcb'), dir = path.dirname(fileURLToPath(pcb));
|
|
90
|
+
const smooth = path.dirname(createRequire(pcb).resolve('@rulecad/smooth'));
|
|
91
|
+
return engineHash(`${sources(dir)}\n${sources(smooth)}`);
|
|
88
92
|
};
|
|
89
93
|
// From a tag's message, or for releases before tags recorded it, from the engine's code in the repo at the tag
|
|
90
94
|
function taggedEngine(tag) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rulecad/cad",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.62",
|
|
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": {
|
|
@@ -75,7 +75,7 @@
|
|
|
75
75
|
"@rulecad/motors": "^0.1.6",
|
|
76
76
|
"@rulecad/fixings": "^0.1.5",
|
|
77
77
|
"@rulecad/robots": "^0.1.2",
|
|
78
|
-
"@rulecad/frames": "^0.1.
|
|
78
|
+
"@rulecad/frames": "^0.1.11"
|
|
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", "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"], "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)
|
|
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}"}}]}]},
|
|
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" } },
|
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
"bought": { "type": "string", "description": "A part from a rule set (\"608\", \"drv8825\", \"fitting-motedis-end-cap-20-b6\"): bought, not printed; drawn faint from its figures, with anchors from what it is. A frame's bought fitting (an end cap, a levelling foot, a hinge) placed at a beam's address is checked against that beam's profile, and its price goes on cad list" },
|
|
52
52
|
"variant": { "type": "string" },
|
|
53
53
|
"set": { "type": "object" },
|
|
54
|
-
"fitting": { "type": "object", "required": ["kind"], "additionalProperties": false, "description": "A printed fitting from @rulecad/frames, drawn from a profile's and its slot nuts' rules and sized from a named load (a join with \"fitting\": \"printed\" adds one for itself; a panel adds its clips, a door its hinges, handle and catch). A bracket, gusset or splice is sized by finite elements; the others by beam formulas, each reporting its grams and margin. In its fitted frame: a bracket's x along b's face away from a, y up a, z across; a plate's x along b, y along a, its contact face at z = 0", "properties": { "kind": { "enum": ["bracket", "gusset", "splice", "panel-clip", "panel-corner", "slot-cover", "panel-edge", "gasket-strip", "hinge", "handle", "latch", "magnet-catch", "end-cap", "foot", "levelling-foot", "castor-plate", "stacking-foot", "device-mount", "fan-mount", "drag-chain-end", "din-rail", "cable-clip", "tie-anchor", "spool-holder", "rail-jig", "wheel-plate", "slider", "rod-holder", "rod-carriage", "motor-plate", "endstop-mount", "nut-carrier"], "description": "A nut-carrier is a printed block that slides in a slot holding a hex nut or a heat-set insert (face, thread, holds, length, count, pitch, load)" }, "profile": { "type": "string", "description": "The profile the base leg or the plate lies on" }, "other": { "type": "string", "description": "A bracket's: the profile its upright leg lies on, where not the same" }, "face": { "type": "string", "description": "The face of the profile it lies on (top, top.2): its slot sizes the tongue and the nut" }, "otherFace": { "type": "string" }, "shape": { "enum": ["L", "T", "cross", "splice"], "description": "A gusset's shape" }, "brace": { "type": "boolean", "description": "A bracket's brace across its inside corner" }, "load": { "type": "number", "description": "The design load in N, across beam a at the fitting's screw (default 100)" }, "count": { "type": "number", "description": "A plate's screws on each arm (default 2)" }, "thread": { "type": "string" }, "head": { "enum": ["cap", "button"] }, "part": { "type": "string", "description": "A hinge's leaf (frame, door) or a levelling foot's part (body, pad): an item each" }, "sheet": { "type": "number", "description": "The panel's or door's thickness, in mm" }, "length": { "type": "number", "description": "A strip's length, in mm" }, "standoff": { "type": "number", "description": "A latch's or catch's: the door's inner face over the beam's face (a hinge's standoff)" }, "edge": { "type": "number" }, "magnet": { "type": "array", "items": { "type": "number" } }, "stud": { "type": "string" }, "holds": { "enum": ["nut", "insert"], "description": "A nut-carrier's: a hex nut slid in from the side (the default) or a heat-set insert pressed in from below" }, "range": { "type": "number" }, "holes": { "type": "array", "items": { "type": "number" } }, "end": { "enum": ["a", "b"] }, "depth": { "type": "number" }, "grip": { "type": "number" }, "span": { "type": "number" }, "gap": { "type": "number" }, "squeeze": { "type": "number" }, "pin": { "type": "string" }, "screw": { "type": "string" }, "thickness": { "type": "number" }, "nut": { "type": "string" }, "material": { "type": "string" }, "device": { "type": "string", "description": "A device mount's: the rule set its holes are read from (supply-24v, cnc-shield-v3)" }, "variant": { "type": "string", "description": "A device mount's: the device's variant" }, "turn": { "enum": [0, 90, 180, 270], "description": "A device mount's: the device's x from the slot's line, degrees" }, "offset": { "type": "number", "description": "A device mount's: the device's middle across the slot, mm" }, "deviceHead": { "enum": ["cap", "button"] }, "size": { "type": "number", "description": "A fan mount's fan, mm: 40, 60, 80, 92 or 120" }, "side": { "enum": [1, -1] }, "flange": { "type": "number" }, "cable": { "type": "number", "description": "A cable clip's bundle, mm" }, "width": { "type": "number" }, "tie": { "type": "array", "items": { "type": "number" } }, "spool": { "type": "object" }, "rod": { "type": "string", "description": "A rod holder's or carriage's: the rods' rule set" }, "bearing": { "type": "string", "description": "A carriage's linear bearings' rule set" }, "spacing": { "type": "number" }, "height": { "type": "number" }, "leadNut": { "type": "string", "description": "A rod holder's or carriage's: the lead nut's rule set" }, "support": { "type": ["string", "null"], "description": "A rod holder's: the screw's ball bearing's rule set" }, "flag": { "type": "object", "description": "A carriage's endstop flag: where its tip reaches, { y, z }" }, "motor": { "type": "string", "description": "A motor plate's: the motor's rule set (28byj48, nema14, nema17)" }, "coupler": { "type": "object", "description": "A motor plate's: the coupler's { length, D }" }, "switch": { "type": "string", "description": "An endstop mount's: the switch's rule set" }, "toward": { "enum": [1, -1], "description": "An endstop mount's: which way across the face its lever reaches" }, "pose": { "enum": ["fit", "print"], "description": "fit (the default): in its place, as the item's at and rotate put it; print: laid as it prints, for a plate (cad plates writes it so)" } } },
|
|
54
|
+
"fitting": { "type": "object", "required": ["kind"], "additionalProperties": false, "description": "A printed fitting from @rulecad/frames, drawn from a profile's and its slot nuts' rules and sized from a named load (a join with \"fitting\": \"printed\" adds one for itself; a panel adds its clips, a door its hinges, handle and catch). A bracket, gusset or splice is sized by finite elements; the others by beam formulas, each reporting its grams and margin. In its fitted frame: a bracket's x along b's face away from a, y up a, z across; a plate's x along b, y along a, its contact face at z = 0", "properties": { "kind": { "enum": ["bracket", "gusset", "splice", "panel-clip", "panel-corner", "slot-cover", "panel-edge", "gasket-strip", "hinge", "handle", "latch", "magnet-catch", "end-cap", "foot", "levelling-foot", "castor-plate", "stacking-foot", "device-mount", "fan-mount", "drag-chain-end", "din-rail", "cable-clip", "tie-anchor", "spool-holder", "rail-jig", "wheel-plate", "slider", "rod-holder", "rod-carriage", "motor-plate", "endstop-mount", "nut-carrier", "belt-plate", "belt-clamp", "belt-idler"], "description": "A nut-carrier is a printed block that slides in a slot holding a hex nut or a heat-set insert (face, thread, holds, length, count, pitch, load)" }, "profile": { "type": "string", "description": "The profile the base leg or the plate lies on" }, "other": { "type": "string", "description": "A bracket's: the profile its upright leg lies on, where not the same" }, "face": { "type": "string", "description": "The face of the profile it lies on (top, top.2): its slot sizes the tongue and the nut" }, "otherFace": { "type": "string" }, "shape": { "enum": ["L", "T", "cross", "splice"], "description": "A gusset's shape" }, "brace": { "type": "boolean", "description": "A bracket's brace across its inside corner" }, "load": { "type": "number", "description": "The design load in N, across beam a at the fitting's screw (default 100)" }, "count": { "type": "number", "description": "A plate's screws on each arm (default 2)" }, "thread": { "type": "string" }, "head": { "enum": ["cap", "button"] }, "part": { "type": "string", "description": "A hinge's leaf (frame, door) or a levelling foot's part (body, pad): an item each" }, "sheet": { "type": "number", "description": "The panel's or door's thickness, in mm" }, "length": { "type": "number", "description": "A strip's length, in mm" }, "standoff": { "type": "number", "description": "A latch's or catch's: the door's inner face over the beam's face (a hinge's standoff)" }, "edge": { "type": "number" }, "magnet": { "type": "array", "items": { "type": "number" } }, "stud": { "type": "string" }, "holds": { "enum": ["nut", "insert"], "description": "A nut-carrier's: a hex nut slid in from the side (the default) or a heat-set insert pressed in from below" }, "range": { "type": "number" }, "holes": { "type": "array", "items": { "type": "number" } }, "end": { "enum": ["a", "b"] }, "depth": { "type": "number" }, "grip": { "type": "number" }, "span": { "type": "number" }, "gap": { "type": "number" }, "squeeze": { "type": "number" }, "pin": { "type": "string" }, "screw": { "type": "string" }, "thickness": { "type": "number" }, "nut": { "type": "string" }, "material": { "type": "string" }, "device": { "type": "string", "description": "A device mount's: the rule set its holes are read from (supply-24v, cnc-shield-v3)" }, "variant": { "type": "string", "description": "A device mount's: the device's variant" }, "turn": { "enum": [0, 90, 180, 270], "description": "A device mount's: the device's x from the slot's line, degrees" }, "offset": { "type": "number", "description": "A device mount's: the device's middle across the slot, mm" }, "deviceHead": { "enum": ["cap", "button"] }, "size": { "type": "number", "description": "A fan mount's fan, mm: 40, 60, 80, 92 or 120" }, "side": { "enum": [1, -1] }, "flange": { "type": "number" }, "cable": { "type": "number", "description": "A cable clip's bundle, mm" }, "width": { "type": "number" }, "tie": { "type": "array", "items": { "type": "number" } }, "spool": { "type": "object" }, "rod": { "type": "string", "description": "A rod holder's or carriage's: the rods' rule set" }, "bearing": { "type": "string", "description": "A carriage's linear bearings' rule set" }, "spacing": { "type": "number" }, "height": { "type": "number" }, "leadNut": { "type": "string", "description": "A rod holder's or carriage's: the lead nut's rule set" }, "support": { "type": ["string", "null"], "description": "A rod holder's: the screw's ball bearing's rule set" }, "flag": { "type": "object", "description": "A carriage's endstop flag: where its tip reaches, { y, z }" }, "motor": { "type": "string", "description": "A motor plate's: the motor's rule set (28byj48, nema14, nema17)" }, "coupler": { "type": "object", "description": "A motor plate's: the coupler's { length, D }" }, "switch": { "type": "string", "description": "An endstop mount's: the switch's rule set" }, "pulley": { "type": "string", "description": "A belt plate's: the pulley's rule set" }, "idler": { "type": "string", "description": "A belt idler block's: the idler's rule set" }, "belt": { "type": "string", "description": "A belt part's: the belt's rule set" }, "across": { "type": "number", "description": "A belt plate's or idler block's: the pulley's or idler's middle off the slot's line, mm" }, "least": { "type": "number", "description": "A belt plate's: the least height of the belt's middle over the face, mm" }, "lift": { "type": "number", "minimum": 0, "description": "A belt plate's: how much further up its shaft the pulley stands, mm (default 0), to raise the belt without a thicker plate" }, "tension": { "type": "number", "description": "A belt part's: each span's tension, N" }, "rise": { "type": "number", "description": "A belt clamp's or idler block's: the belt's middle over the carriage's top, or over the face" }, "stretch": { "type": "number", "description": "A belt idler block's: the belt's stretch at its tension, mm" }, "carriageHoles": { "type": "array", "description": "A belt clamp's: the carriage's tapped holes, [[x, y], ...] from its top's middle" }, "toward": { "enum": [1, -1], "description": "An endstop mount's: which way across the face its lever reaches" }, "pose": { "enum": ["fit", "print"], "description": "fit (the default): in its place, as the item's at and rotate put it; print: laid as it prints, for a plate (cad plates writes it so)" } } },
|
|
55
55
|
"panel": { "type": "object", "required": ["sheet", "thickness", "bay", "out"], "additionalProperties": false, "description": "A panel from @rulecad/frames: a sheet cut to the bay of four beams it closes, on their faces that look along out, held by printed clips at a pitch; with door, a door on printed hinges that turns on a joint", "properties": { "sheet": { "enum": ["acrylic", "polycarbonate", "aluminium"] }, "thickness": { "$ref": "#/$defs/expr" }, "bay": { "type": "array", "items": { "type": "string" }, "minItems": 4, "maxItems": 4, "description": "The four beam items round it, in order" }, "out": { "type": "array", "items": { "$ref": "#/$defs/expr" }, "minItems": 3, "maxItems": 3, "description": "The way its face looks, square to the bay" }, "pitch": { "$ref": "#/$defs/expr" }, "nut": { "type": "string" }, "load": { "$ref": "#/$defs/expr" }, "door": { "type": "object", "required": ["hinge"], "additionalProperties": false, "properties": { "hinge": { "type": "string", "description": "The beam of the bay its hinges go on" }, "open": { "$ref": "#/$defs/expr" }, "handle": { "type": "boolean" }, "catch": { "type": "boolean" }, "latch": { "type": "boolean" }, "load": { "$ref": "#/$defs/expr" } } } } },
|
|
56
56
|
"mount": { "type": "object", "required": ["on"], "additionalProperties": false, "description": "A bought board's or supply's printed mount on a beam (@rulecad/frames' deviceMountModel), its holes read from the item's rule set: the mount goes at a slotted face's address, the item on it, and the screws into the slot and into the device are fastens", "properties": { "on": { "type": "string", "description": "An address on a beam's slotted face: rail.top@200" }, "turn": { "enum": [0, 90, 180, 270], "description": "The device's x from the beam's line, degrees" }, "offset": { "$ref": "#/$defs/expr", "description": "The device's middle across the slot, mm" }, "standoff": { "$ref": "#/$defs/expr", "description": "A board's least standoff, mm" }, "load": { "$ref": "#/$defs/expr", "description": "N on the device at its farthest hole (default 50)" }, "nut": { "type": "string" }, "head": { "enum": ["cap", "button"] }, "screw": { "type": "string", "description": "A board's screws, where not the largest its holes pass" } } },
|
|
57
57
|
"beam": { "type": "object", "required": ["profile"], "additionalProperties": false, "description": "A length of a profile from @rulecad/frames: bought and cut to length, faint in previews, or printed; placed by its ends (from, to, roll) or by at and rotate", "properties": { "profile": { "type": "string", "description": "A profile's name: 2020-misumi-hfs5, profile-4040-item-8, or a set in this workspace's rules/" }, "length": { "$ref": "#/$defs/expr", "description": "mm from end a to end b; may be left out when from and to are both given" }, "printed": { "description": "A printed beam (@rulecad/frames printed beams): true, or how it prints. A printed beam is a printed part, weighed by the plastic laid, on a plate, off the cut list; a bought one is false, the default", "oneOf": [{ "type": "boolean" }, { "type": "object", "additionalProperties": false, "properties": { "pose": { "enum": ["lying", "standing"], "description": "lying (the default): on its bottom face, its layers along it; standing: on end a, its section the layer" }, "walls": { "type": "integer", "minimum": 1, "description": "Walls round every outline, in lines (3)" }, "infill": { "type": "number", "minimum": 0, "maximum": 1, "description": "The share of the inside the infill fills (0.4)" }, "end": { "enum": ["insert", "nut"], "description": "What a tapped end becomes in print: a heat-set insert (the default) or a captive nut" }, "pull": { "type": "number", "exclusiveMinimum": 0, "description": "A slot nut's design pull in N (100)" } } }] }, "laid": { "type": "boolean", "description": "A printed beam drawn as it prints, for a plate (cad plates writes it so)" }, "material": { "type": "string", "description": "A material set in place of the profile's alloy: al6063-t5, or a plastic" }, "ops": { "type": "array", "items": { "$ref": "#/$defs/beamOp" }, "description": "Operations on the beam, each a line on its sheet and a cut in its solid, placed by an address on the beam and dimensioned from end a" } } },
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "https://jonibach.github.io/rulecad/schemas/project.schema.json",
|
|
4
|
+
"title": "rulecad project",
|
|
5
|
+
"description": "A project's own file, projects/<name>/project.json: what it is, the plastic and printer its parts are made for, and its objects. cad new <project> writes it, cad set <project> field=value changes it, cad new <project>/<object> lists each object.",
|
|
6
|
+
"type": "object",
|
|
7
|
+
"required": ["name"],
|
|
8
|
+
"additionalProperties": false,
|
|
9
|
+
"properties": {
|
|
10
|
+
"$schema": { "type": "string" },
|
|
11
|
+
"name": { "type": "string", "pattern": "^[a-z][a-z0-9-]*$", "description": "The project's folder name: lower case, with dashes" },
|
|
12
|
+
"title": { "type": "string", "description": "What the project is, in a few words, for its pages and lists" },
|
|
13
|
+
"description": { "type": "string", "description": "A sentence or two on what it is for" },
|
|
14
|
+
"material": { "type": "string", "description": "The plastic its parts print in unless a part says otherwise: PLA or PETG, or a rule set in rules/ that gives strength, modulus and density. Printed fittings are sized from it" },
|
|
15
|
+
"printer": { "type": "string", "description": "The printer rule set its prints are checked against (bed, overhang, layer), as x1c; left out, cad.config.json's printer" },
|
|
16
|
+
"objects": { "type": "array", "items": { "type": "string", "pattern": "^[a-z][a-z0-9-]*$" }, "description": "Its objects, by name, as cad new <project>/<object> lists them" },
|
|
17
|
+
"filaments": {
|
|
18
|
+
"type": "object",
|
|
19
|
+
"description": "Its filaments, by name, for parts that print in more than one (a part's \"filament\": \"legend\"): each in its AMS slot",
|
|
20
|
+
"additionalProperties": {
|
|
21
|
+
"type": "object",
|
|
22
|
+
"properties": {
|
|
23
|
+
"slot": { "type": "integer", "description": "The AMS slot it loads from, 1 to 16" },
|
|
24
|
+
"material": { "type": "string", "description": "Its plastic, where it differs from the project's" },
|
|
25
|
+
"colour": { "type": "string" },
|
|
26
|
+
"note": { "type": "string" }
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
}
|