@rulecad/rules 0.2.0 → 0.3.4

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/README.md CHANGED
@@ -10,7 +10,7 @@ it comes from and when it was checked, so a design built on it can be traced and
10
10
 
11
11
  | Set | What | Values |
12
12
  |---|---|---|
13
- | `x1c` | Bambu Lab X1 Carbon: bed, line width, layer, overhang, bridges, fits and hole compensation | 11 |
13
+ | `x1c` | Bambu Lab X1 Carbon: bed, line width, layer, overhang, bridges, fits, the gap parts printed in place need (and how far the first layer spreads), and hole compensation | 13 |
14
14
  | `mx` | Cherry MX switches: plate cut-out, stem, housing, travel, key pitch | 29 |
15
15
  | `oem` | OEM keycap profile: heights and top tilt per row (from KeyV2) | 12 |
16
16
  | `m2` | M2 heat-set inserts and screws | 5 |
@@ -20,12 +20,17 @@ it comes from and when it was checked, so a design built on it can be traced and
20
20
  | `xiao` | Seeed Studio XIAO modules: outline, headers, the pin on each pad | 8 |
21
21
  | `qwiic` | Qwiic / STEMMA QT sockets (JST SH, 4 pins): land pattern and pinout | 10 |
22
22
  | `jstph` | JST PH (2.0 mm) battery connector | 3 |
23
- | `jlcpcb` | JLCPCB's limits for two-layer boards | 10 |
23
+ | `jlcpcb` | JLCPCB's limits for two-layer boards | 13 |
24
24
  | `wiring` | Room for hand wiring | 1 |
25
+ | `m4`, `m5` | M4 and M5 socket head screws and hex nuts | 5 each |
26
+ | `rp2040` | The RP2040 microcontroller: which package pins carry which GPIO | 2 |
27
+ | `dial-indicator` | A dial indicator with a plunger, for measuring small movements | 2 |
28
+ | `pla`, `petg` | Bambu Lab PLA Basic and PETG HF, printed, for analysis: stiffness and strength along the layers and across them | 5, 6 |
29
+ | `al6061`, `al7075`, `s275`, `ss304`, `ti64` | Aluminium 6061-T6 and 7075-T6, structural steel S275, stainless 304, titanium Ti-6Al-4V, for analysis | 4 or 5 each |
25
30
 
26
31
  `kind` says how far to trust a value: **spec** (a datasheet or manufacturer), **community** (a widely used figure, such
27
- as KiCad's library or KeyV2), **default** (a setting that works), or **estimate** (nobody has published it: measure it
28
- and correct it). Use them with `@rulecad/variables` (`uses: ['x1c']`, then `x1c.line * 3` in any expression), or read
32
+ as KiCad's library or KeyV2), **default** (a setting that works), **derived** (read off someone else's model with `cad measure`: check it
33
+ against the real thing, and see its `licence`), or **estimate** (nobody has published it: measure it and correct it). Use them with `@rulecad/variables` (`uses: ['x1c']`, then `x1c.line * 3` in any expression), or read
29
34
  the JSON from anywhere.
30
35
 
31
36
  **Corrections are the most useful contribution.** If you measured something, use the "Correct a rule" issue form on
