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