chiark / gitweb /
c9219703cd4400a745d6d4059565de0d3284d768
[reprap-play.git] / topeak-mtx-tortec-expeditionrack-adapter.scad
1 // -*- C -*-
2
3 // brk_*: "bracket", the Topeak MTX bracket
4 // rack_*: the Tortec rack
5 // adapt_*: the adapter, ie this file
6
7 include <utils.scad>
8
9 brk_recess_actual = 5.20;
10
11 rack_rail_dia = 10.40 + 0.50;
12 rack_width_inner = 115.86 + 1.0; // between insides of rails
13
14 rear_elevation_nominal = 10.04; // top of rack to bottom of bracket
15 rear_to_front_distance = 230;
16
17 general_gap_y = 1.0;
18
19 strap_w = 8.0 + 1.0;
20 strap_th = 2.5;
21 strap_barrel_dia = 12;
22 strap_guide_sz = 2;
23
24 brk_block_xw = 68.5;
25 brk_block_z = 14.55 - 0.75;
26
27 main_sz_y = 20;
28 grasp_sz = 12;
29 beside_strap_sz = 8;
30
31 // calculated
32
33 main_sz_z = beside_strap_sz*2 + strap_w;
34
35 brk_bottom_y = -brk_recess_actual;
36 adapt_main_top_y = brk_bottom_y + general_gap_y;
37
38 // on LHS, so -ve
39 rack_rail_x = -(rack_width_inner/2 + rack_rail_dia/2);
40 rack_rail_outer_x = -(rack_width_inner/2 + rack_rail_dia);
41
42 grasp_large_r = (rack_rail_dia + grasp_sz)/2;
43 grasp_large_x = rack_rail_outer_x + grasp_large_r;
44
45 block_x = grasp_large_x + grasp_large_r/2;
46 block_y_min = adapt_main_top_y - main_sz_y;
47
48 strap_barrel_x = rack_width_inner/2 + strap_barrel_dia/2;
49
50 rack_shear_ratio = rear_elevation_nominal / rear_to_front_distance;
51
52 module GraspElevation(){
53   hull(){
54     translate([ grasp_large_x, adapt_main_top_y - grasp_large_r ])
55       circle(grasp_large_r);
56
57     translate([ grasp_large_x, $rack_rail_y - rack_rail_dia/2 ])
58       circle(grasp_large_r);
59
60     translate([ grasp_large_x, $rack_rail_y + rack_rail_dia/2 ])
61       circle(grasp_large_r);
62   }
63 }
64
65 module BlockElevation(){
66   rectfromto([ +block_x, adapt_main_top_y ],
67              [ -block_x, block_y_min ]);
68 }
69
70 module MainExtrude(){
71   linextr(0, main_sz_z)
72     children();
73 }
74 module RackShear(){
75   s = rack_shear_ratio;
76   multmatrix([ [ 1, 0,  0, 0 ],
77                [ 0, 1, s , 0 ],
78                [ 0, 0,  1, 0 ],
79                [ 0, 0,  0, 1 ] ])
80     children();
81 }
82
83 module GraspFixingElevation(){
84   intersection(){
85     union(){
86       mirror([1,0]) GraspElevation();
87       translate([ strap_barrel_x, $strap_barrel_y ])
88         circle(strap_barrel_dia/2 + strap_guide_sz);
89     }
90     union(){
91       rectfromto([0, $rack_rail_y],
92                  [rack_width_inner, 50]);
93       intersection(){
94         translate([ rack_rail_x, $rack_rail_y ])
95           circle(r = rack_width_inner/2 - rack_rail_x, $fa=1);
96         polygon([ [ 0, 0 ],
97                   [ rack_width_inner/2, 0 ],
98                   [ rack_width_inner/2, $rack_rail_y - rack_rail_dia/2 ],
99                   [ -block_x, block_y_min ],
100                   [ 0, block_y_min ]]);
101       }
102     }
103   }
104 }
105
106 module StrapBarrelElevation(){
107   translate([ strap_barrel_x, $strap_barrel_y ])
108     circle(strap_barrel_dia/2);
109 }
110
111 // Bracket support block, goes up inside bracket
112 // Z origin is bolt hole
113 module BrkBlock(){
114   linextr( -brk_block_z/2,
115            +brk_block_z/2 ) {
116     rectfromto([ -brk_block_xw/2, adapt_main_top_y - 0.1 ],
117                [ +brk_block_xw/2, 0 ]);
118   }
119 }
120
121
122 module Principal(){
123   // calculated
124   $rack_rail_y = brk_bottom_y - $elevation_nominal
125     - general_gap_y  - rack_rail_dia/2;
126
127   $strap_barrel_y = $rack_rail_y + rack_rail_dia/2 + strap_barrel_dia/2;
128
129   difference(){
130     union(){
131       MainExtrude(){
132         GraspElevation();
133         BlockElevation();
134       }
135       RackShear() MainExtrude(){
136         StrapBarrelElevation();
137       }
138       translate([ 0,0, brk_block_z/2]) BrkBlock();
139
140       difference(){
141         RackShear() MainExtrude(){
142           GraspFixingElevation();
143         }
144
145         translate([0,0, main_sz_z/2]) linextr(-strap_w/2, +strap_w/2) {
146           translate([ rack_width_inner/2 - strap_th, 0 ])
147             rectfromto([ 0, -50 ], [ 50, 50 ]);
148         }
149       }
150     }
151
152     RackShear() linextr(-10, main_sz_z+10) {
153       for (mx=[0,1]) {
154         mirror([mx,0]) {
155           translate([ rack_rail_x, $rack_rail_y ]){
156             hull(){
157               for (dx = [-rack_rail_dia, 0])
158                 translate([dx, 0])
159                   circle(r= rack_rail_dia/2);
160             }
161           }
162         }
163       }
164     }
165   }
166 }
167
168 Principal($elevation_nominal=0);