chiark / gitweb /
58c66df517928f1a7f56138e7b41075af6a8ba6f
[reprap-play.git] / belt-cut-jig-common.scad
1 // -*- C -*-
2
3 jig_max_len = 160; // print diagonally
4 //jig_max_len = 30;
5
6 registrationgroove_width = 0.8;
7 registrationgroove_depth = 1.2;
8
9 registrationprotrusion_poke = 3;
10 registrationprotrusion_slope = 0.75;
11
12 jig_overlap = 1;
13
14 jig_ends_extra = 2;
15
16 jig_iters = floor((jig_max_len - jig_ends_extra) / jig_interval);
17 //jig_iters=2;
18 echo(jig_iters);
19
20 module RegistrationGroove(l){
21   // runs along the +ve X axis for length l but at correct z pos
22   translate([0, 0, jig_main_zsz + 0.1]) {
23     rotate([90,0,90])
24       linear_extrude(height=l)
25       polygon([[-registrationgroove_width/2, 0],
26                [ +registrationgroove_width/2, 0],
27                [ 0, -registrationgroove_depth ]]);
28   }
29 }
30
31 module OneJig(){
32   main_z = jig_main_zsz + strap_thick;
33   difference(){
34     translate([-(jig_interval/2 + jig_overlap),
35                0,
36                -strap_thick])
37       rotate([0,90,0]) rotate([0,0,90])
38       linear_extrude(height=jig_interval + 2)
39       polygon([[jig_min_y,     0],
40                [jig_top_min_y, main_z],
41                [jig_top_max_y, main_z],
42                [jig_max_y,     0]]);
43     OneJigCutout();
44     translate([-100, -strap_width/2, -10])
45       cube([200, strap_width, 10]);
46    translate([-100,0,0])
47      RegistrationGroove(200);
48    for (xfrac=[-1/4,0,+1/4])
49      translate([jig_interval * xfrac, -100, 0])
50        rotate([0,0,90])
51        RegistrationGroove(200);
52   }
53 }
54
55 module RegistrationProtrusion(){
56   // points towards the positive x axis
57   xsz = registrationprotrusion_poke;
58   ysz = registrationprotrusion_poke;
59   diag_sz = xsz * sqrt(2);
60   zsz = diag_sz / registrationprotrusion_slope;
61   hull(){
62     translate([0, 0, 0.1]){
63       linear_extrude(height=0.1)
64         polygon([[   0, -ysz ],
65                  [ xsz,    0 ],
66                  [   0,  ysz ]]);
67       translate([-0.1, 0, zsz ])
68         rotate([0,0,45])
69         cube(0.1);
70     }
71   }
72 }
73
74 module Jig(){
75   for(end=[0,1]){
76     for(yfrac=[-1/2, 0, 1/2]){
77       translate([ end
78                   ? jig_interval * (jig_iters - 0.5)
79                   : -jig_interval/2,
80                  yfrac * strap_width,
81                  0])
82         rotate([0,0, end ? 0 : 180])
83         translate([ jig_overlap, 0, 0 ])
84         RegistrationProtrusion();
85     }
86   }
87   for (i=[0:jig_iters-1]) {
88     translate([jig_interval * i, 0, 0])
89       OneJig();
90   }
91 }
92
93 module JigPrint(){
94   rotate([0,0,-45])
95     translate([0,0,jig_main_zsz])
96     rotate([180,0,0])
97     Jig();
98 }
99