author | Michael Krelin <hacker@klever.net> | 2018-07-31 19:38:01 (UTC) |
---|---|---|
committer | Michael Krelin <hacker@klever.net> | 2018-07-31 19:38:01 (UTC) |
commit | 2489b5446f56dbabbca9b4ea9f40870c7f4f69e6 (patch) (unidiff) | |
tree | b1e539c512f20c352c99203541b13b8776c7f873 | |
parent | 04f03386761d24bf28759d2dbefa7c9bd10a3726 (diff) | |
download | extrudery-2489b5446f56dbabbca9b4ea9f40870c7f4f69e6.zip extrudery-2489b5446f56dbabbca9b4ea9f40870c7f4f69e6.tar.gz extrudery-2489b5446f56dbabbca9b4ea9f40870c7f4f69e6.tar.bz2 |
pushfittery: don't be too epsilony
-rw-r--r-- | pushfittery.scad | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/pushfittery.scad b/pushfittery.scad index fedf2de..c198828 100644 --- a/pushfittery.scad +++ b/pushfittery.scad | |||
@@ -1,46 +1,46 @@ | |||
1 | layer_height=.2; epsilon=.01; | 1 | layer_height=.2; epsilon=.01; |
2 | draft = true; | 2 | draft = true; |
3 | 3 | ||
4 | use <threads.scad>; | 4 | use <threads.scad>; |
5 | 5 | ||
6 | function pf_(d,k) = d[search([k],d)[0]][1]; | 6 | function pf_(d,k) = d[search([k],d)[0]][1]; |
7 | function pf_d(pf) = pf_(pf,"d"); | 7 | function pf_d(pf) = pf_(pf,"d"); |
8 | function pf_h(pf) = pf_(pf,"h"); | 8 | function pf_h(pf) = pf_(pf,"h"); |
9 | module pushfit(pf,draft=draft) { | 9 | module pushfit(pf,draft=draft) { |
10 | fnd = 2*PI; epsilon=.01; | 10 | fnd = 2*PI; |
11 | type = pf_(pf,"type"); | 11 | type = pf_(pf,"type"); |
12 | h = pf_h(pf); | 12 | h = pf_h(pf); |
13 | if(type=="threaded") { | 13 | if(type=="threaded") { |
14 | minch = 25.4; | 14 | minch = 25.4; |
15 | d = (pf_d(pf) + pf_(pf,"d_tolerance"))/minch; | 15 | d = (pf_d(pf) + pf_(pf,"d_tolerance"))/minch; |
16 | tpi = pf_(pf,"tpi"); | 16 | tpi = pf_(pf,"tpi"); |
17 | if(draft) cylinder(d=d*minch,h=h+epsilon); | 17 | if(draft) cylinder(d=d*minch,h=h+1); |
18 | else english_thread(diameter=d,threads_per_inch=tpi,length=(h+epsilon)/minch,internal=true); | 18 | else english_thread(diameter=d,threads_per_inch=tpi,length=(h+1)/minch,internal=true); |
19 | slitl = d*minch+layer_height; | 19 | slitl = d*minch+layer_height; |
20 | slitw = 0.8*d*minch/2; | 20 | slitw = 0.8*d*minch/2; |
21 | echo(slitw,slitl); | 21 | echo(slitw,slitl); |
22 | translate([-slitw/2,-slitl/2,0]) cube([slitw,slitl,h+epsilon]); | 22 | translate([-slitw/2,-slitl/2,0]) cube([slitw,slitl,h+1]); |
23 | }else if(type=="embedded") { | 23 | }else if(type=="embedded") { |
24 | d = pf_d(pf); | 24 | d = pf_d(pf); |
25 | h_ring = pf_(pf,"h_ring"); | 25 | h_ring = pf_(pf,"h_ring"); |
26 | d_insert = pf_(pf,"d_insert"); | 26 | d_insert = pf_(pf,"d_insert"); |
27 | $fn = d*fnd; | 27 | $fn = d*fnd; |
28 | translate([0,0,h-h_ring]) cylinder(d=d,h=h_ring+epsilon); | 28 | translate([0,0,h-h_ring]) cylinder(d=d,h=h_ring+1); |
29 | cylinder(d=d_insert,h=h); | 29 | cylinder(d=d_insert,h=h); |
30 | }else if(type=="embeddest") { | 30 | }else if(type=="embeddest") { |
31 | d = pf_d(pf); | 31 | d = pf_d(pf); |
32 | id = pf_(pf,"id"); | 32 | id = pf_(pf,"id"); |
33 | h_legspace = pf_(pf,"h_legspace"); | 33 | h_legspace = pf_(pf,"h_legspace"); |
34 | ch = pf_(pf,"ch"); | 34 | ch = pf_(pf,"ch"); |
35 | $fn = d*fnd; | 35 | $fn = d*fnd; |
36 | cylinder(d=id,h=h+1); | 36 | cylinder(d=id,h=h+1); |
37 | cylinder(d=d,h=h_legspace); | 37 | cylinder(d=d,h=h_legspace); |
38 | dd = (d-id)/2; | 38 | dd = (d-id)/2; |
39 | translate([0,0,h_legspace-epsilon]) | 39 | translate([0,0,h_legspace-epsilon]) |
40 | cylinder(d1=d,d2=id-2*epsilon,h=dd+epsilon); | 40 | cylinder(d1=d,d2=id-2*epsilon,h=dd+epsilon); |
41 | translate([0,0,h-ch-epsilon]) | 41 | translate([0,0,h-ch-epsilon]) |
42 | cylinder(d1=id-2*epsilon,d2=id+2*ch+2,h=ch+epsilon+1); | 42 | cylinder(d1=id-2*epsilon,d2=id+2*ch+2,h=ch+epsilon+1); |
43 | } | 43 | } |
44 | }//pushfit module | 44 | }//pushfit module |
45 | 45 | ||
46 | function pf_byname(d,n) = d[search([n],d)[0]][1]; | 46 | function pf_byname(d,n) = d[search([n],d)[0]][1]; |