z-axis support for aluminum extrusion frame
[clinton/prusa3.git] / box_frame / bushing.scad
CommitLineData
2159eed1
VAH
1// PRUSA iteration3
2// Bushing/bearing housings
d3618a65 3// GNU GPL v3
2159eed1
VAH
4// Josef Průša <josefprusa@me.com>
5// Václav 'ax' Hůla <axtheb@gmail.com>
d3618a65 6// http://www.reprap.org/wiki/Prusa_Mendel
8e93419f 7// http://github.com/josefprusa/Prusa3
d3618a65 8
65a72cd5
T
9// ThingDoc entry
10/**
11 * @id yBearingHolder
12 * @name Y Axis Bearing Holder
13 * @category Printed
14 */
15
e5d97a09 16include <configuration.scad>
d3618a65 17
0205afdc
VAH
18// ensure that the part length is at least the length of bushing barrel plus add
19function adjust_bushing_len(conf_b, h, add=layer_height*2) = ((conf_b[2]+add) > h) ? conf_b[2]+add : h;
6ffe28a4 20
0205afdc
VAH
21//distance from the flat side of bushing holder to rod center
22function bushing_foot_len(conf_b, h=10.5, add=4*single_wall_width) = ((conf_b[1]+add) > h) ? conf_b[1]+add : h;
23
24function bushing_outer_radius(conf_b) = conf_b[1] + 4*single_wall_width;
2fc35ca2
VAH
25
26// basic building blocks, housings for 1 bushing/bearing
27// at [0,0] there is center of the smooth rod, pointing in Z
e5d97a09 28
0205afdc
VAH
29module linear_bushing_negative_single(conf_b=bushing_xy, h=0){
30 // barrel with the dimensions of a bushing/bearing
31 // to be substracted as needed
32 translate([0, 0, -0.01]) cylinder(r = conf_b[1], h = adjust_bushing_len(conf_b, h) + 0.02);
e5d97a09
VAH
33}
34
cb0f26da 35module linear_bearing_negative_single(conf_b=bushing_xy, h=0, shadow=false){
f2abce89
VAH
36 // barrel with the dimensions of the bearing
37 translate([0, 0, -0.01 + 3 * layer_height]) cylinder(r = conf_b[1], h = adjust_bushing_len(conf_b, h) + 0.02);
cb0f26da
VAH
38 if (shadow == false) {
39 translate([0, -conf_b[1]+1, -0.01 + 3 * layer_height]) cube([30, 2 * conf_b[1] - 2, adjust_bushing_len(conf_b, h) + 0.02]);
40 }
0734f977
VAH
41}
42
0205afdc
VAH
43module linear_bushing_single(conf_b=bushing_xy, h=0) {
44 // This is the printed barrel around bushing
45 // with foot pointing to -x
46 translate([-bushing_foot_len(conf_b), -7, 0]) cube([bushing_foot_len(conf_b), 14, adjust_bushing_len(conf_b, h)]);
47 cylinder(r=bushing_outer_radius(conf_b), h=adjust_bushing_len(conf_b, h));
0734f977
VAH
48}
49
0205afdc
VAH
50module linear_bushing_negative(conf_b=bushing_xy, h=0){
51 // return simple negative stretched all along and a smooth rod
52 translate([0,0,-0.1]) cylinder(r = conf_b[0] + single_wall_width, h=adjust_bushing_len(conf_b, h)+0.2);
53 linear_bushing_negative_single(conf_b, h=adjust_bushing_len(conf_b, h));
0734f977
VAH
54}
55
cb0f26da 56module linear_bearing_negative(conf_b = bushing_xy, h = 0, shadow=false){
0205afdc
VAH
57 //same as linear_bushing_negative, but with z direction constrained parts
58 translate([0,0,-0.1]) cylinder(r = conf_b[0] + single_wall_width, h=adjust_bushing_len(conf_b, h, 8*layer_height)+0.2);
59 //lower bearing
cb0f26da 60 linear_bearing_negative_single(conf_b, 0, shadow);
0205afdc 61 if (h > 2*conf_b[2] + 9*layer_height){
cb0f26da 62 translate([0,0,h]) mirror([0,0,1]) linear_bearing_negative_single(conf_b, 0, shadow);
0205afdc 63 }
0734f977
VAH
64}
65
50d27a47
VAH
66module linear_negative_preclean(conf_b = bushing_xy) {
67 // makes sure there is nothing interfering
68 // to be substracted before linear()
69 cylinder(r = conf_b[1] + single_wall_width, h=300, center=true);
70}
71
0205afdc
VAH
72module linear_bushing_sloped(conf_b=bushing_xy, h= 100){
73 // cut the bushing at angle, so it can be printed upside down
74 intersection(){
75 linear_bushing_single(conf_b, h = h);
76 // hardcoded, may need fixing for different barelled bushings
77 // atm there is only one and I am too lazy
78 translate([0, 0, -2]) rotate([0,-50,0]) cube([30, 40, 80], center=true);
e5d97a09
VAH
79 }
80}
81
0205afdc
VAH
82module linear_bushing(conf_b=bushing_xy, h=0){
83 // this is the function to be used for type 1 linears (barrel holder)
84 // It has bushing on bottom and for parts longer than 3x the barel length on top too
85 difference() {
86 union() {
87 translate([-bushing_foot_len(conf_b), -7, 0]) cube([2, 14, adjust_bushing_len(conf_b, h)]);
88 linear_bushing_single(conf_b);
89 if (h>3*conf_b[2]) {
90 translate([0,0,h]) mirror([0,0,1]) linear_bushing_sloped(conf_b);
91 }
e5d97a09 92 }
0205afdc 93 linear_bushing_negative(conf_b, h);
2fc35ca2
VAH
94 }
95}
e5d97a09 96
0205afdc 97module linear_bearing(conf_b=bushing_xy, h=0){
0734f977
VAH
98 difference() {
99 union() {
0205afdc
VAH
100 difference(){
101 union(){
102 //main block
6ffe28a4 103 //translate([-bushing_foot_len(conf_b), -7, 0]) cube([4, 14, adjust_bushing_len(conf_b, h, 9*layer_height)]); <- removed for duplicity:)
0205afdc
VAH
104 translate([0,0,0]) cylinder(h = adjust_bushing_len(conf_b, h, 9*layer_height), r=bushing_outer_radius(conf_b), $fn=60);
105 }
106 //smooth entry cut
107 translate([12,0,-1]) rotate([0,0,45]) cube([20, 20, 200], center=true);
108 }
109 intersection(){
f2abce89 110 translate([0, -(bushing_outer_radius(conf_b)), 0]) cube([30, 2*bushing_outer_radius(conf_b) , max(h, conf_b[2] + 9 * layer_height)]);
0205afdc
VAH
111 union() {
112 // upper clamp for long holders
6ffe28a4
VAH
113 if (h > 2*conf_b[2] + 9*layer_height || conf_b[2] > 45){
114 translate ([0,0, max(h, conf_b[2]) - 8 ]) bearing_clamp(conf_b, 2*(bushing_outer_radius(conf_b)));
0205afdc
VAH
115 }
116 //lower clamp
6ffe28a4 117 translate ([0, 0, 10]) bearing_clamp(conf_b, 2*(bushing_outer_radius(conf_b)));
0205afdc 118 }
0734f977 119 }
2fc35ca2 120 }
0205afdc
VAH
121 //main axis
122 translate([0,0,-2]) cylinder(h = adjust_bushing_len(conf_b, h)+10, r=conf_b[1]);
123 //main cut
124 translate([0, -conf_b[1]+1, -1]) cube([30, 2*conf_b[1]-2, 200]);
125 }
126 difference() {
127 translate([-bushing_foot_len(conf_b), -7, 0]) cube([4, 14, adjust_bushing_len(conf_b, h, 9*layer_height)]);
128 linear_negative(conf_b, h);
2fc35ca2 129 }
2fc35ca2 130}
e5d97a09 131
b355dcc6 132// this should be more parametric
f2abce89 133module firm_foot(conf_b = conf_b_lm8uu){
2fc35ca2
VAH
134 difference(){
135 union() {
6ffe28a4 136 translate([8.5/2,0,0]) cube_fillet([8.5, 42 + xy_delta * 2, 20], top=[11, 0, 11, 0], center=true);
2fc35ca2 137 }
d2247cad
JG
138 translate([9, 14.5 + xy_delta, 0]) rotate([0, -90, 0]) screw(head_drop=1, $fn=small_hole_segments);
139 translate([9,-14.5 - xy_delta, 0]) rotate([0,-90,0]) screw(head_drop=1,$fn=small_hole_segments);
e5d97a09 140 }
d3618a65
NZ
141}
142
6ffe28a4 143module y_bearing(conf_b=bushing_xy){
7e19784d 144
0205afdc 145 difference() {
2fc35ca2 146 union() {
50d27a47 147 difference() {
6ffe28a4
VAH
148 union() {
149 translate([-bushing_foot_len(conf_b), 0, 10]) firm_foot();
150 if (bushing_xy[2] > 45) {
151 translate([-bushing_foot_len(conf_b), 0, adjust_bushing_len(bushing_xy, 45) - 8]) mirror([0, 0, 1]) firm_foot();
152 }
153 }
154 linear_negative_preclean();
50d27a47
VAH
155 }
156 linear();
2fc35ca2 157 }
6ffe28a4 158 //linear_negative(bushing_xy, 20);
2fc35ca2
VAH
159 }
160}
161
0205afdc
VAH
162module bearing_clamp_brick(conf_b, h){
163 translate([-(m4_nut_diameter/2+conf_b[1]), 0, 0])
164 cube([m4_nut_diameter + 2 * conf_b[1], m4_nut_diameter + 1, h], center = true);
2fc35ca2 165}
d3618a65 166
0205afdc 167module bearing_clamp(conf_b=bushing_xy, h=0){
c8dd659c 168 // inspired by John Ridley and Jonas Kühling
44c9eaa6
VAH
169 rotate([90, 0, 0]) {
170 difference(){
171 union(){
966d2ae4 172 translate([m3_diameter / 2 + conf_b[1] + 0.3, 0, 0])
0205afdc 173 cylinder(h=h, r = m4_nut_diameter / 2 + 0.5, center = true);
966d2ae4 174 translate([m3_diameter / 2 + conf_b[1] + 0.3, 0, 0]) {
0205afdc
VAH
175 bearing_clamp_brick(conf_b, h);
176 rotate([0,0,35])
177 bearing_clamp_brick(conf_b, h);
178 }
44c9eaa6 179 }
df1b64cf 180 translate([m3_diameter / 2 + conf_b[1] + 0.3, 0, 0]) {
0ae9e1f0
JG
181 cylinder(r=m3_diameter / 2, h=h+2, center=true,$fn=small_hole_segments);
182 %cylinder(r=m3_diameter / 2, h=h+2, center=true,$fn=small_hole_segments);
df1b64cf 183 }
44c9eaa6
VAH
184 }
185 }
186}
2fc35ca2 187
d3618a65 188
cb0f26da 189module linear_negative(conf_b = bushing_xy, h = 0, shadow=false){
0205afdc
VAH
190 //selects right negative based on type
191 if (conf_b[3] == 0) {
cb0f26da 192 linear_bearing_negative(conf_b, h, shadow);
0205afdc 193 } else {
cb0f26da 194 linear_bushing_negative(conf_b, h, shadow);
e5d97a09 195 }
0205afdc
VAH
196}
197
198module linear(conf_b = bushing_xy, h = 0){
f2abce89 199 //selects right model based on type
0205afdc
VAH
200 if (conf_b[3] == 0) {
201 linear_bearing(conf_b, h);
202 } else {
203 linear_bushing(conf_b, h);
44c9eaa6 204 }
cb0f26da 205 %linear_negative(conf_b, h, true);
d3618a65
NZ
206}
207
6ffe28a4
VAH
208if (i_am_box == 1) {
209 %cylinder(r=bushing_xy[0], h=90);
44c9eaa6 210
6ffe28a4
VAH
211 y_bearing();
212 translate([0,52,0]) y_bearing();
0205afdc 213
6ffe28a4
VAH
214 if (bushing_xy[2] < 45) {
215 translate ([-30,23,0]) mirror([1,0,0]) y_bearing();
216 }
217} else {
218 cube([0.1, 0.1, 0.1]);
0205afdc 219}