diff options
author | Steven <steven.vasilogianis@gmail.com> | 2021-10-27 00:12:38 -0400 |
---|---|---|
committer | Steven <steven.vasilogianis@gmail.com> | 2021-10-27 00:14:35 -0400 |
commit | 6201f7346eed8bd9db361b6c11b528fd36b338a7 (patch) | |
tree | 185e942c197cdd42b795654e3e48416ef5999342 | |
parent | 8e25598c8f5b2387fb1836a7dd6be1ed76ce98f3 (diff) |
nothing significant
-rw-r--r-- | cubbies.scad | 72 | ||||
-rwxr-xr-x | shopenscad.sh | 10 |
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 | ||
8 | part="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] | 8 | part="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] */ |
11 | cubby_width=150; | 11 | cubby_width=150; |
@@ -28,13 +28,6 @@ tab_width=10; | |||
28 | tab_padding=5; // minimum material between tabs | 28 | tab_padding=5; // minimum material between tabs |
29 | tab_tolerance=0.5; | 29 | tab_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] */ |
39 | screw_tabs=true; | 32 | screw_tabs=true; |
40 | 33 | ||
@@ -43,9 +36,8 @@ tab_depth=thickness; | |||
43 | tab_height=thickness; | 36 | tab_height=thickness; |
44 | 37 | ||
45 | /* text inscribed (when printing tolerances) */ | 38 | /* text inscribed (when printing tolerances) */ |
46 | text_extrude=2; | 39 | text_inscription_depth=0.2; |
47 | text_size=thickness * 0.8; | 40 | text_size=thickness * 0.6; |
48 | |||
49 | 41 | ||
50 | if ( part == "both" ) { | 42 | if ( 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 | ||
64 | function double (x) = x * 2; | 56 | function 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 | ||
73 | module cubby_bottom (width, depth) { | 66 | module 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 | ||
145 | module bottom_test_fit (w, d) { | 140 | module 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 | ||
160 | module side_test_fit (d, h) { | 154 | module 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="" | |||
117 | default_output_filename="" | 117 | default_output_filename="" |
118 | all="" | 118 | all="" |
119 | values_only="" | 119 | values_only="" |
120 | val_sep="=" | 120 | val_sep="-" |
121 | var_sep="," | 121 | var_sep="," |
122 | 122 | ||
123 | declare -A scad | 123 | declare -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; |
144 | done < <(echo "$(cat "$scad_file")" | | 144 | done < <(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 |
153 | fi | 153 | fi |
154 | 154 | ||
155 | all=$(strip_trailing "$val_sep" "$all") | 155 | #all=$(strip_trailing "$val_sep" "$all") |
156 | values_only=$(strip_trailing "$val_sep" "$values_only") | 156 | values_only=$(strip_trailing "$val_sep" "$values_only") |
157 | 157 | ||
158 | default_output_filename="$(strip_trailing "-" "${values_only}").stl" | 158 | default_output_filename="$(strip_trailing "-" "${values_only}").stl" |
@@ -180,5 +180,5 @@ if $interactive; then | |||
180 | *) run=false ;; | 180 | *) run=false ;; |
181 | esac | 181 | esac |
182 | fi | 182 | fi |
183 | #sed -nel <<< "$openscad_str" | 183 | |
184 | $run && eval "$openscad_str" | 184 | $run && eval "$(echo "$openscad_str")" |