chiark / gitweb /
4cb8331d4883f8448cab6783ff7c41e358e48b5b
[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 = 2.0 + 0.5;
16 holder_attach_walls = 3;
17 holder_attach_roof = 2.5;
18
19 jig_interval = 25;
20 strap_width = 25;
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
49 crewpunch_shaft_max_y = 7.5;
50
51 crewpunch_systematic_size_error = +0.36;
52
53 crewpunch_min_y = 4.7 - crewpunch_systematic_size_error;
54
55 crewpunch_smallest_shape = crewpunch_shape[0];
56 crewpunch_biggest_shape = crewpunch_shape[len(crewpunch_shape)-1];
57
58 // computed
59
60 attach_ysz = holder_attach_walls*2 + holder_ctie_width;
61 holder_front_all = crewpunch_shaft_max_y - crewpunch_biggest_shape[1][1]
62   + attach_ysz;
63
64 holder_block_zsz = crewpunch_biggest_shape[0] - crewpunch_smallest_shape[0];
65 holder_xsz = crewpunch_biggest_shape[2][0] + crewpunch_biggest_shape[2][1] +
66   holder_min_wall*2;
67 crewpunch_biggest_y =
68   crewpunch_biggest_shape[1][0] + crewpunch_biggest_shape[1][1];
69 holder_ysz = crewpunch_biggest_y + holder_min_wall + holder_front_all;
70
71 attach_offset = 0.5 * (holder_front_all - holder_attach_near_wall);
72
73 jig_main_zsz = holder_block_zsz + punch_travel;
74
75 jig_ends_extra = 2;
76
77 //jig_iters = (jig_max_len - jig_ends_extra) / jig_interval;
78 jig_iters=2;
79 echo(jig_iters);
80
81 // objects
82
83 module CrewPunch(){
84   ourslop = crewpunch_slop - crewpunch_systematic_size_error;
85   hull(){
86     for(layer=crewpunch_shape){
87       translate([0,0, layer[0]]){
88         for(xind=[0,1]) //translate([xind?0:1,0,0])
89           for(yind=[0,1]) //translate([0,yind?0.5:0,0])
90             mirror([xind?1:0,0,0]) mirror([0,yind?0:1,0]){
91               translate([-0.1,-0.1,-0.1])
92                 cube([0.1 + layer[2][xind] + ourslop,
93                       0.1 + layer[1][yind] + ourslop,
94                       0.2]);
95             }
96       }
97     }
98   }
99 }
100
101 module PunchHolder(cutouts=true){
102   translate([-holder_xsz/2,
103              -holder_ysz + holder_min_wall + crewpunch_biggest_y/2,
104              0]){
105     difference(){
106       translate([0,attach_offset,0])
107         cube([holder_xsz, holder_ysz - attach_offset, holder_block_zsz]);
108       if (cutouts)
109         translate([crewpunch_biggest_shape[2][1] + holder_min_wall,
110                    crewpunch_biggest_shape[1][0] + holder_front_all,
111                    -crewpunch_smallest_shape[0]])
112           CrewPunch();
113     }
114     difference(){
115       translate([holder_xsz/2 - holder_attach_xsz/2, 0, 0])
116         cube([holder_attach_xsz,
117               attach_ysz,
118               holder_block_zsz + punch_travel
119               + holder_ctie_thick + holder_attach_roof + 1]);
120       if (cutouts)
121         translate([-30,
122                    holder_attach_walls,
123                    holder_block_zsz + punch_travel])
124           cube([60, holder_ctie_width, holder_ctie_thick]);
125     }
126   }
127 }
128
129 module RegistrationGroove(l){
130   // runs along the +ve X axis for length l but at correct z pos
131   translate([0, 0, jig_main_zsz + 0.1]) {
132     rotate([90,0,90])
133       linear_extrude(height=l)
134       polygon([[-registrationgroove_width/2, 0],
135                [ +registrationgroove_width/2, 0],
136                [ 0, -registrationgroove_depth ]]);
137   }
138 }
139
140 module OneJig(){
141   difference(){
142     translate([-(jig_interval/2 + jig_overlap),
143                -(strap_width/2 + edgewall_width) - attach_offset,
144                -strap_thick])
145       cube([jig_interval + 2,
146             strap_width + edgewall_width*2 + attach_offset,
147             jig_main_zsz + strap_thick]);
148     minkowski(){
149       cube([main_slop*2, main_slop*2, 50], center=true);
150       PunchHolder(false);
151     }
152     translate([-100, -strap_width/2, -10])
153       cube([200, strap_width, 10]);
154    translate([-100,0,0])
155      RegistrationGroove(200);
156    for (xfrac=[-1/4,0,+1/4])
157      translate([jig_interval * xfrac, -100, 0])
158        rotate([0,0,90])
159        RegistrationGroove(200);
160   }
161 }
162
163 module RegistrationProtrusion(){
164   // points towards the positive x axis
165   xsz = registrationprotrusion_poke;
166   ysz = registrationprotrusion_poke;
167   diag_sz = xsz * sqrt(2);
168   zsz = diag_sz / registrationprotrusion_slope;
169   hull(){
170     translate([0, 0, 0.1]){
171       linear_extrude(height=0.1)
172         polygon([[   0, -ysz ],
173                  [ xsz,    0 ],
174                  [   0,  ysz ]]);
175       translate([-0.1, 0, zsz ])
176         rotate([0,0,45])
177         cube(0.1);
178     }
179   }
180 }
181
182 module Jig(){
183   for(end=[0,1]){
184     for(yfrac=[-1/2, 0, 1/2]){
185       translate([ end
186                   ? jig_interval * (jig_iters - 0.5)
187                   : -jig_interval/2,
188                  yfrac * strap_width,
189                  0])
190         rotate([0,0, end ? 0 : 180])
191         translate([ jig_overlap, 0, 0 ])
192         RegistrationProtrusion();
193     }
194   }
195   for (i=[0:jig_iters-1]) {
196     translate([jig_interval * i, 0, 0])
197       OneJig();
198   }
199 }
200
201 module JigT(){ ////toplevel
202   rotate([180,0,0])
203     Jig();
204 }
205
206 module PunchHolderT(){ ////toplevel
207   PunchHolder(true);
208 }
209
210 module Demo(){
211   %PunchHolder();
212   Jig();
213 }
214
215 //CrewPunch();
216 //PunchHolder();
217 //PunchHolder(false);
218 //OneJig();
219 //Jig();
220 //Demo();
221 //JigT();
222 //RegistrationProtrusion();
223 //PunchHolderT();