package/al6061.json ADDED
@@ -0,0 +1,11 @@
1
+ {
2
+ "_doc": "Aluminium alloy 6061-T6, for analysis.",
3
+ "name": "al6061",
4
+ "rules": {
5
+ "modulus": {"value": 68900, "unit": "MPa", "rule": "Young's modulus", "kind": "spec", "source": "ASM Aerospace Specification Metals, Aluminum 6061-T6, https://asm.matweb.com/search/specificmaterial.asp?bassnum=ma6061t6", "checked": "2026-10-27"},
6
+ "poisson": {"value": 0.33, "rule": "Poisson's ratio", "kind": "spec", "source": "ASM, Aluminum 6061-T6", "checked": "2026-10-27"},
7
+ "strength": {"value": 276, "unit": "MPa", "rule": "Tensile yield strength", "kind": "spec", "source": "ASM, Aluminum 6061-T6", "checked": "2026-10-27"},
8
+ "fatigue": {"value": 96.5, "unit": "MPa", "rule": "Fatigue strength at 500,000,000 cycles (completely reversed, R. R. Moore test)", "kind": "spec", "source": "ASM, Aluminum 6061-T6", "checked": "2026-10-27"},
9
+ "density": {"value": 2.7, "unit": "g/cm³", "rule": "Density", "kind": "spec", "source": "ASM, Aluminum 6061-T6", "checked": "2026-10-27"}
10
+ }
11
+ }
package/al7075.json ADDED
@@ -0,0 +1,11 @@
1
+ {
2
+ "_doc": "Aluminium alloy 7075-T6, for analysis.",
3
+ "name": "al7075",
4
+ "rules": {
5
+ "modulus": {"value": 71700, "unit": "MPa", "rule": "Young's modulus", "kind": "spec", "source": "ASM Aerospace Specification Metals, Aluminum 7075-T6, https://asm.matweb.com/search/specificmaterial.asp?bassnum=ma7075t6", "checked": "2026-10-27"},
6
+ "poisson": {"value": 0.33, "rule": "Poisson's ratio", "kind": "spec", "source": "ASM, Aluminum 7075-T6", "checked": "2026-10-27"},
7
+ "strength": {"value": 503, "unit": "MPa", "rule": "Tensile yield strength", "kind": "spec", "source": "ASM, Aluminum 7075-T6", "checked": "2026-10-27"},
8
+ "fatigue": {"value": 159, "unit": "MPa", "rule": "Fatigue strength at 500,000,000 cycles (completely reversed, R. R. Moore test)", "kind": "spec", "source": "ASM, Aluminum 7075-T6", "checked": "2026-10-27"},
9
+ "density": {"value": 2.81, "unit": "g/cm³", "rule": "Density", "kind": "spec", "source": "ASM, Aluminum 7075-T6", "checked": "2026-10-27"}
10
+ }
11
+ }
@@ -0,0 +1,8 @@
1
+ {
2
+ "_doc": "A dial indicator (dial test gauge) with a plunger, for measuring small movements. kind as in x1c.json.",
3
+ "name": "dial-indicator",
4
+ "rules": {
5
+ "stem": {"value": 8, "unit": "mm", "rule": "Mounting stem diameter (8h6)", "kind": "spec", "source": "DIN 878 / ISO 463", "checked": "2026-10-27"},
6
+ "travel": {"value": 10, "unit": "mm", "rule": "Plunger travel of the common 0.01 mm, 10 mm range gauge", "kind": "community", "source": "Typical 0.01 mm / 10 mm dial indicators (Mitutoyo 2046 series and alike)", "checked": "2026-10-27"}
7
+ }
8
+ }
package/jlcpcb.json CHANGED
@@ -26,6 +26,22 @@
26
26
  "source": "https://jlcpcb.com/capabilities/pcb-capabilities",
27
27
  "checked": "2026-10-14"
28
28
  },
29
+ "castellated_drill_min": {
30
+ "value": 0.6,
31
+ "unit": "mm",
32
+ "rule": "Smallest castellated (half) hole on a rigid board",
33
+ "kind": "spec",
34
+ "source": "https://jlcpcb.com/blog/142-castellated-pcbs-introduction-and-design-requirements",
35
+ "checked": "2026-10-31"
36
+ },
37
+ "castellated_gap_min": {
38
+ "value": 0.6,
39
+ "unit": "mm",
40
+ "rule": "Castellated holes: edge to edge, at least (JLCPCB also gives 0.5 mm elsewhere: this is the stricter)",
41
+ "kind": "spec",
42
+ "source": "https://jlcpcb.com/blog/142-castellated-pcbs-introduction-and-design-requirements",
43
+ "checked": "2026-10-31"
44
+ },
29
45
  "via_hole": {
30
46
  "value": 0.15,
31
47
  "unit": "mm",
@@ -50,6 +66,14 @@
50
66
  "source": "https://jlcpcb.com/capabilities/pcb-capabilities",
51
67
  "checked": "2026-10-14"
52
68
  },
