author | Michael Krelin <hacker@klever.net> | 2018-08-02 11:23:57 (UTC) |
---|---|---|
committer | Michael Krelin <hacker@klever.net> | 2018-08-02 11:23:57 (UTC) |
commit | 290784caf892a0bbea84332ff4ae6767b0fcddd1 (patch) (unidiff) | |
tree | 1e167203f6a8227ae3f868471032b7127274f9d2 | |
parent | 62df5d5cfcaa6ede9f3b6441de8a0a3a963d9d97 (diff) | |
download | extrudery-290784caf892a0bbea84332ff4ae6767b0fcddd1.zip extrudery-290784caf892a0bbea84332ff4ae6767b0fcddd1.tar.gz extrudery-290784caf892a0bbea84332ff4ae6767b0fcddd1.tar.bz2 |
another: adjust and prettify $fn calculations
-rw-r--r-- | another.scad | 61 |
1 files changed, 31 insertions, 30 deletions
diff --git a/another.scad b/another.scad index 302e314..872ff33 100644 --- a/another.scad +++ b/another.scad | |||
@@ -61,6 +61,8 @@ module the_extruder( | |||
61 | tensioner = true, | 61 | tensioner = true, |
62 | debug = false | 62 | debug = false |
63 | ) { | 63 | ) { |
64 | fnd = 2*PI; fnr = 2*fnd; | ||
65 | |||
64 | lever_shell = mount_screwhead_h+0.5; | 66 | lever_shell = mount_screwhead_h+0.5; |
65 | lever_thickness=max(spring_d+spring_d_clearance+layer_height*8,idler_h+idler_v_tolerance+2*lever_shell); | 67 | lever_thickness=max(spring_d+spring_d_clearance+layer_height*8,idler_h+idler_v_tolerance+2*lever_shell); |
66 | lsd = idler_d-idler_clearance*2; | 68 | lsd = idler_d-idler_clearance*2; |
@@ -86,10 +88,10 @@ module the_extruder( | |||
86 | if(depth) { | 88 | if(depth) { |
87 | hh = (-4*pow(depth,2)+pow(d,2))/(8*depth); | 89 | hh = (-4*pow(depth,2)+pow(d,2))/(8*depth); |
88 | rr = depth+hh; | 90 | rr = depth+hh; |
89 | translate([0,0,hh]) sphere(r=rr,$fn=2*PI*rr); | 91 | translate([0,0,hh]) sphere(r=rr,$fn=fnr*rr); |
90 | }else if(r) { | 92 | }else if(r) { |
91 | hh=sqrt(pow(r,2)-pow(d,2)/4); | 93 | hh=sqrt(pow(r,2)-pow(d,2)/4); |
92 | translate([0,0,hh]) sphere(r=r,$fn=2*PI*r); | 94 | translate([0,0,hh]) sphere(r=r,$fn=fnr*r); |
93 | } | 95 | } |
94 | } | 96 | } |
95 | 97 | ||
@@ -158,11 +160,11 @@ module the_extruder( | |||
158 | } | 160 | } |
159 | cylinder(d=mount_screw_d+mount_screw_d_tolerance,h=lever_thickness+2,center=true,$fn=30); | 161 | cylinder(d=mount_screw_d+mount_screw_d_tolerance,h=lever_thickness+2,center=true,$fn=30); |
160 | translate([0,0,lever_thickness/2-mount_screwhead_h]) | 162 | translate([0,0,lever_thickness/2-mount_screwhead_h]) |
161 | cylinder(d=mount_screwhead_d,h=mount_screwhead_h+1,$fn=2*PI*mount_screwhead_d); | 163 | cylinder(d=mount_screwhead_d,h=mount_screwhead_h+1,$fn=fnd*mount_screwhead_d); |
162 | } | 164 | } |
163 | // mounting screw hole | 165 | // mounting screw hole |
164 | translate([mount_d/2,0,0]) | 166 | translate([mount_d/2,0,0]) |
165 | cylinder(d=mount_screw_d+mount_screw_d_tolerance,h=lever_thickness+2,center=true,$fn=2*PI*mount_screw_d); | 167 | cylinder(d=mount_screw_d+mount_screw_d_tolerance,h=lever_thickness+2,center=true,$fn=fnd*mount_screw_d); |
166 | 168 | ||
167 | // lever end | 169 | // lever end |
168 | translate([mount_d/2,0,0]) rotate([0,90,0]) { | 170 | translate([mount_d/2,0,0]) rotate([0,90,0]) { |
@@ -170,8 +172,8 @@ module the_extruder( | |||
170 | translate([0,-longwing,0]) | 172 | translate([0,-longwing,0]) |
171 | mirror([0,0,1]) | 173 | mirror([0,0,1]) |
172 | difference() { | 174 | difference() { |
173 | cylinder(d=spring_d+spring_d_clearance,h=lsd,$fn=2*PI*spring_d); | 175 | cylinder(d=spring_d+spring_d_clearance,h=lsd,$fn=fnd*(spring_d+spring_d_clearance)); |
174 | sphere(d=spring_d*3/4,$fn=PI*spring_d); | 176 | sphere(d=spring_d*3/4,$fn=fnd*spring_d*3/4); |
175 | } | 177 | } |
176 | }//rotate-translate | 178 | }//rotate-translate |
177 | }//difference | 179 | }//difference |
@@ -186,7 +188,7 @@ module the_extruder( | |||
186 | module body() { | 188 | module body() { |
187 | difference() { | 189 | difference() { |
188 | union() { | 190 | union() { |
189 | cylinder(d=gearbox_d,h=body_h,$fn=2*PI*gearbox_d); | 191 | cylinder(d=gearbox_d,h=body_h,$fn=fnd*gearbox_d); |
190 | // finger and spring support | 192 | // finger and spring support |
191 | fsw = gearbox_d/2+mount_screwhead_d/2; | 193 | fsw = gearbox_d/2+mount_screwhead_d/2; |
192 | translate([-gearbox_d/2,0,0]) difference() { | 194 | translate([-gearbox_d/2,0,0]) difference() { |
@@ -194,7 +196,7 @@ module the_extruder( | |||
194 | hull() { | 196 | hull() { |
195 | translate([0,-longwing,ls_z]) | 197 | translate([0,-longwing,ls_z]) |
196 | rotate([0,90,0]) | 198 | rotate([0,90,0]) |
197 | cylinder(d=max(lever_thickness,spring_d+spring_d_clearance+2*extrusion_width),h=fsw,$fn=2*PI*lever_thickness); | 199 | cylinder(d=lever_thickness,h=fsw,$fn=fnd*lever_thickness); |
198 | hh=body_h-ls_z; | 200 | hh=body_h-ls_z; |
199 | translate([0,0,ls_z-lever_thickness/2]) | 201 | translate([0,0,ls_z-lever_thickness/2]) |
200 | mirror([0,1,0]) cube(size=[fsw,longwing-hh+lever_thickness/sqrt(2),hh+lever_thickness/2]); | 202 | mirror([0,1,0]) cube(size=[fsw,longwing-hh+lever_thickness/sqrt(2),hh+lever_thickness/2]); |
@@ -211,14 +213,14 @@ module the_extruder( | |||
211 | hull() for(o=[0,spring_d]) translate([0,-o,0]) | 213 | hull() for(o=[0,spring_d]) translate([0,-o,0]) |
212 | rotate([0,0,30]) | 214 | rotate([0,0,30]) |
213 | cylinder(d=st_nut_d,h=st_nut_h,$fn=6); | 215 | cylinder(d=st_nut_d,h=st_nut_h,$fn=6); |
214 | translate([0,0,-1]) cylinder(d=st_screw_d,h=fsw+2,$fn=st_screw_d*PI*2); | 216 | translate([0,0,-1]) cylinder(d=st_screw_d,h=fsw+2,$fn=fnd*st_screw_d); |
215 | bigd = spring_d+spring_d_clearance; | 217 | bigd = spring_d+spring_d_clearance; |
216 | hf = (bigd-st_screw_d)/2; | 218 | hf = (bigd-st_screw_d)/2; |
217 | translate([0,0,st_shell+st_nut_h+st_shell-epsilon]) | 219 | translate([0,0,st_shell+st_nut_h+st_shell-epsilon]) |
218 | cylinder(d1=st_screw_d,d2=bigd, | 220 | cylinder(d1=st_screw_d,d2=bigd, |
219 | h=hf+epsilon, $fn=bigd*PI*2 ); | 221 | h=hf+epsilon, $fn=fnd*bigd); |
220 | translate([0,0,st_shell+st_nut_h+st_shell+hf-epsilon]) | 222 | translate([0,0,st_shell+st_nut_h+st_shell+hf-epsilon]) |
221 | cylinder(d=bigd,h=fsw+1,$fn=bigd*PI*2); | 223 | cylinder(d=bigd,h=fsw+1,$fn=fnd*bigd); |
222 | } | 224 | } |
223 | } | 225 | } |
224 | } | 226 | } |
@@ -233,16 +235,16 @@ module the_extruder( | |||
233 | }//union (first child of difference) | 235 | }//union (first child of difference) |
234 | // protrusion | 236 | // protrusion |
235 | translate([0,0,-1]) | 237 | translate([0,0,-1]) |
236 | cylinder(d=protrusion_d+protrusion_tolerance_h,h=protrusion_h+protrusion_tolerance_v+1,$fn=2*PI*protrusion_d); | 238 | cylinder(d=protrusion_d+protrusion_tolerance_h,h=protrusion_h+protrusion_tolerance_v+1,$fn=fnd*(protrusion_d+protrusion_tolerance_h)); |
237 | // mount screw holes | 239 | // mount screw holes |
238 | for(zr=[0:90:359]) rotate([0,0,zr]) translate([mount_d/2,0,0]) { | 240 | for(zr=[0:90:359]) rotate([0,0,zr]) translate([mount_d/2,0,0]) { |
239 | translate([0,0,mount_screw_l-mounthole_depth/2-layer_height-1]) | 241 | translate([0,0,mount_screw_l-mounthole_depth/2-layer_height-1]) |
240 | mirror([0,0,1]) | 242 | mirror([0,0,1]) |
241 | cylinder(d=mount_screw_d+mount_screw_d_tolerance, | 243 | cylinder(d=mount_screw_d+mount_screw_d_tolerance, |
242 | h=mount_screw_l-mounthole_depth/2-layer_height+1, | 244 | h=mount_screw_l-mounthole_depth/2-layer_height+1, |
243 | $fn=2*PI*mount_screw_d); | 245 | $fn=fnd*(mount_screw_d+mount_screw_d_tolerance)); |
244 | translate([0,0,mount_screw_l-mounthole_depth/2]) | 246 | translate([0,0,mount_screw_l-mounthole_depth/2]) |
245 | cylinder(d=mount_screwhead_d,h=body_h+1,$fn=2*PI*mount_screwhead_d); | 247 | cylinder(d=mount_screwhead_d,h=body_h+1,$fn=fnd*mount_screwhead_d); |
246 | }//for | 248 | }//for |
247 | // pushfit | 249 | // pushfit |
248 | translate([0,0,filament_elevation]) | 250 | translate([0,0,filament_elevation]) |
@@ -251,18 +253,18 @@ module the_extruder( | |||
251 | translate([0,0,mount_d/sqrt(2)/2+mount_screw_d+epsilon]) | 253 | translate([0,0,mount_d/sqrt(2)/2+mount_screw_d+epsilon]) |
252 | rotate([0,0,180]) { | 254 | rotate([0,0,180]) { |
253 | pushfit(pf); | 255 | pushfit(pf); |
254 | cylinder(d=filament_guide_d,h=gearbox_d,center=true,$fn=2*PI*filament_guide_d); | 256 | cylinder(d=filament_guide_d,h=gearbox_d,center=true,$fn=fnd*filament_guide_d); |
255 | translate([0,-filament_guide_d/2/sqrt(2),0]) | 257 | translate([0,-filament_guide_d/2/sqrt(2),0]) |
256 | rotate([0,0,45]) | 258 | rotate([0,0,45]) |
257 | cube(size=[filament_guide_d/2,filament_guide_d/2,gearbox_d],center=true); | 259 | cube(size=[filament_guide_d/2,filament_guide_d/2,gearbox_d],center=true); |
258 | } | 260 | } |
259 | // pulley | 261 | // pulley |
260 | cylinder(d=pulley_d+pulley_clearance,h=body_h+1,$fn=2*PI*(pulley_d+pulley_clearance)); | 262 | cylinder(d=pulley_d+pulley_clearance,h=body_h+1,$fn=fnd*(pulley_d+pulley_clearance)); |
261 | // leverspace | 263 | // leverspace |
262 | hull() for(x=[0,gearbox_d]) | 264 | hull() for(x=[0,gearbox_d]) |
263 | rotate([0,0,45]) | 265 | rotate([0,0,45]) |
264 | translate([x,0,ls_z-ls_h/2]) | 266 | translate([x,0,ls_z-ls_h/2]) |
265 | cylinder(d=idler_d+idler_clearance,h=ls_h,$fn=2*PI*idler_d); | 267 | cylinder(d=idler_d+idler_clearance,h=ls_h,$fn=fnd*(idler_d+idler_clearance)); |
266 | 268 | ||
267 | a=cos(45)*(pulley_d+idler_d)/2; | 269 | a=cos(45)*(pulley_d+idler_d)/2; |
268 | b=mount_d/2-a; | 270 | b=mount_d/2-a; |
@@ -285,9 +287,8 @@ module the_extruder( | |||
285 | //translate([-mount_d/2,-longwing,filament_elevation]) | 287 | //translate([-mount_d/2,-longwing,filament_elevation]) |
286 | if(!tensioner) translate([mount_d/2,-longwing,filament_elevation]) | 288 | if(!tensioner) translate([mount_d/2,-longwing,filament_elevation]) |
287 | rotate([0,-90,0]) difference() { | 289 | rotate([0,-90,0]) difference() { |
288 | cylinder(d=spring_d+spring_d_clearance,h=spring_lc+spring_dl,$fn=PI*spring_d); | 290 | cylinder(d=spring_d+spring_d_clearance,h=spring_lc+spring_dl,$fn=fnd*(spring_d+spring_d_clearance)); |
289 | translate([0,0,spring_lc+spring_dl]) sphere(d=spring_d*3/4,$fn=PI*spring_d); | 291 | translate([0,0,spring_lc+spring_dl]) sphere(d=spring_d*3/4,$fn=fnd*spring_d*3/4); |
290 | } | ||
291 | } | 292 | } |
292 | 293 | ||
293 | }//difference | 294 | }//difference |
@@ -295,8 +296,8 @@ module the_extruder( | |||
295 | if(supports) intersection() { | 296 | if(supports) intersection() { |
296 | difference() { | 297 | difference() { |
297 | translate([0,0,ls_z-ls_h/2-epsilon]) | 298 | translate([0,0,ls_z-ls_h/2-epsilon]) |
298 | cylinder(d=gearbox_d,h=ls_h+2*epsilon,$fn=2*PI*gearbox_d); | 299 | cylinder(d=gearbox_d,h=ls_h+2*epsilon,$fn=fnd*gearbox_d); |
299 | cylinder(d=pulley_d+pulley_clearance,h=body_h+1,$fn=2*PI*(pulley_d+pulley_clearance)); | 300 | cylinder(d=pulley_d+pulley_clearance,h=body_h+1,$fn=fnd*(pulley_d+pulley_clearance)); |
300 | } | 301 | } |
301 | // supports | 302 | // supports |
302 | // TODO: hardcoded stuff below… | 303 | // TODO: hardcoded stuff below… |
@@ -320,12 +321,12 @@ module the_extruder( | |||
320 | translate([-gearbox_d/2+st_shell+st_nut_h+st_shell+smalld,-longwing,filament_elevation]) | 321 | translate([-gearbox_d/2+st_shell+st_nut_h+st_shell+smalld,-longwing,filament_elevation]) |
321 | rotate([0,90,0]) difference() { | 322 | rotate([0,90,0]) difference() { |
322 | union() { | 323 | union() { |
323 | cylinder(d1=smalld,d2=bigd,h=hf,$fn=bigd*PI*2); | 324 | cylinder(d1=smalld,d2=bigd,h=hf,$fn=fnd*bigd); |
324 | translate([0,0,hf-epsilon]) | 325 | translate([0,0,hf-epsilon]) |
325 | cylinder(d=bigd,h=hf*2,$fn=bigd*PI*2); | 326 | cylinder(d=bigd,h=hf*2,$fn=fnd*bigd); |
326 | } | 327 | } |
327 | translate([0,0,-epsilon]) | 328 | translate([0,0,-epsilon]) |
328 | cylinder(d=st_screw_d,h=2*hf+epsilon,$fn=st_screw_d*PI*2); | 329 | cylinder(d=st_screw_d,h=2*hf+epsilon,$fn=fnd*st_screw_d); |
329 | } | 330 | } |
330 | } | 331 | } |
331 | 332 | ||
@@ -334,7 +335,7 @@ module the_extruder( | |||
334 | translate([0,0,body_h+epsilon]) { | 335 | translate([0,0,body_h+epsilon]) { |
335 | mirror([0,0,1]) translate([0,0,-epsilon]) { | 336 | mirror([0,0,1]) translate([0,0,-epsilon]) { |
336 | difference() { | 337 | difference() { |
337 | cylinder(d=pulley_d,h=knob_bore_l,$fn=pulley_d*PI*2); | 338 | cylinder(d=pulley_d,h=knob_bore_l,$fn=fnd*pulley_d); |
338 | translate([0,0,-1]) difference() { | 339 | translate([0,0,-1]) difference() { |
339 | cylinder(d=bore_d+knob_bore_d_tolerance,h=knob_bore_l+2); | 340 | cylinder(d=bore_d+knob_bore_d_tolerance,h=knob_bore_l+2); |
340 | translate([-bore_d/2-1,bore_dd-bore_d/2+knob_bore_d_tolerance/2,-1]) | 341 | translate([-bore_d/2-1,bore_dd-bore_d/2+knob_bore_d_tolerance/2,-1]) |
@@ -344,15 +345,15 @@ module the_extruder( | |||
344 | } | 345 | } |
345 | difference() { | 346 | difference() { |
346 | union() { | 347 | union() { |
347 | cylinder(d1=gearbox_d-2*ch,d2=gearbox_d,h=ch+epsilon,$fn=PI*gearbox_d*2); | 348 | cylinder(d1=gearbox_d-2*ch,d2=gearbox_d,h=ch+epsilon,$fn=fnd*gearbox_d); |
348 | translate([0,0,ch]) | 349 | translate([0,0,ch]) |
349 | cylinder(d=gearbox_d,h=knob_h-2*ch+epsilon,$fn=PI*gearbox_d*2); | 350 | cylinder(d=gearbox_d,h=knob_h-2*ch+epsilon,$fn=fnd*gearbox_d); |
350 | translate([0,0,knob_h-ch]) | 351 | translate([0,0,knob_h-ch]) |
351 | cylinder(d1=gearbox_d,d2=gearbox_d-2*ch,h=ch,$fn=PI*gearbox_d*2); | 352 | cylinder(d1=gearbox_d,d2=gearbox_d-2*ch,h=ch,$fn=fnd*gearbox_d); |
352 | } | 353 | } |
353 | for(a=[0:360/knob_indents:359]) rotate([0,0,a]) | 354 | for(a=[0:360/knob_indents:359]) rotate([0,0,a]) |
354 | translate([0,gearbox_d/2,-1]) | 355 | translate([0,gearbox_d/2,-1]) |
355 | cylinder(d=knob_indent_d,h=knob_h+2,$fn=knob_indent_d*PI*2); | 356 | cylinder(d=knob_indent_d,h=knob_h+2,$fn=fnd*knob_indent_d); |
356 | } | 357 | } |
357 | } | 358 | } |
358 | }//knob module | 359 | }//knob module |