Skip to content

Add starts parameter to generic_bottle_cap() for multi-start threads - #2020

Open
HannesGitH wants to merge 1 commit into
BelfrySCAD:masterfrom
HannesGitH:bottlecap-multistart
Open

Add starts parameter to generic_bottle_cap() for multi-start threads#2020
HannesGitH wants to merge 1 commit into
BelfrySCAD:masterfrom
HannesGitH:bottlecap-multistart

Conversation

@HannesGitH

Copy link
Copy Markdown

Plastic bottle necks — especially the larger PET finishes (38 mm and up) — commonly use 2- or 3-start threads, but generic_bottle_cap() could only produce single-start threads. I ran into this making an adapter cap for a 38 mm PET bottle: the pitch was right, but the cap only engaged for a fraction of a turn before binding, because the neck lead is 2 * pitch.

thread_helix() already supports starts, so this just passes it through:

  • New starts argument (default 1), documented in the Arguments block and the Description.
  • turns is divided by starts, since thread_helix() rises pitch * starts per revolution — without that the thread would overflow the cap cavity.
  • pitch keeps its existing meaning (axial distance between adjacent threads, i.e. what you measure with calipers on the neck), so the lead is pitch * starts.
  • One added doc example showing a 2-start cap.

Backwards compatible: with the default starts=1 the generated geometry is unchanged — I rendered generic_bottle_cap(texture="knurled",neck_od=25,thread_od=30,height=10) before and after and the STLs are byte-identical (md5 2a525bc9150080fda6e2a76673f74858).

The 2- and 3-start variants render manifold with no warnings under --hardwarnings.

Happy to add the matching starts to generic_bottle_neck() in a follow-up (or here, if you prefer) — I kept this one minimal.

Plastic bottle necks (especially larger PET finishes) commonly use 2- or
3-start threads, which generic_bottle_cap() could not model. thread_helix()
already supports starts, so pass it through and divide the turn count by
starts so the thread still spans the same axial length inside the cap.

With the default starts=1 the output is unchanged.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant