@rulecad/fixings 0.1.8 → 0.2.0

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/magnets.d.mts CHANGED
@@ -1,7 +1,8 @@
1
1
  /**
2
2
  * A magnet's name read by the grammar.
3
3
  * @param {string} name 'disc magnet 8x3', 'magnet 6x2 N52', 'block magnet 10x5x2 N45'
4
- * @returns {{ shape: 'disc' | 'block', diameter: number | null, length: number | null, width: number | null, thickness: number, grade: string | null }}
4
+ * @returns {{ shape: 'disc' | 'block', diameter: number | null, length: number | null, width: number | null,
5
+ * thickness: number, grade: string | null }}
5
6
  */
6
7
  export function parseMagnet(name: string): {
7
8
  shape: "disc" | "block";
@@ -14,7 +15,8 @@ export function parseMagnet(name: string): {
14
15
  /**
15
16
  * The flux density on a magnet's axis at a distance from its face, over the density at its face: the formulas of
16
17
  * magnets.field_formula. A pull across a gap is taken as the pull touching times this squared, an estimate.
17
- * @param {{ shape: 'disc' | 'block', diameter?: number | null, length?: number | null, width?: number | null, thickness: number }} p @param {number} z mm
18
+ * @param {{ shape: 'disc' | 'block', diameter?: number | null, length?: number | null, width?: number | null,
19
+ * thickness: number }} p @param {number} z mm
18
20
  * @returns {number} B(z) / B(0)
19
21
  */
20
22
  export function fieldShare(p: {
@@ -25,11 +27,13 @@ export function fieldShare(p: {
25
27
  thickness: number;
26
28
  }, z: number): number;
27
29
  /**
28
- * @typedef {{ kind: 'magnet', shape: 'disc' | 'block', name: string, said: string, diameter: number | null, length: number | null, width: number | null, thickness: number,
29
- * grade: string, made: 'bought', touching: number, gap: number, pull: number, count: number, total: number, load: number | null, margin: number | null,
30
- * grams: number, volume: number, rests: object[], findings: object[] }} Magnet
31
- * touching: its pull straight off thick steel it touches, N; gap: what lies between it and the steel, mm; pull: across that gap, N;
32
- * count: how many share the load; total: their pull together; load and margin: the pull asked of them all, and total over it
30
+ * @typedef {{ kind: 'magnet', shape: 'disc' | 'block', name: string, said: string, diameter: number | null,
31
+ * length: number | null, width: number | null, thickness: number,
32
+ * grade: string, made: 'bought', touching: number, gap: number, pull: number, count: number, total: number, load:
33
+ * number | null, margin: number | null, grams: number, volume: number, rests: object[], findings: object[] }} Magnet
34
+ * touching: its pull straight off thick steel it touches, N; gap: what lies between it and the steel, mm; pull:
35
+ * across that gap, N; count: how many share the load; total: their pull together; load and margin: the pull asked of
36
+ * them all, and total over it
33
37
  */
34
38
  /**
35
39
  * A magnet as a model by name: its pull straight off steel, from its seller's figure (magnets.<size>_pull) scaled to
@@ -52,13 +56,17 @@ export function magnetModel(p: string | Magnet, o?: {
52
56
  }): Magnet;
53
57
  /**
54
58
  * @typedef {{ kind: 'magnet-seat', magnet: Magnet, fit: 'press' | 'glue' | 'ribs', facing: 'open' | 'floor',
55
- * pocket: { shape: 'round' | 'rect', diameter: number | null, size: number[] | null, nominal: number[], comp: number, clearance: number, depth: number, lead: number,
56
- * into: string, axis: 'x' | 'y' | 'z', teardrop: boolean, ribs: { count: number, tips: number, radius: number, protrude: number } | null, relief: number | null, rules: string[] },
57
- * floor: number | null, thickness: number | null, hold: number | null, holdMargin: number | null, rests: object[], findings: object[] }} MagnetSeat
58
- * pocket: what to draw (diameter of a round pocket, or [length, width] of a block's, as drawn; nominal: the magnet's;
59
- * comp: hole compensation added; clearance: added across past that, under 0 for a press; lead: the chamfer at its
60
- * mouth; ribs: crush ribs, their tips on a circle `tips` across; relief: a block pocket's corner reliefs' radius);
61
- * floor: what is left under it in a part `thickness` thick; hold: what the fit grips the magnet with against its pull out, N
59
+ * pocket: { shape: 'round' | 'rect', diameter: number | null, size: number[] | null, nominal: number[], comp: number,
60
+ * clearance: number, depth: number, lead: number,
61
+ * into: string, axis: 'x' | 'y' | 'z', teardrop: boolean, ribs:
62
+ * { count: number, tips: number, radius: number, protrude: number } | null, relief: number | null, rules: string[]
63
+ * },
64
+ * floor: number | null, thickness: number | null, hold: number | null, holdMargin: number | null, rests: object[],
65
+ * findings: object[] }} MagnetSeat pocket: what to draw (diameter of a round pocket, or [length, width] of a block's,
66
+ * as drawn; nominal: the magnet's; comp: hole compensation added; clearance: added across past that, under 0 for a
67
+ * press; lead: the chamfer at its mouth; ribs: crush ribs, their tips on a circle `tips` across; relief: a block
68
+ * pocket's corner reliefs' radius); floor: what is left under it in a part `thickness` thick; hold: what the fit
69
+ * grips the magnet with against its pull out, N
62
70
  */
63
71
  /**
64
72
  * A magnet's pocket as a model: its size from the printer's rules for the fit (press: the magnet plus hole_comp less
@@ -68,13 +76,15 @@ export function magnetModel(p: string | Magnet, o?: {
68
76
  * would not print: a pocket opening on the bed wider than the printer bridges, a block's pocket or crush ribs lying on
69
77
  * their side, a floor too thin.
70
78
  * @param {string | Magnet} p a magnet's name or model
71
- * @param {{ fit?: 'press' | 'glue' | 'ribs', printer?: object, material?: string | object, sets?: object, into?: string, axis?: 'x' | 'y' | 'z',
72
- * recess?: number, thickness?: number, facing?: 'open' | 'floor', grade?: string, gap?: number, count?: number, load?: number, pull?: number }} [o]
73
- * fit: press, glue or ribs (the default: ribs for a disc standing in its pocket; glue for a disc lying on its side,
74
- * where ribs would hang from the roof, and for a block, whose press splits its wall); material: the part's plastic (default PLA); into or axis: the pocket's way
75
- * (default down from a top face); recess: how far under the face the magnet sits, mm; thickness: the part's along
76
- * the pocket, for its floor; facing: where the magnet's steel is, past the pocket's open face (the default) or
77
- * through its floor, which is then the gap; grade, gap, count, load, pull: magnetModel's
79
+ * @param {{ fit?: 'press' | 'glue' | 'ribs', printer?: object, material?: string | object, sets?: object,
80
+ * into?: string, axis?: 'x' | 'y' | 'z',
81
+ * recess?: number, thickness?: number, facing?: 'open' | 'floor', grade?: string, gap?: number, count?: number,
82
+ * load?: number, pull?: number }} [o] fit: press, glue or ribs (the default: ribs for a disc standing in its pocket;
83
+ * glue for a disc lying on its side, where ribs would hang from the roof, and for a block, whose press splits its
84
+ * wall); material: the part's plastic (default PLA); into or axis: the pocket's way (default down from a top face);
85
+ * recess: how far under the face the magnet sits, mm; thickness: the part's along the pocket, for its floor; facing:
86
+ * where the magnet's steel is, past the pocket's open face (the default) or through its floor, which is then the gap;
87
+ * grade, gap, count, load, pull: magnetModel's
78
88
  * @returns {MagnetSeat}
79
89
  */
80
90
  export function magnetSeatModel(p: string | Magnet, o?: {
@@ -96,18 +106,21 @@ export function magnetSeatModel(p: string | Magnet, o?: {
96
106
  /**
97
107
  * A magnet's pocket, to subtract: round (a teardrop lying on its side) with crush ribs where asked, or a block's with
98
108
  * its corners relieved, the size magnetSeatModel gives it, from the point at on the face going into the part.
99
- * @param {string | Magnet} p @param {object} [o] as magnetSeatModel, and at: the point on the face where the pocket starts
109
+ * @param {string | Magnet} p @param {object} [o] as magnetSeatModel, and at: the point on the face where the pocket
110
+ * starts
100
111
  * @returns {object} a JSCAD geom3 with .model holding magnetSeatModel's numbers
101
112
  */
102
113
  export function magnetSeat(p: string | Magnet, o?: object): object;
103
114
  /**
104
- * A magnet's solid, standing on z = 0, for an assembly: a disc or a block. @param {string | Magnet} p @param {object} [o] as magnetModel
115
+ * A magnet's solid, standing on z = 0, for an assembly: a disc or a
116
+ * block. @param {string | Magnet} p @param {object} [o] as magnetModel
105
117
  * @returns {object} a JSCAD geom3 with .model
106
118
  */
107
119
  export function magnet(p: string | Magnet, o?: object): object;
108
120
  /** The grades of NdFeB magnet there is a remanence for, weakest first. */
109
121
  export const MAGNET_GRADES: string[];
110
- /** The fits a magnet takes in its pocket: press (it grips), glue (room for a film of glue), ribs (crush ribs grip it). */
122
+ /** The fits a magnet takes in its pocket: press (it grips), glue (room for a film of glue), ribs (crush ribs grip
123
+ * it). */
111
124
  export const MAGNET_FITS: string[];
112
125
  /** The sizes there is a seller's pull for: discs as diameter x thickness, blocks as length x width x thickness. */
113
126
  export const MAGNET_SIZES: Readonly<{
@@ -121,8 +134,9 @@ export const MAGNET_SIZES: Readonly<{
121
134
  export const MAGNET_GRAMMAR: string;
122
135
  export function isMagnetName(name: unknown): boolean;
123
136
  /**
124
- * touching: its pull straight off thick steel it touches, N; gap: what lies between it and the steel, mm; pull: across that gap, N;
125
- * count: how many share the load; total: their pull together; load and margin: the pull asked of them all, and total over it
137
+ * touching: its pull straight off thick steel it touches, N; gap: what lies between it and the steel, mm; pull:
138
+ * across that gap, N; count: how many share the load; total: their pull together; load and margin: the pull asked of
139
+ * them all, and total over it
126
140
  */
127
141
  export type Magnet = {
128
142
  kind: "magnet";
@@ -148,10 +162,11 @@ export type Magnet = {
148
162
  findings: object[];
149
163
  };
150
164
  /**
151
- * pocket: what to draw (diameter of a round pocket, or [length, width] of a block's, as drawn; nominal: the magnet's;
152
- * comp: hole compensation added; clearance: added across past that, under 0 for a press; lead: the chamfer at its
153
- * mouth; ribs: crush ribs, their tips on a circle `tips` across; relief: a block pocket's corner reliefs' radius);
154
- * floor: what is left under it in a part `thickness` thick; hold: what the fit grips the magnet with against its pull out, N
165
+ * pocket: what to draw (diameter of a round pocket, or [length, width] of a block's,
166
+ * as drawn; nominal: the magnet's; comp: hole compensation added; clearance: added across past that, under 0 for a
167
+ * press; lead: the chamfer at its mouth; ribs: crush ribs, their tips on a circle `tips` across; relief: a block
168
+ * pocket's corner reliefs' radius); floor: what is left under it in a part `thickness` thick; hold: what the fit
169
+ * grips the magnet with against its pull out, N
155
170
  */
156
171
  export type MagnetSeat = {
157
172
  kind: "magnet-seat";