adrianschlatter / threadlib

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

Added nut_sides parameter to allow creation of non-cylinder nut #83

Closed linkian209 closed 9 months ago

linkian209 commented 11 months ago

Added a new parameter to the nut module that allows the creation of non cylinder nuts.

nut("M30", turns=3, Douter=46, nut_sides=6);

Would yield this: image

adrianschlatter commented 9 months ago

Hi @linkian209

Thanks for your PR. Do I understand correctly that the nut_sides argument does exactly the same thing as the fn argument?

linkian209 commented 9 months ago

Do I understand correctly that the nut_sides argument does exactly the same thing as the fn argument?

It is the $fn argument specifically for the outer cyclinder. I wanted to make a hex nut and found that this was a fairly simple way to add this functionality to the library.

adrianschlatter commented 9 months ago

Ok, I see. I have rebased your PR on top of the develop branch so that the PR does not re-introduce bugs I had already fixed. I‘m currently on a train, but when I find time I‘d like to test whether we can set the default value of nut_sides to something invalid. Otherwise, we cannot set nut_sides to 120 and fn to something else.

Also, I want to test whether the change of order of the arguments will cause problems.

adrianschlatter commented 9 months ago

Ok, default value of 0 works for nut_sides. Also, we are not allowed to change the order of arguments for backwards compatibility reasons but it is ok to add a new argument at the end.

I am going to merge this. Thanks for contributing to threadlib!