chiark / gitweb /
7b0cb20e2206481b984833ad5c4ca6b62cfc9096
[reprap-play.git] / belt-slot-cut-jig.scad
1 // -*- C -*-
2
3 // todo
4 //  various registration marks
5 //   protrustions at ends at strap width and middle
6 //   grooves on top face at 1/4,1/2,3/4 length and 1/2 width
7
8 crewpunch_slop = 0.3;
9
10 holder_min_wall = 2;
11 holder_attach_near_wall = 3;
12
13 holder_attach_xsz = 5;
14 holder_ctie_width = 4.0 + 0.5;
15 holder_ctie_thick = 3.0 + 0.5;
16 holder_attach_walls = 3;
17 holder_attach_roof = 2.5;
18
19 jig_interval = 25;
20 strap_width = 26.75 + 0.7;
21 strap_thick = 3;
22 edgewall_width = 3;
23
24 punch_travel = 8;
25
26 main_slop = 0.5;
27
28 jig_max_len = 160; // print diagonally
29 //jig_max_len = 30;
30
31 registrationgroove_width = 0.8;
32 registrationgroove_depth = 1.2;
33
34 registrationprotrusion_poke = 3;
35 registrationprotrusion_slope = 0.75;
36
37 jig_overlap = 1;
38
39 // from careful measurement
40
41 crewpunch_shape =
42   [[  6, [0.6, 6.0], [1.6, 12.3] ],
43    [  8, [1.1, 6.2], [1.9, 12.5] ],
44    [ 10, [1.6, 6.5], [2.1, 12.8] ],
45    [ 12, [1.8, 6.6], [2.3, 12.7] ],
46    [ 14, [2.1, 6.8], [2.6, 13.0] ],
47    [ 16, [2.4, 6.9], [2.7, 13.2] ],
48    [ 18, [2.5, 7.0], [2.9, 13.3] ],
49    [ 22, [3.1, 7.1], [3.2, 13.4] ],
50    [ 26, [3.3, 7.2], [3.5, 13.6] ], 
51    ];
52
53 crewpunch_shaft_max_y = 7.5;
54
55 crewpunch_systematic_size_error = +0.36;
56
57 crewpunch_min_y = 4.7 - crewpunch_systematic_size_error;
58
59 crewpunch_smallest_shape = crewpunch_shape[0];
60 crewpunch_biggest_shape = crewpunch_shape[len(crewpunch_shape)-1];
61
62 crewpunch_skew_angle = 2.0; //degrees
63 crewpunch_skew_yoff = 0.6; //mm
64
65 // computed
66
67 attach_ysz = holder_attach_walls*2 + holder_ctie_width;
68 holder_front_all = crewpunch_shaft_max_y - crewpunch_biggest_shape[1][1]
69   + attach_ysz;
70
71 holder_block_zsz = crewpunch_biggest_shape[0] - crewpunch_smallest_shape[0];
72 holder_xsz = crewpunch_biggest_shape[2][1] + crewpunch_biggest_shape[2][0] +
73   holder_min_wall*2;
74 crewpunch_biggest_y =
75   crewpunch_biggest_shape[1][0] + crewpunch_biggest_shape[1][1];
76 holder_ysz = crewpunch_biggest_y + holder_min_wall + holder_front_all;
77
78 attach_offset = 0.5 * (holder_front_all - holder_attach_near_wall);
79
80 jig_main_zsz = holder_block_zsz + punch_travel;
81
82 jig_ends_extra = 2;
83
84 //jig_iters = (jig_max_len - jig_ends_extra) / jig_interval;
85 jig_iters=2;
86 echo(jig_iters);
87
88 // objects
89
90 module CrewPunch(){
91   ourslop = crewpunch_slop - crewpunch_systematic_size_error;
92   hull(){
93     for(layer=crewpunch_shape){
94       translate([0,0, layer[0]]){
95         for(xind=[0,1]) //translate([xind?0:1,0,0])
96           for(yind=[0,1]) //translate([0,yind?0.5:0,0])
97             mirror([xind?1:0,0,0]) mirror([0,yind?0:1,0]){
98               translate([-0.1,-0.1,-0.1])
99                 cube([0.1 + layer[2][1-xind] + ourslop,
100                       0.1 + layer[1][yind] + ourslop,
101                       0.2]);
102             }
103       }
104     }
105   }
106 }
107
108 module PunchHolder(cutouts=true){
109   translations=[-holder_xsz/2,
110                 -holder_ysz + holder_min_wall + crewpunch_biggest_y/2,
111                 0];
112   translate(translations){
113     difference(){
114       translate([0,attach_offset,0])
115         cube([holder_xsz, holder_ysz - attach_offset, holder_block_zsz]);
116       if (cutouts)
117         translate([0,-crewpunch_skew_yoff])
118         translate(-translations)
119         rotate([0,0,-crewpunch_skew_angle])
120         translate(translations)
121         translate([crewpunch_biggest_shape[2][0] + holder_min_wall,
122                    crewpunch_biggest_shape[1][0] + holder_front_all,
123                    -crewpunch_smallest_shape[0]])
124           CrewPunch();
125     }
126     difference(){
127       translate([holder_xsz/2 - holder_attach_xsz/2, 0, 0])
128         cube([holder_attach_xsz,
129               attach_ysz,
130               holder_block_zsz + punch_travel
131               + holder_ctie_thick + holder_attach_roof + 1]);
132       if (cutouts)
133         translate([-30,
134                    holder_attach_walls,
135                    holder_block_zsz + punch_travel])
136           cube([60, holder_ctie_width, holder_ctie_thick]);
137     }
138   }
139 }
140
141 module RegistrationGroove(l){
142   // runs along the +ve X axis for length l but at correct z pos
143   translate([0, 0, jig_main_zsz + 0.1]) {
144     rotate([90,0,90])
145       linear_extrude(height=l)
146       polygon([[-registrationgroove_width/2, 0],
147                [ +registrationgroove_width/2, 0],
148                [ 0, -registrationgroove_depth ]]);
149   }
150 }
151
152 module OneJig(){
153   difference(){
154     translate([-(jig_interval/2 + jig_overlap),
155                -(strap_width/2 + edgewall_width) - attach_offset,
156                -strap_thick])
157       cube([jig_interval + 2,
158             strap_width + edgewall_width*2 + attach_offset,
159             jig_main_zsz + strap_thick]);
160     minkowski(){
161       cube([main_slop*2, main_slop*2, 50], center=true);
162       PunchHolder(false);
163     }
164     translate([-100, -strap_width/2, -10])
165       cube([200, strap_width, 10]);
166    translate([-100,0,0])
167      RegistrationGroove(200);
168    for (xfrac=[-1/4,0,+1/4])
169      translate([jig_interval * xfrac, -100, 0])
170        rotate([0,0,90])
171        RegistrationGroove(200);
172   }
173 }
174
175 module RegistrationProtrusion(){
176   // points towards the positive x axis
177   xsz = registrationprotrusion_poke;
178   ysz = registrationprotrusion_poke;
179   diag_sz = xsz * sqrt(2);
180   zsz = diag_sz / registrationprotrusion_slope;
181   hull(){
182     translate([0, 0, 0.1]){
183       linear_extrude(height=0.1)
184         polygon([[   0, -ysz ],
185                  [ xsz,    0 ],
186                  [   0,  ysz ]]);
187       translate([-0.1, 0, zsz ])
188         rotate([0,0,45])
189         cube(0.1);
190     }
191   }
192 }
193
194 module Jig(){
195   for(end=[0,1]){
196     for(yfrac=[-1/2, 0, 1/2]){
197       translate([ end
198                   ? jig_interval * (jig_iters - 0.5)
199                   : -jig_interval/2,
200                  yfrac * strap_width,
201                  0])
202         rotate([0,0, end ? 0 : 180])
203         translate([ jig_overlap, 0, 0 ])
204         RegistrationProtrusion();
205     }
206   }
207   for (i=[0:jig_iters-1]) {
208     translate([jig_interval * i, 0, 0])
209       OneJig();
210   }
211 }
212
213 module JigT(){ ////toplevel
214   rotate([180,0,0])
215     Jig();
216 }
217
218 module PunchHolderT(){ ////toplevel
219   PunchHolder(true);
220 }
221
222 module Demo(){
223   %PunchHolder();
224   Jig();
225 }
226
227 //CrewPunch();
228 //PunchHolder();
229 //PunchHolder(false);
230 //OneJig();
231 //Jig();
232 //Demo();
233 //JigT();
234 //RegistrationProtrusion();
235 //PunchHolderT();