chiark / gitweb /
topeak-mtx-tortec-expeditionrack-adapter: wip
[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 main_sz_y = 20;
25 grasp_sz = 12;
26 beside_strap_sz = 8;
27
28 // calculated
29
30 main_sz_z = beside_strap_sz*2 + strap_w;
31
32 brk_bottom_y = -brk_recess_actual;
33 adapt_main_top_y = brk_bottom_y + general_gap_y;
34
35 // on LHS, so -ve
36 rack_rail_x = -(rack_width_inner/2 + rack_rail_dia/2);
37 rack_rail_outer_x = -(rack_width_inner/2 + rack_rail_dia);
38
39 grasp_large_r = (rack_rail_dia + grasp_sz)/2;
40 grasp_large_x = rack_rail_outer_x + grasp_large_r;
41
42 block_x = grasp_large_x + grasp_large_r/2;
43 block_y_min = adapt_main_top_y - main_sz_y;
44
45 strap_barrel_x = rack_width_inner/2 + strap_barrel_dia/2;
46
47 rack_shear_ratio = rear_elevation_nominal / rear_to_front_distance;
48
49 module GraspElevation(){
50   hull(){
51     translate([ grasp_large_x, adapt_main_top_y - grasp_large_r ])
52       circle(grasp_large_r);
53
54     translate([ grasp_large_x, $rack_rail_y - rack_rail_dia/2 ])
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 }
61
62 module BlockElevation(){
63   rectfromto([ +block_x, adapt_main_top_y ],
64              [ -block_x, block_y_min ]);
65 }
66
67 module MainExtrude(){
68   linextr(0, main_sz_z)
69     children();
70 }
71 module RackShear(){
72   s = rack_shear_ratio;
73   multmatrix([ [ 1, 0,  0, 0 ],
74                [ 0, 1, s , 0 ],
75                [ 0, 0,  1, 0 ],
76                [ 0, 0,  0, 1 ] ])
77     children();
78 }
79
80 module GraspFixingElevation(){
81   intersection(){
82     union(){
83       mirror([1,0]) GraspElevation();
84       translate([ strap_barrel_x, $strap_barrel_y ])
85         circle(strap_barrel_dia/2 + strap_guide_sz);
86     }
87     union(){
88       rectfromto([0, $rack_rail_y],
89                  [rack_width_inner, 50]);
90       intersection(){
91         translate([ rack_rail_x, $rack_rail_y ])
92           circle(r = rack_width_inner/2 - rack_rail_x, $fa=1);
93         polygon([ [ 0, 0 ],
94                   [ rack_width_inner/2, 0 ],
95                   [ rack_width_inner/2, $rack_rail_y - rack_rail_dia/2 ],
96                   [ -block_x, block_y_min ],
97                   [ 0, block_y_min ]]);
98       }
99     }
100   }
101 }
102
103 module StrapBarrelElevation(){
104   translate([ strap_barrel_x, $strap_barrel_y ])
105     circle(strap_barrel_dia/2);
106 }
107
108 module Principal(){
109   // calculated
110   $rack_rail_y = brk_bottom_y - $elevation_nominal
111     - general_gap_y  - rack_rail_dia/2;
112
113   $strap_barrel_y = $rack_rail_y + rack_rail_dia/2 + strap_barrel_dia/2;
114
115   difference(){
116     union(){
117       MainExtrude(){
118         GraspElevation();
119         BlockElevation();
120       }
121       RackShear() MainExtrude(){
122         StrapBarrelElevation();
123       }
124
125       difference(){
126         RackShear() MainExtrude(){
127           GraspFixingElevation();
128         }
129
130         translate([0,0, main_sz_z/2]) linextr(-strap_w/2, +strap_w/2) {
131           translate([ rack_width_inner/2 - strap_th, 0 ])
132             rectfromto([ 0, -50 ], [ 50, 50 ]);
133         }
134       }
135     }
136
137     RackShear() linextr(-10, main_sz_z+10) {
138       for (mx=[0,1]) {
139         mirror([mx,0]) {
140           translate([ rack_rail_x, $rack_rail_y ]){
141             hull(){
142               for (dx = [-rack_rail_dia, 0])
143                 translate([dx, 0])
144                   circle(r= rack_rail_dia/2);
145             }
146           }
147         }
148       }
149     }
150   }
151 }
152
153 Principal($elevation_nominal=0);