remove qr size and height override
[challenge-bot] / 3d-printables / wheel.scad
1 // challenge-bot
2 // GNU AGPLv3 (or later at your option)
3 // project available at these locations:
4 // https://gitorious.org/ozzloy/challenge-bot
5 // https://github.com/waynegramlich/challenge-bot
6
7 // use $fn = 20 while developing, 100 when about to print
8 // 20 will make previews fast
9 // 100 will make printing smooth
10 $fn = 100;
11
12 use <qr.scad>
13
14 qr_size = 54;
15 qr_height = 2;
16
17 wall_width = 3;
18
19 wheel_width = 6;
20 wheel_radius = sqrt(2 * pow(qr_size / 2, 2)) + wall_width / 2;
21
22 motor_shaft_radius = 3.7;
23 motor_shaft_flat_width = 4.8;
24
25 tread_radius = 2.5 / 2;
26
27 module mounting_screw_flat(){
28 square(2, center = true);}
29
30 module motor_shaft_flat(radius, flat_width){
31 intersection(){
32 circle(radius);
33 square([flat_width, radius * 2], center = true);}}
34
35 module motor_shaft(radius,
36 flat_width,
37 shaft_length){
38 linear_extrude(height = shaft_length){
39 motor_shaft_flat(radius, flat_width);}}
40
41 module rim(radius, wall_width, wheel_width){
42 linear_extrude(height = wheel_width){
43 difference(){
44 circle(radius);
45 circle(radius - wall_width);}}}
46
47 module motor_shaft_holder_flat(radius, flat_width, wall_width){
48 difference(){
49 motor_shaft_flat(radius + wall_width,
50 flat_width + wall_width);
51 motor_shaft_flat(radius, flat_width);}}
52
53 module motor_shaft_holder(radius, flat_width, wall_width, height){
54 linear_extrude(height = height){
55 motor_shaft_holder_flat(radius, flat_width, wall_width);}}
56
57 module tread(wheel_radius, tread_radius){
58 rotate_extrude(convexity = 10){
59 translate([wheel_radius, 0]){
60 circle(tread_radius);}}}
61
62 module wheel_black(radius,
63 width,
64 shaft_radius,
65 shaft_flat_width,
66 wall_width,
67 tread_radius){
68 color("black"){
69 difference(){
70 rim(radius, wall_width, width);
71 translate([0, 0, width / 2]){
72 tread(radius, tread_radius);}}
73 linear_extrude(height = qr_height){
74 difference(){
75 qr_black_flat();
76 mounting_screw_flat();}}
77 translate([0, 0, qr_height]){
78 motor_shaft_holder(shaft_radius,
79 shaft_flat_width,
80 wall_width,
81 width - qr_height);}}}
82
83 module wheel_white(){
84 color("white"){
85 linear_extrude(height = qr_height){
86 difference(){
87 qr_white_flat();
88 mounting_screw_flat();}}}}
89
90 module wheel(radius,
91 width,
92 shaft_radius,
93 shaft_flat_width,
94 wall_width,
95 tread_radius){
96 wheel_black(radius,
97 width,
98 shaft_radius,
99 shaft_flat_width,
100 wall_width,
101 tread_radius);
102 wheel_white();}
103
104 module wheel_solid(radius,
105 width,
106 shaft_radius,
107 shaft_flat_width,
108 wall_width,
109 tread_radius){
110 difference(){
111 rim(radius, wall_width, width);
112 translate([0, 0, width / 2]){
113 tread(radius, tread_radius);}}
114 linear_extrude(height = qr_height){
115 difference (){
116 square(qr_size, center = true);
117 square(1.5, center = true);}}
118 translate([0, 0, qr_height]){
119 motor_shaft_holder(shaft_radius,
120 shaft_flat_width,
121 wall_width,
122 width - qr_height);}}
123
124 /*
125 wheel(wheel_radius,
126 wheel_width,
127 motor_shaft_radius,
128 motor_shaft_flat_width,
129 wall_width,
130 tread_radius);
131 */
132
133 wheel_solid(wheel_radius,
134 wheel_width,
135 motor_shaft_radius,
136 motor_shaft_flat_width,
137 wall_width,
138 tread_radius);