SolidCode / SolidPython

A python frontend for solid modelling that compiles to OpenSCAD
1.11k stars 173 forks source link

Extend screw_thread.thread to handle multiple starts and default threads with flat tops #93

Closed nerdfever closed 6 years ago

nerdfever commented 6 years ago

Many standard (common) thread profiles have flat tops. For example, see https://en.wikipedia.org/wiki/Unified_Thread_Standard

An implementation that does both multiple starts and default thread profiles with either pointy or flat tops is attached (it's quite simple).

nerdlib_solid.py.txt

etjones commented 6 years ago

Sweet! There's more detail in the thread standard than I can quite grok, but I'd love it if the screws screw_thread.thread() generated were in line with the standard. Even more if we had some presets so we could just say, e.g. socket = screw_thread.quarter_twenty(external=False, height=25)

What would you like to do with this? It wouldn't take much code to make screw_thread.thread() take a starts argument; I could pop that in quickly. I also think that the flat topped thread profile is a good idea; I'd like to make that the default. I've got to do a little more looking at the standard to figure exactly where the flat segment of the default thread profile should go, but I think that's worth adding.

nerdfever commented 6 years ago

The thread standard is simpler than it looks.

I've already done what I wanted to with this - I thought you might like the code.

Nice as it sounds in theory to implement standard threads (and it's not difficult in SolidPython; with the right parameters the existing code will do it), in practice FDM-type printers can't print them accurately enough to be useful (at least not on screws smaller than my fingers). Maybe someday that'll change.

BTW: https://en.wikipedia.org/wiki/ISO_metric_screw_thread (very similar)

etjones commented 6 years ago

Good point. As I think about it, there's no way an FDM printer could do 1/4-20 threads. Maybe 1/4-5 threads, but even that would be a stretch. If I were designing things to print these days that used screws, I'd probably just put in hex holes for nuts and see about stopping the printer when it was time to insert them. Maybe I'll let this one lie for the moment. Thanks for passing on the goods!