summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSteven <steven.vasilogianis@gmail.com>2021-10-27 00:12:38 -0400
committerSteven <steven.vasilogianis@gmail.com>2021-10-27 00:14:35 -0400
commit6201f7346eed8bd9db361b6c11b528fd36b338a7 (patch)
tree185e942c197cdd42b795654e3e48416ef5999342
parent8e25598c8f5b2387fb1836a7dd6be1ed76ce98f3 (diff)
nothing significant
-rw-r--r--cubbies.scad72
-rwxr-xr-xshopenscad.sh10
2 files changed, 40 insertions, 42 deletions
diff --git a/cubbies.scad b/cubbies.scad
index 0531a7f..88740be 100644
--- a/cubbies.scad
+++ b/cubbies.scad
@@ -5,7 +5,7 @@ include <BOSL2/joiners.scad>;
5 5
6$fn=100; 6$fn=100;
7 7
8part="side test fit"; // [both:Bottom + Side,bottom::Bottom Only,side:Side Only,view_fit:Debugging view to confirm tab fit,bottom_tabs:Tabs only from bottom,side_tabs:Holes only from side] 8part="both"; // [both:Bottom + Side,bottom::Bottom Only,side:Side Only,view_fit:Debugging view to confirm tab fit,male_tabs:Tabs only from bottom,female_tabs:Holes only from side]
9 9
10/* [Cubby dimensions] */ 10/* [Cubby dimensions] */
11cubby_width=150; 11cubby_width=150;
@@ -28,13 +28,6 @@ tab_width=10;
28tab_padding=5; // minimum material between tabs 28tab_padding=5; // minimum material between tabs
29tab_tolerance=0.5; 29tab_tolerance=0.5;
30 30
31/* [Used only in tab fit tests] */
32// Smallest tolerance
33//tolerance_start=0.5;
34// Largest tolerance
35//tolerance_end=1.0;
36// Steps to increment from smallest to largest tolerance
37//tolerance_step=0.1;
38/* [Screw Tabs] */ 31/* [Screw Tabs] */
39screw_tabs=true; 32screw_tabs=true;
40 33
@@ -43,9 +36,8 @@ tab_depth=thickness;
43tab_height=thickness; 36tab_height=thickness;
44 37
45/* text inscribed (when printing tolerances) */ 38/* text inscribed (when printing tolerances) */
46text_extrude=2; 39text_inscription_depth=0.2;
47text_size=thickness * 0.8; 40text_size=thickness * 0.6;
48
49 41
50if ( part == "both" ) { 42if ( part == "both" ) {
51 both(); 43 both();
@@ -55,10 +47,10 @@ if ( part == "both" ) {
55 cubby_side(cubby_depth, cubby_height, screw_tabs); 47 cubby_side(cubby_depth, cubby_height, screw_tabs);
56} else if ( part == "view_fit") { 48} else if ( part == "view_fit") {
57 view_tab_fit(cubby_width, cubby_depth, cubby_height); 49 view_tab_fit(cubby_width, cubby_depth, cubby_height);
58} else if ( part == "bottom_tabs" ) { 50} else if ( part == "male_tabs" ) {
59 bottom_test_fit(cubby_width, cubby_depth); 51 male_tabs(cubby_width, cubby_depth);
60} else if ( part == "side_tabs" ) { 52} else if ( part == "female_tabs" ) {
61 side_test_fit(cubby_depth, cubby_height); 53 female_tabs(cubby_depth, cubby_height);
62} 54}
63 55
64function double (x) = x * 2; 56function double (x) = x * 2;
@@ -69,6 +61,7 @@ module both () {
69 cubby_bottom(cubby_width, cubby_depth); 61 cubby_bottom(cubby_width, cubby_depth);
70 left(((cubby_width + cubby_height) / 2) + (tab_height * 2) + gap) 62 left(((cubby_width + cubby_height) / 2) + (tab_height * 2) + gap)
71 cubby_side(cubby_depth, cubby_height, screw_tabs); 63 cubby_side(cubby_depth, cubby_height, screw_tabs);
64}
72 65
73module cubby_bottom (width, depth) { 66module cubby_bottom (width, depth) {
74 rot(90) yrot(90) color("blue") bottom_wall() yrot(90) down(tab_height / 2) { 67 rot(90) yrot(90) color("blue") bottom_wall() yrot(90) down(tab_height / 2) {
@@ -110,8 +103,10 @@ module cubby_side (depth, height, screw_tabs=true) {
110 module tab_bracket () { 103 module tab_bracket () {
111 difference() { 104 difference() {
112 cuboid([depth,thickness,cubby_side_bracket_height()]); 105 cuboid([depth,thickness,cubby_side_bracket_height()]);
113 alternating_tabs(true, "female", depth, tab_width, tab_depth, tab_height, tab_padding, tab_tolerance); 106 alternating_tabs(true, "female", depth, tab_width, tab_depth,
114 alternating_tabs(false, "female", depth, tab_width, tab_depth, tab_height, tab_padding, tab_tolerance); 107 tab_height, tab_padding, tab_tolerance);
108 alternating_tabs(false, "female", depth, tab_width, tab_depth,
109 tab_height, tab_padding, tab_tolerance);
115 } 110 }
116 children(); 111 children();
117 } 112 }
@@ -142,31 +137,30 @@ module strut_wall(w, h) {
142 ) children(); 137 ) children();
143} 138}
144 139
145module bottom_test_fit (w, d) { 140module male_tabs (w, d) {
146 keep=(w / 2) - thickness;
147 //right_half(x=keep) cubby_bottom(cubby_width, cubby_depth);
148
149 text=str("t=", tab_tolerance); 141 text=str("t=", tab_tolerance);
150 text_pos=[(-w / 2) + (thickness * 0.9), 142 text_pos=[(-w / 2) + (thickness * 0.8),
151 -d / 2 + thickness, 143 -d / 2 + thickness,
152 (thickness / 2) - text_extrude]; 144 (thickness / 2) - text_inscription_depth];
153
154 difference() { 145 difference() {
155 left_half(x=-keep) cubby_bottom(cubby_width, cubby_depth); 146 keep=(w / 2) - thickness;
156 #translate(text_pos) zrot(90) linear_extrude(text_extrude) color("green") text(size=text_size, text); 147 left_half(x=-keep) cubby_bottom(cubby_width, cubby_depth);
148 #translate(text_pos) zrot(90)
149 linear_extrude(text_inscription_depth)
150 color("green") text(size=text_size, text);
157 } 151 }
158} 152}
159 153
160module side_test_fit (d, h) { 154module female_tabs (d, h) {
161 text=str("t=", tab_tolerance); 155 text=str("t=", tab_tolerance);
162 text_pos=[-h/2 + (thickness * 0.9), 156 text_pos=[-h/2 + (thickness * 0.8),
163 -d / 2 + thickness, 157 -d / 2 + thickness,
164 (thickness / 2) - text_extrude]; 158 (thickness / 2) - text_inscription_depth];
165
166 difference() { 159 difference() {
167 left_half(x=(h / -2 + (thickness * 3))) 160 xrot(180) left_half(x=(h / -2 + (thickness * 3)))
168 cubby_side(d, h, screw_tabs=false); 161 cubby_side(d, h, screw_tabs=false);
169 #translate(text_pos) zrot(90) linear_extrude(text_extrude) color("green") text(size=text_size, text); 162 #translate(text_pos) zrot(90) linear_extrude(text_inscription_depth)
163 color("green") text(size=text_size, text);
170 } 164 }
171} 165}
172 166
@@ -175,8 +169,10 @@ module view_tab_fit (w, d, h) {
175 module position_fit_test (left=true) { 169 module position_fit_test (left=true) {
176 cubby_bottom(w, d); 170 cubby_bottom(w, d);
177 dist=(w / 2) + (thickness / -2) + tab_depth - 2; 171 dist=(w / 2) + (thickness / -2) + tab_depth - 2;
178 down=half(h) - half(thickness) - tab_height - half(tab_tolerance); 172 down=half(h) - half(thickness) -
179 yflip() yrot(90) down(dist * (left ? 1 : -1)) left(down) cubby_side(d, h, screw_tabs); 173 tab_height - half(tab_tolerance);
174 yflip() yrot(90) down(dist * (left ? 1 : -1)) left(down)
175 cubby_side(d, h, screw_tabs);
180 } 176 }
181 177
182 position_fit_test(left=true); 178 position_fit_test(left=true);
@@ -187,11 +183,13 @@ module alternating_tabs ( first, gender, length, tab_width, tab_depth, tab_heigh
187 dist=length - (tab_padding * 2); 183 dist=length - (tab_padding * 2);
188 total_tabs=dist / (tab_width + tab_padding + tolerance); 184 total_tabs=dist / (tab_width + tab_padding + tolerance);
189 half_tabs=total_tabs / 2; 185 half_tabs=total_tabs / 2;
190 tab_qty = total_tabs % 2 == 0 ? half_tabs : first ? ceil(half_tabs) : floor(half_tabs); 186 tab_qty = total_tabs % 2 == 0 ? half_tabs : first ?
187 ceil(half_tabs) : floor(half_tabs);
191 start = first ? tab_padding : (tab_padding * 2) + tab_width; 188 start = first ? tab_padding : (tab_padding * 2) + tab_width;
192 spacing = (tab_width + tab_padding) * 2; 189 spacing = (tab_width + tab_padding) * 2;
193 xcopies(spacing, tab_qty, dist, sp=((dist / -2) + start)) 190 xcopies(spacing, tab_qty, dist, sp=((dist / -2) + start))
194 #dovetail(gender, angle=0, slide=add_tol(tab_depth), width=add_tol(tab_width), height=add_tol(tab_height)); 191 #dovetail(gender, angle=0, slide=add_tol(tab_depth),
192 width=add_tol(tab_width), height=add_tol(tab_height));
195 193
196 function add_tol (x) = gender == "male" ? x : x + tolerance; 194 function add_tol (x) = gender == "male" ? x : x + tolerance;
197} 195}
diff --git a/shopenscad.sh b/shopenscad.sh
index 996d405..075290d 100755
--- a/shopenscad.sh
+++ b/shopenscad.sh
@@ -117,7 +117,7 @@ output_params=""
117default_output_filename="" 117default_output_filename=""
118all="" 118all=""
119values_only="" 119values_only=""
120val_sep="=" 120val_sep="-"
121var_sep="," 121var_sep=","
122 122
123declare -A scad 123declare -A scad
@@ -139,7 +139,7 @@ while IFS= read -r line; do
139 scad[$var]="$val" 139 scad[$var]="$val"
140 output_params+="-D '$var=$val' " 140 output_params+="-D '$var=$val' "
141 values_only+="$(val_to_filename "$val")${val_sep}" 141 values_only+="$(val_to_filename "$val")${val_sep}"
142 all+="${var}${val_sep}$(val_to_filename "$val")${var_sep}" 142 all+="${var}=$(val_to_filename "$val")${var_sep}"
143 fi; 143 fi;
144done < <(echo "$(cat "$scad_file")" | 144done < <(echo "$(cat "$scad_file")" |
145 strip_comments |strip_after_hidden |strip_nonassignments |strip_trailing_semicolon) 145 strip_comments |strip_after_hidden |strip_nonassignments |strip_trailing_semicolon)
@@ -152,7 +152,7 @@ if $print_vars; then
152 done; echo 152 done; echo
153fi 153fi
154 154
155all=$(strip_trailing "$val_sep" "$all") 155#all=$(strip_trailing "$val_sep" "$all")
156values_only=$(strip_trailing "$val_sep" "$values_only") 156values_only=$(strip_trailing "$val_sep" "$values_only")
157 157
158default_output_filename="$(strip_trailing "-" "${values_only}").stl" 158default_output_filename="$(strip_trailing "-" "${values_only}").stl"
@@ -180,5 +180,5 @@ if $interactive; then
180 *) run=false ;; 180 *) run=false ;;
181 esac 181 esac
182fi 182fi
183#sed -nel <<< "$openscad_str" 183
184$run && eval "$openscad_str" 184$run && eval "$(echo "$openscad_str")"