Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 2 commits into from
Jan 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion docs/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,11 @@ argument for higbee_arc):
:alt: M12x0.5 nut

Note that for a nut you also have to specify an outer diameter. The inner
diameter is implicitly given by the thread designator ("M12x0.5" in this case).
diameter is implicitly given by the thread designator ("M12x0.5" in this case). You can set the number of sides for the nut! So you can make hex nuts:

.. code-block:: OpenScad

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

To make a threaded hole (e.g. in a plate), an intuitive approach would be to
create the difference of the plate and a bolt. However, this part would not work
Expand Down
15 changes: 15 additions & 0 deletions docs/img_prep/nut_sides.scad
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
/*
Demo nut_sides argument of nut() module.
*/

use <threadlib/threadlib.scad>
include <../../THREAD_TABLE.scad>

type = "M12x0.5";
turns = 7;
Douter = 16;
higbee_arc = 45;
fn = 16;
nut_sides = 6;

nut(type, turns, Douter, higbee_arc, fn, THREAD_TABLE, nut_sides);
5 changes: 3 additions & 2 deletions threadlib.scad
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@ module bolt(designator, turns, higbee_arc=20, fn=120, table=THREAD_TABLE) {
};
};

module nut(designator, turns, Douter, higbee_arc=20, fn=120, table=THREAD_TABLE) {
module nut(designator, turns, Douter, higbee_arc=20, fn=120, table=THREAD_TABLE, nut_sides=0) {
nut_sides = nut_sides == 0 ? fn : nut_sides;
union() {
specs = thread_specs(str(designator, "-int"), table=table);
P = specs[0]; Dsupport = specs[2];
Expand All @@ -57,7 +58,7 @@ module nut(designator, turns, Douter, higbee_arc=20, fn=120, table=THREAD_TABLE)

translate([0, 0, -P / 2])
difference() {
cylinder(h=H, d=Douter, $fn=fn);
cylinder(h=H, d=Douter, $fn=nut_sides);
translate([0, 0, -0.1])
cylinder(h=H+0.2, d=Dsupport, $fn=fn);
};
Expand Down
Loading