@rulecad/fixings 0.1.9 → 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/CHANGELOG.md +30 -0
- package/bolts.d.mts +26 -18
- package/bolts.mjs +201 -49
- package/draw.d.mts +4 -2
- package/draw.mjs +58 -17
- package/fixings.d.mts +9 -6
- package/fixings.mjs +185 -26
- package/hardware.d.mts +42 -20
- package/hardware.mjs +388 -80
- package/holes.d.mts +32 -25
- package/holes.mjs +243 -61
- package/magnets.d.mts +45 -30
- package/magnets.mjs +521 -122
- package/model.d.mts +47 -29
- package/model.mjs +751 -134
- package/package.json +4 -4
- package/pins.d.mts +46 -32
- package/pins.mjs +480 -113
- package/seats.d.mts +61 -30
- package/seats.mjs +770 -144
- package/snaps.d.mts +32 -24
- package/snaps.mjs +770 -180
- package/strength.d.mts +64 -38
- package/strength.mjs +849 -184
- package/threads.d.mts +59 -42
- package/threads.mjs +910 -193
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,
|
|
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,
|
|
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,
|
|
29
|
-
*
|
|
30
|
-
*
|
|
31
|
-
*
|
|
32
|
-
*
|
|
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,
|
|
56
|
-
*
|
|
57
|
-
*
|
|
58
|
-
*
|
|
59
|
-
*
|
|
60
|
-
*
|
|
61
|
-
*
|
|
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,
|
|
72
|
-
*
|
|
73
|
-
*
|
|
74
|
-
*
|
|
75
|
-
*
|
|
76
|
-
* the
|
|
77
|
-
*
|
|
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
|
|
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
|
|
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
|
|
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:
|
|
125
|
-
* count: how many share the load; total: their pull together; load and margin: the pull asked of
|
|
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,
|
|
152
|
-
* comp: hole compensation added; clearance: added across past that, under 0 for a
|
|
153
|
-
* mouth; ribs: crush ribs, their tips on a circle `tips` across; relief: a block
|
|
154
|
-
* floor: what is left under it in a part `thickness` thick; hold: what the fit
|
|
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";
|