@rulecad/motors 0.1.6 → 0.1.7

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
@@ -4,6 +4,18 @@ What changed in each release, for someone upgrading a workspace. A **printed siz
4
4
  print (a hole's diameter, a seat's depth, a part's outline). Each release says whether any printed size moved, and
5
5
  why.
6
6
 
7
+ ## 0.1.7: bores from shapes' shaftBore
8
+ ### Changed
9
+
10
+ - `boreModel` and `bore` read their fit from `@rulecad/shapes`' `shaftBore` (#307), the one place every shaft bore in
11
+ the kit reads it. `DEFAULTS.fit` and `DEFAULTS.press` are now the same objects as `SHAFT_FITS.slide` and
12
+ `SHAFT_FITS.press`, with a source and a date. The package depends on `@rulecad/shapes`, which fixings already did, at the release that
13
+ first ships `shaftBore`. A printer's `hole_comp` below 0 is still taken.
14
+
15
+ ### Printed sizes
16
+
17
+ - None moved: a NEMA 17's bore is still 5.2 mm (4.7 across its flat) at slide and 5.06 mm (4.56) at press.
18
+
7
19
  ## 0.1.6: motors mount through fixings (Fixings 3)
8
20
 
9
21
  ### What reads fixings now
package/README.md CHANGED
@@ -91,7 +91,8 @@ shaft passes through. A servo goes through the part instead: its body down a slo
91
91
  `bore(model, { depth, fit?, printer? }, ops?)` is the hole a gear or hub takes, with the shaft's flat in it. The shaft
92
92
  goes in from z = 0 with its tip at `depth`: the flat is cut only where the flat is, so a bore deeper than the flat is
93
93
  round at its mouth and the shaft's round root can pass. `boreModel` warns of a bore that grips too little of the shaft
94
- or misses its flat. A servo's spline is finer than a printer draws: drive it through its horn. A brushless motor drives
94
+ or misses its flat. Its fit, `slide` (the default, measured on the fit bar) or `press`, is `@rulecad/shapes`'
95
+ `shaftBore`'s, the one place every shaft bore in the kit reads it, so a pulley on the same shaft gets the same bore. A servo's spline is finer than a printer draws: drive it through its horn. A brushless motor drives
95
96
  through its bell.
96
97
 
97
98
  Anchors for placing a motor in an assembly are on the model: `face`, `shaft` (where the shaft leaves the motor), `tip`,
package/motors.mjs CHANGED
@@ -17,6 +17,7 @@ import bldc2204 from '@rulecad/rules/bldc2204.json' with { type: 'json' };
17
17
  import x1c from '@rulecad/rules/x1c.json' with { type: 'json' };
18
18
  import engagementSet from '@rulecad/rules/engagement.json' with { type: 'json' };
19
19
  import { fixingModel, threads, holeModel, hole, counterboreModel, counterbore } from '@rulecad/fixings';
20
+ import { shaftBore, SHAFT_FITS } from '@rulecad/shapes';
20
21
 
21
22
  export { driver, setting, powerBudget, DRIVER_EFFICIENCY } from './drivers.mjs';
22
23
 
@@ -37,8 +38,9 @@ for (const s of Object.values(CATALOGUE)) for (const v of Object.keys(s.variants
37
38
  export const DEFAULTS = {
38
39
  running: { value: Math.SQRT1_2, unit: '× holding torque', rule: 'A stepper moving, against holding torque: holding has both phases at full current, and a driver moving it keeps the vector the size of one phase, 1/√2 of that', kind: 'spec' },
39
40
  supply: { value: 24, unit: 'V', rule: 'The stepper driver\'s supply, if you don\'t say: above the motor\'s rated volts, as a chopper drive needs, and what a printer\'s board runs at', kind: 'default' },
40
- fit: { value: 0.05, unit: 'mm', rule: 'Gap each side of a shaft in its bore, with the printed hole\'s shrinkage allowed for, so it slides on and no more: measured on the fit bar, a 5 mm D-shaft sliding in a bore drawn 5.2 mm', kind: 'measured' },
41
- press: { value: -0.02, unit: 'mm', rule: 'Each side of a shaft in a press-fit bore as printed: a hair tight, 0.8% strain on a 5 mm shaft, well inside what PLA stretches to before it cracks. A D flat does the driving', kind: 'estimate' },
41
+ // a shaft's bore fits, from @rulecad/shapes, where every shaft bore in the kit reads them (the same objects)
42
+ fit: SHAFT_FITS.slide,
43
+ press: SHAFT_FITS.press,
42
44
  grip: { value: 1.5, unit: '× shaft diameter', rule: 'The shortest length of bore worth trusting to drive a gear', kind: 'community' }
43
45
  };
44
46
  const D = (k) => DEFAULTS[k].value;
@@ -305,14 +307,14 @@ export function boreModel(m, p) {
305
307
  if (m.type === 'servo' || m.type === 'brushless') throw new Error(`${what}: a ${m.type}'s output is ${m.type === 'servo' ? 'a spline finer than a printer draws: drive it through its horn' : 'its bell: bolt to that'}, not a bore`);
306
308
  const tip = p.tip ?? depth;
307
309
  if (!(isNum(tip) && tip > 0)) throw new Error(`${what}: tip is how far from the bore's mouth the shaft's tip sits, above 0 (got ${shown(p.tip)})`);
308
- const pr = printerOf(p.printer), { shaft } = m, each = fit === 'slide' ? D('fit') : D('press'), diameter = shaft.diameter + 2 * each + pr.holeComp, flatFrom = Math.max(0, tip - shaft.flatLength), flat = Math.max(0, Math.min(depth, tip) - flatFrom);
310
+ const pr = printerOf(p.printer), { shaft } = m, b = shaftBore(shaft.diameter, { fit, across: shaft.across, printer: { hole_comp: pr.holeComp, fit: pr.fit }, what }), flatFrom = Math.max(0, tip - shaft.flatLength), flat = Math.max(0, Math.min(depth, tip) - flatFrom);
309
311
  const out = [], f = (level, text, code) => out.push({ level, text, code });
310
312
  if (depth > shaft.length) f('warn', `the bore is ${depth} mm deep and the shaft only ${shaft.length} mm long: the last ${+(depth - shaft.length).toFixed(2)} mm holds nothing`, 'bore.depth');
311
313
  const grip = Math.min(depth, shaft.length), want = shaft.flats ? Math.min(D('grip') * shaft.diameter, 0.8 * shaft.flatLength) : D('grip') * shaft.diameter;
312
314
  if (grip < want) f('warn', `only ${+grip.toFixed(2)} mm of the shaft is in the bore: ${r3(want)} mm or more, or the part rocks on it`, 'bore.grip');
313
315
  if (shaft.flats && flat < 0.5 * want) f('warn', `only ${+flat.toFixed(2)} mm of bore meets the flat: it's the flat that turns the part`, 'bore.flat');
314
316
  if (!shaft.flats) f('warn', 'this shaft has no flat: only friction or a grub screw turns the part', 'bore.flat');
315
- return { depth, diameter: r3(diameter), across: r3(shaft.across + 2 * each + pr.holeComp), flats: shaft.flats, flatFrom, grip, fit, findings: out };
317
+ return { depth, diameter: r3(b.diameter), across: r3(b.across), flats: shaft.flats, flatFrom, grip, fit, findings: out };
316
318
  }
317
319
 
318
320
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rulecad/motors",
3
- "version": "0.1.6",
3
+ "version": "0.1.7",
4
4
  "description": "Motors for printed machines: steppers, DC gear motors, servos and brushless motors from their datasheets, as models with sourced figures, solids to place in an assembly, the mounts and D-bores a part takes for them, and what torque and speed reach the output.",
5
5
  "type": "module",
6
6
  "exports": {
@@ -34,5 +34,5 @@
34
34
  "bugs": { "url": "https://github.com/JoniBach/rulecad/issues" },
35
35
  "scripts": { "test": "node --test" },
36
36
  "peerDependencies": { "@jscad/modeling": "^2.12.0" },
37
- "dependencies": { "@rulecad/rules": "^0.3.11", "@rulecad/fixings": "^0.1.3" }
37
+ "dependencies": { "@rulecad/rules": "^0.3.11", "@rulecad/fixings": "^0.1.3", "@rulecad/shapes": "^0.4.7" }
38
38
  }