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