Skip to content

Commit 1b71371

Browse files
scottconverseclaude
andcommitted
v0.4.0 polish: address review nits (docs completeness + 2 code edges)
- tq_threads_selftest: tighten preset-count floor 54 -> 101 (catch regressions) - render_proof.ps1: honor an absolute -OutDir (don't join onto repo root) - MANUAL: document v0.4 wood_screw/bottle_thread params + tq_preset_count/selfcheck - README/index.html: M1.6-M64 range; landing card mentions v0.4 (fit, 101 presets) - REFERENCES: fillet rr=H/6 / rc=H/12 notation; note preset lists are excerpts; ISO 261 (defines fine) vs ISO 262 (selects) wording Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
1 parent cdfd4cc commit 1b71371

6 files changed

Lines changed: 40 additions & 20 deletions

File tree

MANUAL.md

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -120,10 +120,13 @@ tq_preset("M12") // function -> [12, 1.75] (or undef if unknown)
120120
tq_thread_preset("M12", 24) // module -> renders the M12 thread, 24 mm
121121
tq_thread_tpi(d=tq_in(1/4), tpi=20, length=12) // by threads-per-inch
122122
tq_in(3/8) // 9.525 (inch -> mm)
123+
tq_preset_count() // 101 (number of named presets)
124+
tq_presets_selfcheck() // true (every row resolves to its own values)
123125
```
124126

125127
`tq_thread_preset` and `tq_thread_tpi` forward `internal`, `starts`, `hand`,
126128
`clearance`, `profile`, `lead_in`, `lead_out`, `fn`, `center` to `tq_thread`.
129+
Use `assert(tq_presets_selfcheck())` to guard table integrity at parse time.
127130

128131
Preset list: see [README → Presets](README.md#presets). Add your own by editing
129132
the `TQ_PRESETS` table (`[name, major_mm, pitch_mm]`).
@@ -167,18 +170,23 @@ tq_bolt(d, pitch, length, head="socket"|"hex"|"plain"|"none",
167170
tq_countersunk_bolt(d, pitch, length, head_d=ISO10642, head_angle=90,
168171
shank=0, drive="hex", …);
169172
170-
tq_wood_screw(d, length, pitch=0.6·d, head="countersunk"|"pan",
171-
head_d=2·d, point=true, clearance=0, …);
173+
tq_wood_screw(d, length, pitch=0.6·d, head="countersunk"|"pan"|"none",
174+
head_d=2·d, point="gimlet"|"cone"|"flat", taper=0, core_d,
175+
thread_depth, shank=0, clearance=0, …);
172176
```
173177

174178
- **`tq_bolt`** — socket head has a hex drive recess in the bearing face; head
175179
defaults to ISO 4762 `dk`/`k` (socket) or ISO 4032 across-flats (hex). `shank`
176180
is an unthreaded shoulder length (`< length`), diameter flush with the crests.
181+
`drive="hex"|"phillips"|"none"`.
177182
- **`tq_countersunk_bolt`** — 90° flat head (ISO 10642 head diameter by default),
178-
wide at the bearing face, narrowing into the thread.
179-
- **`tq_wood_screw`** — coarse, sharp-profile, single-start screw with a gimlet
180-
point carved by an envelope cone. Generic self-tapping/wood-style screw, **not**
181-
a specific wood-screw standard. `clearance=0` (it forms its own mating thread).
183+
wide at the bearing face, narrowing into the thread. `drive` as above.
184+
- **`tq_wood_screw`** — coarse, sharp-profile, single-start screw. **Generic**
185+
printable wood-screw-LIKE geometry, **not** a specific standard. Params:
186+
`point` (`gimlet` sharp / `cone` blunt / `flat`; the old `point=true/false`
187+
bool still works), `taper` (Ø reduction toward the tip), `core_d` (root Ø) or
188+
`thread_depth` (radial depth), and `shank` (smooth unthreaded length under the
189+
head). `clearance=0` (it forms its own mating thread).
182190

183191
```openscad
184192
tq_bolt(8, 1.25, 20, head="socket", shank=5);
@@ -199,9 +207,15 @@ tq_washer(size, od=ISO7089, id=ISO7089, thk=ISO7089);
199207
tq_rod_start(d, pitch, length, …); // chamfered entry, square top
200208
tq_rod_end(d, pitch, length, …); // square bottom, chamfered finish
201209
tq_rod_coupler(d, pitch, length, od=d+5, …); // internally-threaded sleeve
202-
tq_bottle_thread(d, pitch, length, internal=false, depth_frac=0.6, …);
210+
tq_bottle_thread(d, pitch, length, starts=1, internal=false, depth_frac=0.6,
211+
tooth_height, angle=60, profile="rounded", lead_in, …);
203212
```
204213

214+
- **`tq_bottle_thread`** is **generic** printable closure-style threading (NOT
215+
SPI/GPI/ISO). New params: `tooth_height` (explicit depth), `angle` (flank, for
216+
flat/sharp `profile`), `profile` (`rounded` default), `lead_in` (defaults: ext
217+
yes / int no), with `starts` and `internal`.
218+
205219
- **Clearance holes** use ISO 273 diameters (`fit` selects close/medium/free);
206220
drop them into a `difference()`.
207221
- **Recessed (counterbore)** adds a flat-bottom pocket for a cap head at the +Z

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
- **Clean‑room & standards‑based.** Written from public engineering standards only (ISO 68‑1, ISO 261/262, ISO 273, ISO 4032, ISO 4762, ISO 7089, ISO 10642, ASME B1.1). No third‑party thread library was copied or consulted — see [REFERENCES.md](REFERENCES.md).
2323
- **Manifold by construction.** The thread surface is a helical *height‑field* turned into one closed `polyhedron` (no boolean unions to go non‑manifold). It renders cleanly and slices.
2424
- **Printable‑first.** Fit clearance, internal‑oversize / external‑undersize compensation, lead‑in chamfers, rounded roots, and `$fn/$fa/$fs` resolution are all parameters.
25-
- **Batteries included.** Presets **M2–M64** + common fine pitches + UNC/UNF, plus bolts (hex/socket/**Phillips**), nuts, washers, countersunk & wood screws, **augers**, clearance/counterbore/countersink holes, standoffs, couplers, child‑difference wrappers (`tq_tap`/`tq_drill`/…), and a debug view. Custom flank **angle**, explicit **tooth_height**, and **taper** round out the profile controls.
25+
- **Batteries included.** **101 presets** (M1.6–M64 coarse + full ISO 261 fine + UNC/UNF #0–1″), plus bolts (hex/socket/**Phillips**), nuts, washers, countersunk & wood screws, **augers**, clearance/counterbore/countersink holes, standoffs, couplers, child‑difference wrappers (`tq_tap`/`tq_drill`/…), and a debug view. Profile control: custom flank **angle**, **tooth_height**, **minor_d**, **taper**, and optional **ISO 965 `fit=`** allowance.
2626
- **MIT licensed** → permissive *and* GPL‑2.0‑compatible, so it drops into a GPL‑2.0‑only project (e.g. TinkerQuarry) unchanged.
2727

2828
<div align="center">

REFERENCES.md

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,8 @@ H = (sqrt(3)/2) · P = 0.8660254 · P
7474
| Root flat width (axial) | `P/4` | 0.250·P |
7575
| Pitch-Ø offset from major | `2·(3H/8) = 0.75·H` | 0.649519·P |
7676
| Minor-Ø offset from major (basic) | `2·(5H/8) = 1.25·H` | 1.082532·P |
77-
| Rounded root radius (UNR/ISO) | `≈ 0.144·P` | 0.144·P |
78-
| Rounded crest radius (this lib) | `≈ 0.072·P` | 0.072·P |
77+
| Rounded root radius (UNR/ISO) | `rr = H/6 ≈ 0.1443·P` | 0.1443·P |
78+
| Rounded crest radius (this lib) | `rc = H/12 ≈ 0.0722·P` | 0.0722·P |
7979

8080
**Derivation of the rounded fillet radii** (used by `profile="rounded"`,
8181
`_tq_table_round`). The root fillet uses the standard UNR/ISO-class rounded-root
@@ -100,16 +100,22 @@ Standards:
100100

101101
### Preset pitch values (tabulated facts)
102102

103-
Metric coarse, `[major mm, pitch mm]`:
103+
> The lists below are **representative excerpts**. The full set is **101 presets**
104+
> in `TQ_PRESETS` (see `tq_preset_count()` / the README "Presets (101)" list);
105+
> every row is verified by `tq_presets_selfcheck()`.
106+
107+
Metric coarse (incl. M1.6), `[major mm, pitch mm]`:
104108
```
105-
M2 0.40 M2.5 0.45 M3 0.50 M3.5 0.60 M4 0.70 M5 0.80 M6 1.00 M7 1.00
109+
M1.6 0.35 M2 0.40 M2.5 0.45 M3 0.50 M3.5 0.60 M4 0.70 M5 0.80 M6 1.00 M7 1.00
106110
M8 1.25 M10 1.50 M12 1.75 M14 2.00 M16 2.00 M18 2.50 M20 2.50 M22 2.50
107111
M24 3.00 M27 3.00 M30 3.50 M33 3.50 M36 4.00 M39 4.00 M42 4.50 M45 4.50
108112
M48 5.00 M52 5.00 M56 5.50 M60 5.50 M64 6.00
109113
```
110-
Metric fine: `M8x1 M10x1.25 M10x1 M12x1.5 M12x1.25 M16x1.5 M20x1.5 M24x2`.
111-
Unified (`major = inch·25.4`, `pitch = 25.4/TPI`):
112-
`1/4-20 1/4-28 3/8-16 3/8-24 1/2-13 1/2-20`.
114+
Metric fine — **ISO 261 defines the fine-pitch series; ISO 262 selects preferred
115+
sizes** — e.g. `M8x1 M10x1.25 M12x1.5 M16x1.5 M20x1.5 M24x2 M30x2 M36x3` (full
116+
series in `TQ_PRESETS`).
117+
Unified (`major = inch·25.4`, `pitch = 25.4/TPI`), e.g.
118+
`#6-32 #10-32 1/4-20 1/4-28 3/8-16 1/2-13 3/4-10 1-8` (full UNC/UNF set in `TQ_PRESETS`).
113119

114120
---
115121

docs/index.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ <h2>Why tq-threads</h2>
9090
<div class="card"><h3>🧩 Manifold by construction</h3><p>The thread surface is a helical height-field turned into one closed <code>polyhedron</code> — no boolean unions to go non-manifold. It renders cleanly and slices.</p></div>
9191
<div class="card"><h3>📐 Standards-based, clean-room</h3><p>Built only from public standards (ISO 68-1/261/262/273/4032/4762/7089/10642, ASME&nbsp;B1.1). No third-party thread library was copied or consulted.</p></div>
9292
<div class="card"><h3>🖨️ Printable-first</h3><p>Fit clearance, internal-oversize / external-undersize compensation, lead-in chamfers, rounded roots, and real <code>$fn/$fa/$fs</code> are all parameters.</p></div>
93-
<div class="card"><h3>🔩 Batteries included</h3><p>Presets <strong>M2–M64</strong> + fine + UNC/UNF, plus bolts, nuts, washers, countersunk &amp; wood screws, clearance/counterbore/countersink holes, standoffs, couplersand v0.3 adds <strong>augers, Phillips drives, tapered &amp; custom‑angle threads,</strong> and child‑difference <code>tq_tap</code>/<code>tq_drill</code> wrappers.</p></div>
93+
<div class="card"><h3>🔩 Batteries included</h3><p><strong>101 presets</strong> (M1.6–M64 coarse + full ISO 261 fine + UNC/UNF #0–1″), plus bolts, nuts, washers, countersunk &amp; wood screws, augers, Phillips drives, clearance/counterbore/countersink holes, standoffs, couplers, and child‑difference <code>tq_tap</code>/<code>tq_drill</code> wrappers. v0.4 adds an optional <strong>ISO&nbsp;965 <code>fit=</code></strong> allowance, <code>minor_d</code>, taper &amp; custom flank angle.</p></div>
9494
<div class="card"><h3>⚖️ MIT licensed</h3><p>Permissive <em>and</em> GPL-2.0-compatible, so it drops into a GPL-2.0-only project (e.g.&nbsp;TinkerQuarry) unchanged.</p></div>
9595
<div class="card"><h3>✅ Tested &amp; CI</h3><p>Compile-time preset assertions, split fast/heavy suites, a PowerShell render-proof, and GitHub Actions rendering on every push.</p></div>
9696
</div>
@@ -151,7 +151,7 @@ <h3 style="margin-top:18px">Migrating from <code>threads.scad</code>?</h3>
151151
<section style="background:var(--bg2)">
152152
<div class="wrap">
153153
<h2>Presets</h2>
154-
<p class="mut"><strong>Metric coarse:</strong> M2 M2.5 M3 M3.5 M4 M5 M6 M7 M8 M10 M12 M14 M16 M18 M20 M22 M24 M27 M30 M33 M36 M39 M42 M45 M48 M52 M56 M60 M64<br>
154+
<p class="mut"><strong>Metric coarse:</strong> M1.6 M2 M2.5 M3 M3.5 M4 M5 M6 M7 M8 M10 M12 M14 M16 M18 M20 M22 M24 M27 M30 M33 M36 M39 M42 M45 M48 M52 M56 M60 M64<br>
155155
<strong>Metric fine:</strong> M8x1 M10x1.25 M10x1 M12x1.5 M12x1.25 M16x1.5 M20x1.5 M24x2 &nbsp;·&nbsp; <strong>Unified:</strong> 1/4-20 1/4-28 3/8-16 3/8-24 1/2-13 1/2-20</p>
156156
</div>
157157
</section>

scripts/render_proof.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ function Resolve-OpenSCAD([string]$hint) {
4242
}
4343

4444
$oscad = Resolve-OpenSCAD $OpenSCAD
45-
$outAbs = Join-Path $root $OutDir
45+
$outAbs = if ([System.IO.Path]::IsPathRooted($OutDir)) { $OutDir } else { Join-Path $root $OutDir }
4646
New-Item -ItemType Directory -Force -Path $outAbs | Out-Null
4747
# OpenSCAD prints --version to stderr; capture via redirect (no 2>&1 -> avoids
4848
# PowerShell 5.1 NativeCommandError noise).

tq_threads_selftest.scad

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ include <tq_threads.scad>
1515
// -- preset table integrity --------------------------------------------------
1616
assert(tq_presets_selfcheck(),
1717
"SELFTEST: preset table self-check failed (a row is malformed or unresolvable)");
18-
assert(tq_preset_count() >= 54,
19-
str("SELFTEST: preset count regressed below 54: ", tq_preset_count()));
18+
assert(tq_preset_count() >= 101,
19+
str("SELFTEST: preset count regressed below 101 (v0.4 baseline): ", tq_preset_count()));
2020

2121
// -- spot-check nominal preset values (exact) --------------------------------
2222
assert(tq_preset("M3") == [3.0, 0.50], "SELFTEST: M3 nominal");

0 commit comments

Comments
 (0)