diff options
author | Steven <steven.vasilogianis@gmail.com> | 2021-05-03 21:09:36 -0400 |
---|---|---|
committer | Steven <steven.vasilogianis@gmail.com> | 2021-05-03 21:09:36 -0400 |
commit | 021e1ece50908d01c054056985f08ab14ad5877d (patch) | |
tree | 0f4b0d1813285a271151f9cd0120533987f2ae7f | |
parent | daa7b057232227345c9be514ef701f05979b15ba (diff) |
separate modules out so that single_tab() can be called independently
-rw-r--r-- | tabs.scad | 52 |
1 files changed, 28 insertions, 24 deletions
@@ -1,35 +1,39 @@ | |||
1 | module tabs ( | 1 | include <BOSL2/std.scad>; |
2 | distance=100, | 2 | |
3 | module single_tab ( | ||
3 | tab_width=10, | 4 | tab_width=10, |
4 | tab_depth=5, | 5 | tab_depth=5, |
5 | tab_height=5, | 6 | tab_height=5, |
6 | male=true, | 7 | male=true, |
7 | tolerance=1, | 8 | tolerance=1, |
8 | edge_padding=0, | ||
9 | between=false | ||
10 | ) { | 9 | ) { |
11 | tab_line() children(); | 10 | size=male |
12 | 11 | ? [tab_width, tab_depth, tab_height] | |
13 | module tab () { | 12 | : [tab_width + tolerance, tab_depth + tolerance, tab_height + tolerance]; |
14 | size=male | 13 | move_dist = male ? 0 : (tolerance / 2); |
15 | ? [tab_width, tab_depth, tab_height] | 14 | if (male) { |
16 | : [tab_width + tolerance, tab_depth + tolerance, tab_height + tolerance]; | 15 | #cuboid(size); |
17 | move_dist = male ? 0 : (tolerance / 2); | 16 | } else { |
18 | if (male) { | 17 | cuboid(size); |
19 | #cuboid(size); | ||
20 | } else { | ||
21 | cuboid(size); | ||
22 | } | ||
23 | } | 18 | } |
19 | } | ||
24 | 20 | ||
25 | module tab_line () { | 21 | module tab_line ( |
26 | tab_spacing = tab_spacing(tab_width); | 22 | distance=100, |
27 | dist = between ? (distance - tab_spacing - tab_width) : distance - tab_width; | 23 | tab_width=10, |
28 | start=(dist / (-2)) + edge_padding + (tab_width / 2); | 24 | tab_depth=5, |
25 | tab_height=5, | ||
26 | male=true, | ||
27 | tolerance=1, | ||
28 | edge_padding=0, | ||
29 | between=false, | ||
30 | ) { | ||
31 | tab_spacing = tab_spacing(tab_width); | ||
32 | dist = between ? (distance - tab_spacing - tab_width) : distance - tab_width; | ||
33 | start=(dist / (-2)) + edge_padding + (tab_width / 2); | ||
29 | 34 | ||
30 | echo([start:tab_spacing:dist / 2]); | 35 | echo([start:tab_spacing:dist / 2]); |
31 | for ( i = [start:tab_spacing:dist / 2] ) { | 36 | for ( i = [start:tab_spacing:dist / 2] ) { |
32 | right(i) tab(); | 37 | right(i) single_tab(tab_width, tab_depth, tab_height, male, tolerance); |
33 | } | ||
34 | } | 38 | } |
35 | } | 39 | } |