chiark / gitweb /
tube-crossdrill-jig: reorder so mainframehole ca depend on slot stuff, nfc
[reprap-play.git] / tube-crossdrill-jig.scad
1 // -*- C -*-
2
3 //$fs=0.1;
4 //$fa=3;
5 $fs=0.2;
6 $fa=6;
7
8 rearwallthick = 3;
9 basethick = 2;
10 mainframeendthick = 2.5;
11
12 tubedia = 16 + 0.8;
13 tubetubethick=2;
14 tubetubetopslop=1;
15
16 boltholedia = 6.5 + 0.5;
17 boltholeslotshorter = 6;
18 mainframeholedia = 5 + 0.5;
19
20 // "slot" refers to the things in the base of the drill press stand
21 backslotedgespace = 55;
22 slotwidth = 11.5;
23 backslotmid2screwhole = 17;
24 slotplugheight = 5.5;
25 slotplugshorterlen = 8;
26 slotpluglongerlen = 18;
27
28 slotslope = 11.0 / 18.5;
29
30 // "keepslot" refers to the screws in the wooden jig block
31 keepslotstartz = 20;
32 keepslotlen = 25;
33 keepslotx = backslotedgespace / 2;
34 keepslotwidth = 4;
35
36 mainframeextraside = 15;
37 mainframeextrafront = 15;
38
39 rearwallstrengthwidth = 10;
40 keepslotclear = 10;
41
42 // computed values
43
44 slotslopediag = sqrt(1 + slotslope*slotslope);
45 slotwidthx = slotwidth * slotslopediag;
46
47 slotxperlen = slotslope / slotslopediag;
48 slotyperlen =         1 / slotslopediag;
49
50 mainframeholex = backslotedgespace/2 + slotwidth/sqrt(2) +
51   backslotmid2screwhole / sqrt(2);
52
53 mainframeholey = -backslotmid2screwhole / sqrt(2);
54
55 mainframemaxx = mainframeholex + mainframeextraside;
56 mainframeminy = mainframeholey - mainframeextrafront;
57 mainframemaxz = keepslotstartz + keepslotlen;
58
59 module MainFrame(){
60   for (m=[0,1]) {
61     mirror([m,0,0]) {
62       translate([-1, mainframeminy, 0])
63         cube([mainframemaxx+1, -mainframeminy, basethick]);
64       translate([-1, -rearwallthick, 0])
65         cube([mainframemaxx+1, rearwallthick, mainframemaxz]);
66
67       for (x=[keepslotx - keepslotclear, mainframemaxx - 0.5]) {
68         translate([x,0,0])
69           rotate([90,0,-90])
70           linear_extrude(height=mainframeendthick)
71           polygon([[-mainframeminy, 0],
72                    [0, mainframemaxz],
73                    [0, 0]]);
74       }
75
76       translate([backslotedgespace/2, 0, 1])
77         mirror([0,0,1])
78         linear_extrude(height=slotplugheight+1)
79         polygon([[0,0],
80                  [slotwidthx, 0],
81                  [slotwidthx + slotplugshorterlen * slotxperlen,
82                   -slotplugshorterlen * slotyperlen],
83                  [slotpluglongerlen * slotxperlen,
84                   -slotpluglongerlen * slotyperlen]]);
85       translate([-1,
86                  -rearwallthick - boltholeslotshorter + 0.2,
87                  tubedia + tubetubetopslop + tubetubethick + 4])
88         cube([keepslotx - keepslotclear + 1,
89               boltholeslotshorter + 0.5,
90               rearwallstrengthwidth]);
91     }
92   }
93 }
94
95 module TubeThing(extralen, dia, extraheight, underheight){
96   effheight = tubetubetopslop + extraheight + underheight;
97   len = -mainframeminy + extralen * 2;
98   translate([0, mainframeminy - extralen, -underheight]) {
99     translate([0,0, dia/2 + effheight])
100       rotate([-90,0,0]) cylinder(h=len, r=dia/2);
101     translate([-dia/2, 0, 0])
102       cube([dia, len, effheight + dia/2]);
103   }
104 }
105
106 module Jig(){
107   difference(){
108     union(){
109       MainFrame();
110       TubeThing(0, tubedia+tubetubethick*2, -tubetubethick, 0);
111     }
112     union(){
113       translate([0,0,-0.1])
114         TubeThing(10, tubedia, 0, 5);
115       translate([-boltholedia/2, mainframeminy - 1, -5])
116         cube([boltholedia,
117               -mainframeminy + 1 - rearwallthick - boltholeslotshorter,
118               mainframemaxz + 10]);
119       for (m=[0,1]) {
120         mirror([m,0,0]) {
121           translate([mainframeholex, mainframeholey, -30])
122             cylinder(h=basethick+40, r=mainframeholedia/2);
123           translate([keepslotx - keepslotwidth/2,
124                      -10, keepslotstartz])
125             cube([keepslotwidth, 20, keepslotlen + 10]);
126         }
127       }
128     }
129   }
130 }
131
132 //MainFrame();
133 //TubeThing(0, tubedia);
134
135 rotate([-90,0,0])
136   Jig();