Welcome to the Onshape forum! Ask questions and join in the discussions about everything Onshape.

First time visiting? Here are some places to start:
  1. Looking for a certain topic? Check out the categories filter or use Search (upper right).
  2. Need support? Ask a question to our Community Support category.
  3. Please submit support tickets for bugs but you can request improvements in the Product Feedback category.
  4. Be respectful, on topic and if you see a problem, Flag it.

If you would like to contact our Community Manager personally, feel free to send a private message or an email.

New FeatureScript: Kochlias — printable threads (a fork of ThreadLab)

cedric_mesnil343
cedric_mesnil343 Member Posts: 7

Hi all,

I've published Kochlias, a fork of @antlu65's excellent ThreadLab, aimed at 3D printing and at the machinist's workflow.

https://cad.onshape.com/documents/d6e2a398d0e7b37afe88fa92/v/5baac74752c62319f39eb1e0/e/6f533cbe3629180515986c2f

All credit for the original goes to Anthony Lu. ThreadLab is his work; this is his code with a bug fix and some additions on top. The rename is deliberate — it exists so nobody mistakes this for an official ThreadLab release. Attribution and a full changelog are in the ThreadLabFeature.fs header.

What's new

Print clearance. A flank offset so a printed screw and a printed nut actually turn. Always ≥ 0 — it only ever removes material. Applied in full to each printed part, so: printed nut + steel screw → gap = c; two printed parts → gap = 2c. Measured on a bench, the gap follows the model to within a few percent, then saturates gently as the flank shift is clamped to stop the teeth merging at fine pitches.

Pilot (tap-drill) hole mode. Model the hole at the diameter you'd actually drill it, rather than at the major diameter. The major diameter is derived, the hole is bored out to it, and the thread is cut. The resulting solid is geometrically identical to threading a major-diameter hole (volumes agree to ~1e-7) — but the input is the real drill size, and the callout reports it. ISO M10×1: pilot 8.917 → nominal 10.000. This addresses a request that comes up repeatedly on the ThreadLab thread.

Left-handed multi-start threads — fixed. Single-start LH threads were always fine; the bug was LH + multi-start, where the sweep along a left-handed helix degenerates as the lead grows (stray bodies at 2 starts, hard failure at 4). LH bodies are now built as the exact mirror of the RH body. Screw/nut fit is now identical for RH and LH at 1, 2, 4 and 6 starts, to 1e-4 mm. Known limit: 8 starts still fails — but it fails for RH too, so that's a pre-existing sweep limit at very high lead, not a handedness issue.

Hole callouts fixed. tapPitch was hardcoded to 0; in pilot mode the callout now reports the real drill diameter.

Two UI changes that depart from ThreadLab

One Radial offset instead of External + Internal. Each of the upstream offsets was dead in the configuration the other served — externalOffset has no reachable effect on a hole, internalOffset none on a shaft — and they already shared a sign convention. Positive removes material: the shaft shrinks, the hole grows.

Rendering mode is one drop-down: Solid / Cosmetic / Blank / Global. With the guiding principle that the mode changes the rendering, never the design: no parameter is hidden and no value is reset when you switch, and the modelled envelope is identical in every mode (measured — the shaft and bore diameters are the same in Solid and in Cosmetic).

Global is the one I'd point at. Onshape has no multi-edit for features, so a model with a hundred threads means a hundred edits to change representation. In Global mode the feature reads the mode from a document variable #kochliasMode ("solid" / "cosmetic" / "blank"), so you work in cosmetic (instant regeneration) and flip one variable to go solid for the STL or the drawing. A missing or malformed variable is a hard error, on purpose — a silent fallback would leave half a model rendered one way and half the other.

Pilot mode works in every rendering mode, which makes Cosmetic + pilot the machinist's case: the model carries the real drill diameter and the drawing carries the M10×1 callout, with no modelled helix cluttering the view.

Notes

Every change was validated by measuring the resulting geometry through the API, not by eye. The regression benches live in a separate document so they don't clutter the custom-feature picker — you can re-run the numbers rather than take my word for them.

Comments and bug reports welcome.

(Disclosure: AI-assisted work — Claude.)

Comments

  • eric_pesty
    eric_pesty Member, pcbaevp Posts: 2,825 PRO

    That looks pretty cool, I'll have to play with it a bit more but so far it seems like a nice upgrade!

  • S1mon
    S1mon Member Posts: 4,456 PRO

    To save someone else the search…

    "Kochlias" (Κοχλίας) is the Greek word for "snail."

    Simon Gatrall | Product Development, Engineering, Design, Onshape | Ex- IDEO, PCH, Unagi, Carbon | LinkedIn

  • cedric_mesnil343
    cedric_mesnil343 Member Posts: 7

    Hi thanks for your message
    Do no hesitate if there are some missing add-on features .
    I fixed it for my own purpose, but I m fully open to add some other features and "try" to maintained as well as possible

  • cedric_mesnil343
    cedric_mesnil343 Member Posts: 7

    "Snail" is indeed the literal meaning, but κοχλίας (kochlias) also means spiral, helix, and screw — it's the Greek name for the Archimedes' screw. That's most likely the intended reference here, since the FeatureScript generates helical threads.

  • EvanReese
    EvanReese Member, Mentor Posts: 3,033 PRO

    Cool, thanks for sharing! Any reason to prefer cosmetic threads as face splits instead of the bump mapping used by the native hole feature? I think the original was done that way because Hole didn't do it yet, but now that it does, I prefer it.

    Evan Reese
    The Onsherpa | Reach peak Onshape productivity
    www.theonsherpa.com
  • EvanReese
    EvanReese Member, Mentor Posts: 3,033 PRO

    oh by the way, since you're using a cool, but hard to remember name, you could add a Filter Selector to the feature UI, which will make it still show up if you type "thread" in the feature list filter.

    • "Filter Selector": An array of strings used to find this feature in the feature list, when input as search terms after a colon. For example, if a feature specifies "Filter Selector" : ["foo", "bar"], then entering :foo or :bar in the feature list filter will show the feature.
    Evan Reese
    The Onsherpa | Reach peak Onshape productivity
    www.theonsherpa.com