adrianschlatter / threadlib

thread library for OpenSCAD
BSD 3-Clause "New" or "Revised" License
351 stars 34 forks source link

fn needs to be passed in call to straight_thread() #46

Closed samstinson closed 3 years ago

samstinson commented 3 years ago

In this call https://github.com/adrianschlatter/threadlib/blob/develop/threadlib.scad#L31 You need to pass the fn= parameter to straight_thread() or the thread is not actually generated with the desired number of facets. This is readily apparent when using low facet counts, $fn=5 for example (yes it makes a low-poly impossible bolt, but it looks cool sitting on your desk)

Also after fixing this, I note that with odd number of facets the nut() and tap() functions have the threads offset by one half of a facet. I fixed this by adding a rotate([0,0,360/fn/2]) to the thread() calls in those functions, but perhaps it needs to be rotated in the opposite direction? I am not sure that it matters.

test case for visualizing - bolt("M4", turns=5, fn=5); nut("M4", turns=5, Douter=6, fn=5);

adrianschlatter commented 3 years ago

Thank @Atharr for fixing this.