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