69
+ "annular_min": {
70
+ "value": 0.18,
71
+ "unit": "mm",
72
+ "rule": "Annular ring, absolute minimum: a via or plated hole with less fails; between this and annular is a warning",
73
+ "kind": "spec",
74
+ "source": "https://jlcpcb.com/capabilities/pcb-capabilities",
75
+ "checked": "2026-11-07"
76
+ },
53
77
  "silk_line": {
54
78
  "value": 0.15,
55
79
  "unit": "mm",
@@ -77,7 +101,7 @@
77
101
  "cheap_size": {
78
102
  "value": 100,
79
103
  "unit": "mm",
80
- "rule": "Two-layer boards up to 100 × 100 mm get JLCPCB's lowest price; past that it rises steeply",
104
+ "rule": "Two-layer boards up to 100 \u00d7 100 mm get JLCPCB's lowest price; past that it rises steeply",
81
105
  "kind": "community",
82
106
  "source": "https://hwdocs.hackclub.dev/user-contrib-guides/jlc-cost-optimizing/",
83
107
  "checked": "2026-10-14"
package/m4.json ADDED
@@ -0,0 +1,11 @@
1
+ {
2
+ "_doc": "M4 socket head screws and hex nuts. kind as in x1c.json.",
3
+ "name": "m4",
4
+ "rules": {
5
+ "clearance": {"value": 4.5, "unit": "mm", "rule": "Clearance hole for an M4 screw, medium fit", "kind": "spec", "source": "ISO 273", "checked": "2026-10-27"},
6
+ "head": {"value": 7, "unit": "mm", "rule": "M4 socket head cap screw head diameter", "kind": "spec", "source": "ISO 4762", "checked": "2026-10-27"},
7
+ "head_height": {"value": 4, "unit": "mm", "rule": "M4 socket head cap screw head height", "kind": "spec", "source": "ISO 4762", "checked": "2026-10-27"},
8
+ "nut_flats": {"value": 7, "unit": "mm", "rule": "M4 hex nut width across flats", "kind": "spec", "source": "ISO 4032", "checked": "2026-10-27"},
9
+ "nut_height": {"value": 3.2, "unit": "mm", "rule": "M4 hex nut height", "kind": "spec", "source": "ISO 4032", "checked": "2026-10-27"}
10
+ }
11
+ }
package/m5.json ADDED
@@ -0,0 +1,11 @@
1
+ {
2
+ "_doc": "M5 socket head screws and hex nuts. kind as in x1c.json.",
3
+ "name": "m5",
4
+ "rules": {
5
+ "clearance": {"value": 5.5, "unit": "mm", "rule": "Clearance hole for an M5 screw, medium fit", "kind": "spec", "source": "ISO 273", "checked": "2026-10-27"},
6
+ "head": {"value": 8.5, "unit": "mm", "rule": "M5 socket head cap screw head diameter", "kind": "spec", "source": "ISO 4762", "checked": "2026-10-27"},
7
+ "head_height": {"value": 5, "unit": "mm", "rule": "M5 socket head cap screw head height", "kind": "spec", "source": "ISO 4762", "checked": "2026-10-27"},
8
+ "nut_flats": {"value": 8, "unit": "mm", "rule": "M5 hex nut width across flats", "kind": "spec", "source": "ISO 4032", "checked": "2026-10-27"},
9
+ "nut_height": {"value": 4.7, "unit": "mm", "rule": "M5 hex nut height", "kind": "spec", "source": "ISO 4032", "checked": "2026-10-27"}
10
+ }
11
+ }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@rulecad/rules",
3
- "version": "0.2.0",
4
- "description": "Researched rule sets as open data: a Bambu Lab X1C, Cherry MX switches, OEM keycaps, M2 inserts, the Raspberry Pi Pico and more, each value with its source.",
3
+ "version": "0.3.4",
4
+ "description": "Researched rule sets as open data: a Bambu Lab X1C, Cherry MX switches, OEM keycaps, M2 inserts, the Raspberry Pi Pico, materials for analysis (printed PLA and PETG, aluminium, steel, titanium) and more, each value with its source.",
5
5
  "type": "module",
6
6
  "exports": {
7
7
  "./*": "./*"
package/petg.json ADDED
@@ -0,0 +1,12 @@
1
+ {
2
+ "_doc": "Bambu Lab PETG HF, printed, for analysis: stiffness and strength along the layers (x-y) and across them (z). Printed values vary with the printer, settings and spool: measure your own (the lever bench does) and record it as kind measured.",
3
+ "name": "petg",
4
+ "rules": {
5
+ "modulus": {"value": 1810, "unit": "MPa", "rule": "Young's modulus along the layers (x-y), ± 190", "kind": "spec", "source": "Bambu Lab PETG HF technical data sheet V1.0 (ISO 527), https://store.bblcdn.com/3a230e260a3a47c2b0db0156e07eef91.pdf", "checked": "2026-10-27"},
6
+ "modulus_z": {"value": 1540, "unit": "MPa", "rule": "Young's modulus across the layers (z), ± 130", "kind": "spec", "source": "Bambu Lab PETG HF technical data sheet V1.0 (ISO 527)", "checked": "2026-10-27"},
7
+ "strength": {"value": 34, "unit": "MPa", "rule": "Tensile strength along the layers (x-y), ± 4", "kind": "spec", "source": "Bambu Lab PETG HF technical data sheet V1.0 (ISO 527)", "checked": "2026-10-27"},
8
+ "strength_z": {"value": 23, "unit": "MPa", "rule": "Tensile strength across the layers (z), ± 4", "kind": "spec", "source": "Bambu Lab PETG HF technical data sheet V1.0 (ISO 527)", "checked": "2026-10-27"},
9
+ "poisson": {"value": 0.38, "rule": "Poisson's ratio (Bambu publish none)", "kind": "estimate", "source": "Typical for PETG; printed parts vary", "checked": "2026-10-27"},
10
+ "density": {"value": 1.27, "unit": "g/cm³", "rule": "Density of PETG", "kind": "estimate", "source": "Typical for PETG (1.23 to 1.29 g/cm³ across makers' data sheets)", "checked": "2026-10-27"}
11
+ }
12
+ }
package/pla.json ADDED
@@ -0,0 +1,11 @@
1
+ {
2
+ "_doc": "Bambu Lab PLA Basic, printed, for analysis: stiffness and strength along the layers (x-y) and across them (z). Printed values vary with the printer, settings and spool: measure your own (the lever bench does) and record it as kind measured.",
3
+ "name": "pla",
4
+ "rules": {
5
+ "modulus": {"value": 2680, "unit": "MPa", "rule": "Young's modulus along the layers (x-y), ± 130", "kind": "spec", "source": "Bambu Lab PLA Basic technical data sheet V2.0 (ISO 527), https://www.impresoras3d.com/wp-content/uploads/2023/08/TDS-Bambu-PLA-Basic-Technical-Data-Sheet.pdf", "checked": "2026-10-27"},
6
+ "modulus_z": {"value": 2160, "unit": "MPa", "rule": "Young's modulus across the layers (z), ± 90", "kind": "spec", "source": "Bambu Lab PLA Basic technical data sheet V2.0 (ISO 527)", "checked": "2026-10-27"},
7
+ "strength": {"value": 39, "unit": "MPa", "rule": "Tensile strength along the layers (x-y), ± 2", "kind": "community", "source": "Bambu Lab PLA Basic technical data sheet V2.0 (ISO 527), as quoted by resellers: check the current sheet", "checked": "2026-10-27"},
8
+ "poisson": {"value": 0.36, "rule": "Poisson's ratio (Bambu publish none)", "kind": "estimate", "source": "Typical for PLA; Farah, Anderson, Langer (2016), Physical and mechanical properties of PLA, Advanced Drug Delivery Reviews 107", "checked": "2026-10-27"},
9
+ "density": {"value": 1.26, "unit": "g/cm³", "rule": "Density of the filament", "kind": "spec", "source": "Bambu Lab PLA Basic technical data sheet V2.0", "checked": "2026-10-27"}
10
+ }
11
+ }
package/rp2040.json ADDED
@@ -0,0 +1,54 @@
1
+ {
2
+ "_doc": "The Raspberry Pi RP2040 microcontroller: which of its package pins carry which GPIO. kind as in x1c.json.",
3
+ "name": "rp2040",
4
+ "rules": {
5
+ "package_pins": {
6
+ "value": 56,
7
+ "unit": "pins",
8
+ "rule": "QFN-56, 7 x 7 mm, 0.4 mm pitch",
9
+ "kind": "spec",
10
+ "source": "https://datasheets.raspberrypi.com/rp2040/rp2040-datasheet.pdf",
11
+ "checked": "2026-11-01"
12
+ },
13
+ "gpio": {
14
+ "value": 30,
15
+ "unit": "pins",
16
+ "rule": "Package pins that carry GPIO, listed in pins (package pin: GPIO). GPIO26 to 29 are also ADC0 to 3",
17
+ "kind": "community",
18
+ "source": "RP2040 datasheet, 1.4.3 Pin Descriptions (https://datasheets.raspberrypi.com/rp2040/rp2040-datasheet.pdf); written from it, and checked against Sea-Picro's net names for the 23 GPIO it brings out",
19
+ "checked": "2026-11-01",
20
+ "pins": {
21
+ "2": "GPIO0",
22
+ "3": "GPIO1",
23
+ "4": "GPIO2",
24
+ "5": "GPIO3",
25
+ "6": "GPIO4",
26
+ "7": "GPIO5",
27
+ "8": "GPIO6",
28
+ "9": "GPIO7",
29
+ "11": "GPIO8",
30
+ "12": "GPIO9",
31
+ "13": "GPIO10",
32
+ "14": "GPIO11",
33
+ "15": "GPIO12",
34
+ "16": "GPIO13",
35
+ "17": "GPIO14",
36
+ "18": "GPIO15",
37
+ "27": "GPIO16",
38
+ "28": "GPIO17",
39
+ "29": "GPIO18",
40
+ "30": "GPIO19",
41
+ "31": "GPIO20",
42
+ "32": "GPIO21",
43
+ "34": "GPIO22",
44
+ "35": "GPIO23",
45
+ "36": "GPIO24",
46
+ "37": "GPIO25",
47
+ "38": "GPIO26",
48
+ "39": "GPIO27",
49
+ "40": "GPIO28",
50
+ "41": "GPIO29"
51
+ }
52
+ }
53
+ }
54
+ }
package/s275.json ADDED
@@ -0,0 +1,10 @@
1
+ {
2
+ "_doc": "Structural steel S275 (EN 10025-2), for analysis.",
3
+ "name": "s275",
4
+ "rules": {
5
+ "modulus": {"value": 210000, "unit": "MPa", "rule": "Young's modulus", "kind": "spec", "source": "EN 1993-1-1, 3.2.6", "checked": "2026-10-27"},
6
+ "poisson": {"value": 0.3, "rule": "Poisson's ratio", "kind": "spec", "source": "EN 1993-1-1, 3.2.6", "checked": "2026-10-27"},
7
+ "strength": {"value": 275, "unit": "MPa", "rule": "Yield strength, up to 16 mm thick", "kind": "spec", "source": "EN 10025-2", "checked": "2026-10-27"},
8
+ "density": {"value": 7.85, "unit": "g/cm³", "rule": "Density", "kind": "spec", "source": "EN 1991-1-1, table A.4", "checked": "2026-10-27"}
9
+ }
10
+ }
package/ss304.json ADDED
@@ -0,0 +1,10 @@
1
+ {
2
+ "_doc": "Stainless steel 304, annealed, for analysis.",
3
+ "name": "ss304",
4
+ "rules": {
5
+ "modulus": {"value": 193000, "unit": "MPa", "rule": "Young's modulus", "kind": "spec", "source": "ASM Aerospace Specification Metals, AISI Type 304 Stainless Steel, https://asm.matweb.com/search/specificmaterial.asp?bassnum=mq304a", "checked": "2026-10-27"},
6
+ "poisson": {"value": 0.29, "rule": "Poisson's ratio", "kind": "spec", "source": "ASM, AISI Type 304", "checked": "2026-10-27"},
7
+ "strength": {"value": 215, "unit": "MPa", "rule": "Tensile yield strength, annealed", "kind": "spec", "source": "ASM, AISI Type 304", "checked": "2026-10-27"},
8
+ "density": {"value": 8.0, "unit": "g/cm³", "rule": "Density", "kind": "spec", "source": "ASM, AISI Type 304", "checked": "2026-10-27"}
9
+ }
10
+ }
package/ti64.json ADDED
@@ -0,0 +1,11 @@
1
+ {
2
+ "_doc": "Titanium Ti-6Al-4V (grade 5), annealed, for analysis.",
3
+ "name": "ti64",
4
+ "rules": {
5
+ "modulus": {"value": 113800, "unit": "MPa", "rule": "Young's modulus", "kind": "spec", "source": "ASM Aerospace Specification Metals, Titanium Ti-6Al-4V (Grade 5), Annealed, https://asm.matweb.com/search/specificmaterial.asp?bassnum=mtp641", "checked": "2026-10-27"},
6
+ "poisson": {"value": 0.342, "rule": "Poisson's ratio", "kind": "spec", "source": "ASM, Ti-6Al-4V annealed", "checked": "2026-10-27"},
7
+ "strength": {"value": 880, "unit": "MPa", "rule": "Tensile yield strength", "kind": "spec", "source": "ASM, Ti-6Al-4V annealed", "checked": "2026-10-27"},
8
+ "fatigue": {"value": 510, "unit": "MPa", "rule": "Fatigue strength at 10,000,000 cycles, unnotched", "kind": "spec", "source": "ASM, Ti-6Al-4V annealed", "checked": "2026-10-27"},
9
+ "density": {"value": 4.43, "unit": "g/cm³", "rule": "Density", "kind": "spec", "source": "ASM, Ti-6Al-4V annealed", "checked": "2026-10-27"}
10
+ }
11
+ }
package/x1c.json CHANGED
@@ -58,6 +58,14 @@
58
58
  "source": "Common FDM practice; tune with a test print",
59
59
  "checked": "2026-10-11"
60
60
  },
61
+ "print_gap": {
62
+ "value": 0.3,
63
+ "unit": "mm",
64
+ "rule": "Narrowest gap between parts printed in place, side by side, that still prints apart (a flexure and the frame round it, a shuttle in its slot): the gap each side, not the total",
65
+ "kind": "estimate",
66
+ "source": "A reasoned guess for a 0.42 mm line; measure it with the fit test plate (examples/bench/projects/launcher/objects/fittest)",
67
+ "checked": "2026-11-01"
68
+ },
61
69
  "overhang": {
62
70
  "value": 45,
63
71
  "unit": "\u00b0",
@@ -89,6 +97,14 @@
89
97
  "kind": "community",
90
98
  "source": "Common FDM practice",
91
99
  "checked": "2026-10-11"
100
+ },
101
+ "foot": {
102
+ "value": 0.15,
103
+ "unit": "mm",
104
+ "rule": "How far the first layer spreads each side as it is squashed on to the bed (elephant's foot): two parts printed in place must stand print_gap plus twice this apart there, or they print as one",
105
+ "kind": "community",
106
+ "source": "Bambu Studio's default elephant foot compensation, 0.15 mm, the amount it shrinks the first layer by to undo the spread",
107
+ "checked": "2026-11-07"
92
108
  }
93
109
  }
94
110
  }