Skip to content

Commit

Permalink
Fix backwards compatibility nut_sides arg
Browse files Browse the repository at this point in the history
* nut_sides must be last argument
* default value = 0. With 120 as default, we cannot set nut_sides to 120
  while simultaneously setting fn to something different from 120.
  • Loading branch information
adrianschlatter committed Jan 27, 2024
1 parent 90ac0e2 commit e2a6ce4
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
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);
4 changes: 2 additions & 2 deletions threadlib.scad
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ module bolt(designator, turns, higbee_arc=20, fn=120, table=THREAD_TABLE) {
};
};

module nut(designator, turns, Douter, higbee_arc=20, fn=120, nut_sides=120, table=THREAD_TABLE) {
nut_sides = nut_sides == 120 ? fn : nut_sides;
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 Down

0 comments on commit e2a6ce4

Please sign in to comment.