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