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 // strength factor, set to 1 for real prints
10 //$strf = 0.25;
11 $strf = 1;
12
13 brk_recess_actual = 5.20;
14
15 rack_rail_dia = 10.40 + 0.50;
16 rack_width_inner = 115.86 + 1.0; // between insides of rails
17
18 rear_elevation_nominal = 10.04; // top of rack to bottom of bracket
19 rear_to_front_distance = 230;
20
21 general_gap_y = 1.0;
22
23 strap_w = 8.0 + 1.0;
24 strap_th = 2.5;
25 strap_barrel_dia = 14;
26 strap_guide_sz = 1;
27
28 brk_block_xw = 68.5;
29 brk_block_z = 14.55 - 0.75;
30
31 brk_bolt_dia = 4.0 + 0.5;
32 brk_nearbolt_recess_dia = 8.86 + 1.5;
33 brk_nearbolt_recess_depth = 1.09 + 0.25;
34
35 brk_bolt_eff_len = 11.78 - 1.0; // inside of recess, to end of bolt
36 brk_bolt_len_slop = 2.0;;
37 brk_bolt_nut_th = 3.89;
38 brk_bolt_nut_across_flats = 7.86 + 0.50;
39
40 brk_overall_w = 90.07;
41
42 fit_slope_len = 5;
43
44 main_sz_y = $strf * 20;
45 grasp_sz = $strf * 12;
46 beside_strap_sz = $strf * 8;
47
48 $fa=10;
49 $fs=1;
50
51 // calculated
52
53 main_sz_z = beside_strap_sz*2 + strap_w;
54
55 brk_bottom_y = -brk_recess_actual;
56 adapt_main_top_y = brk_bottom_y + general_gap_y;
57
58 // on LHS, so -ve
59 rack_rail_x = -(rack_width_inner/2 + rack_rail_dia/2);
60 rack_rail_outer_x = -(rack_width_inner/2 + rack_rail_dia);
61
62 grasp_large_r = (rack_rail_dia + grasp_sz)/2;
63 grasp_large_x = rack_rail_outer_x + grasp_large_r;
64
65 block_x = grasp_large_x + grasp_large_r/2;
66 block_y_min = adapt_main_top_y - main_sz_y;
67
68 strap_barrel_x = rack_width_inner/2 + strap_barrel_dia/2;
69
70 rack_shear_ratio = rear_elevation_nominal / rear_to_front_distance;
71
72 brk_bolt_nut_top_y = -brk_nearbolt_recess_depth
73   - brk_bolt_eff_len + brk_bolt_nut_th + brk_bolt_len_slop;
74                        
75 brk_bolt_nut_r = brk_bolt_nut_across_flats/2 / cos(360/12);
76
77 module GraspElevation(){
78   hull(){
79     translate([ grasp_large_x, adapt_main_top_y - grasp_large_r ])
80       circle(grasp_large_r);
81
82     translate([ grasp_large_x, $rack_rail_y - rack_rail_dia/2 ])
83       circle(grasp_large_r);
84
85     translate([ grasp_large_x, $rack_rail_y + rack_rail_dia/2 ])
86       circle(grasp_large_r);
87   }
88 }
89
90 module BlockElevation(){
91   hull(){
92     rectfromto([ +block_x, adapt_main_top_y ],
93                [ -block_x, block_y_min ]);
94     rectfromto([ -grasp_large_x, adapt_main_top_y ],
95                [ +grasp_large_x, adapt_main_top_y - 0.1 ]);
96   }
97 }
98
99 module MainExtrude(){
100   linextr(0, main_sz_z)
101     children();
102 }
103 module RackShear(){
104   s = rack_shear_ratio;
105   multmatrix([ [ 1, 0,  0, 0 ],
106                [ 0, 1, s , 0 ],
107                [ 0, 0,  1, 0 ],
108                [ 0, 0,  0, 1 ] ])
109     children();
110 }
111
112 module GraspFixingElevation(){
113   intersection(){
114     union(){
115       mirror([1,0]) GraspElevation();
116       translate([ strap_barrel_x, $strap_barrel_y ])
117         circle(strap_barrel_dia/2 + strap_guide_sz);
118     }
119     union(){
120       rectfromto([0, $rack_rail_y],
121                  [rack_width_inner, 50]);
122       intersection(){
123         translate([ rack_rail_x, $rack_rail_y ])
124           circle(r = rack_width_inner/2 - rack_rail_x);
125         polygon([ [ 0, 0 ],
126                   [ rack_width_inner/2, 0 ],
127                   $rail_fixing_fit_corner,
128                   $rail_fixing_fit_corner + [-1,-1] * fit_slope_len,
129                   [ -block_x, block_y_min ],
130                   [ 0, block_y_min ]]);
131       }
132     }
133   }
134 }
135
136 module StrapBarrelElevation(){
137   translate([ strap_barrel_x, $strap_barrel_y ])
138     circle(strap_barrel_dia/2);
139 }
140
141 // Bracket support block, goes up inside bracket
142 // Z origin is bolt hole
143 module BrkBlock(){
144   linextr( -brk_block_z/2,
145            +brk_block_z/2 ) {
146     rectfromto([ -brk_block_xw/2, adapt_main_top_y - 0.1 ],
147                [ +brk_block_xw/2, 0 ]);
148   }
149 }
150
151 // Z origin is bolt hole
152 module BoltHole(){
153   linextr_y_xz( -100, 10 )
154     circle(brk_bolt_dia/2);
155
156   linextr_y_xz( -brk_nearbolt_recess_depth, 10)
157     circle(brk_nearbolt_recess_dia/2);
158
159   linextr_y_xz( -100, brk_bolt_nut_top_y ) {
160     circle( r= brk_bolt_nut_r, $fn = 6 );
161     translate([ 0, brk_bolt_nut_across_flats/2 ])
162       circle( r=brk_bolt_nut_r/2, $fn = 4);
163   }
164 }
165
166 module Principal(){
167   // calculated
168   $rack_rail_y = brk_bottom_y - $elevation_nominal
169     - general_gap_y  - rack_rail_dia/2;
170
171   $strap_barrel_y = $rack_rail_y + rack_rail_dia/2 + strap_barrel_dia/2;
172
173   $rail_fixing_fit_corner = [
174     rack_width_inner/2,
175     $rack_rail_y - rack_rail_dia/2
176   ];
177
178   difference(){
179     union(){
180       MainExtrude(){
181         GraspElevation();
182       }
183       RackShear() MainExtrude(){
184         StrapBarrelElevation();
185       }
186       translate([ 0,0, brk_block_z/2]) {
187         BrkBlock();
188       }
189
190       difference(){
191         union(){
192           MainExtrude(){
193             BlockElevation();
194           }
195           RackShear() MainExtrude(){
196             GraspFixingElevation();
197           }
198         }
199
200         translate([0,0, main_sz_z/2]) linextr(-strap_w/2, +strap_w/2) {
201           translate([ rack_width_inner/2 - strap_th, 0 ])
202             rectfromto([ 0, -50 ], [ 50, 50 ]);
203         }
204       }
205     }
206
207     RackShear() linextr(-10, main_sz_z+10) {
208       for (mx=[0,1]) {
209         mirror([mx,0]) {
210           translate([ rack_rail_x, $rack_rail_y ]){
211             hull(){
212               for (dx = [-rack_rail_dia, 0])
213                 translate([dx, 0])
214                   circle(r= rack_rail_dia/2);
215             }
216           }
217         }
218       }
219     }
220
221     translate([ 0,0, brk_block_z/2]) BoltHole();
222   }
223 }
224
225 module Front(){ ////toplevel
226   Principal($elevation_nominal=0);
227 }
228
229 module Rear(){ ////toplevel
230   Principal($elevation_nominal=rear_elevation_nominal);
231 }
232
233 module Demo(){ ////toplevel
234   rotate([90, 0, 0]){
235
236     Rear();
237
238     color("blue")
239       translate([ 0, -2, -4 ])
240       square(center=true, [ brk_overall_w, 1 ]);
241
242   }
243 }