separate dimensions from form
[challenge-bot] / 3d-printables / wheel.scad
CommitLineData
bc02cd24 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
136c3fb0 7// use $fn = 20 while developing, 100 when about to print
8// 20 will make previews fast
9// 100 will make printing smooth
8464810c 10$fn = 100;
136c3fb0 11
180a0f6f 12include <wheel-dimensions.scad>
8464810c 13use <qr.scad>
0d781ab9 14
180a0f6f 15module mounting_screw_flat() {
16 circle(0.9); }
bc02cd24 17
180a0f6f 18module motor_shaft_flat(radius, flat_width) {
19 intersection() {
8464810c 20 circle(radius);
180a0f6f 21 square([flat_width, radius * 2], center = true); } }
bc02cd24 22
8464810c 23module motor_shaft(radius,
24 flat_width,
180a0f6f 25 shaft_length) {
26 linear_extrude(height = shaft_length) {
27 motor_shaft_flat(radius, flat_width); } }
0d781ab9 28
180a0f6f 29module rim(radius, wall_width, wheel_width) {
30 linear_extrude(height = wheel_width) {
31 difference() {
8464810c 32 circle(radius);
180a0f6f 33 circle(radius - wall_width); } } }
8464810c 34
180a0f6f 35module motor_shaft_holder_flat(radius, flat_width, wall_width) {
36 difference() {
8464810c 37 motor_shaft_flat(radius + wall_width,
38 flat_width + wall_width);
180a0f6f 39 motor_shaft_flat(radius, flat_width); } }
8464810c 40
180a0f6f 41module motor_shaft_holder(radius, flat_width, wall_width, height) {
42 linear_extrude(height = height) {
43 motor_shaft_holder_flat(radius, flat_width, wall_width); } }
8464810c 44
180a0f6f 45module tread(wheel_radius, tread_radius) {
46 rotate_extrude(convexity = 10) {
47 translate([wheel_radius, 0]) {
48 circle(tread_radius); } } }
403f9f0c 49
50module wheel_black(radius,
51 width,
52 shaft_radius,
53 shaft_flat_width,
54 wall_width,
180a0f6f 55 tread_radius) {
56 color("black") {
57 difference() {
403f9f0c 58 rim(radius, wall_width, width);
180a0f6f 59 translate([0, 0, width / 2]) {
60 tread(radius, tread_radius); } }
61 linear_extrude(height = qr_height) {
62 difference() {
8464810c 63 qr_black_flat();
180a0f6f 64 mounting_screw_flat(); } }
65 translate([0, 0, qr_height]) {
8464810c 66 motor_shaft_holder(shaft_radius,
67 shaft_flat_width,
68 wall_width,
180a0f6f 69 width - qr_height); } } }
8464810c 70
180a0f6f 71module wheel_white() {
72 color("white") {
73 linear_extrude(height = qr_height) {
74 difference() {
8464810c 75 qr_white_flat();
180a0f6f 76 mounting_screw_flat(); } } } }
8464810c 77
403f9f0c 78module wheel(radius,
79 width,
80 shaft_radius,
81 shaft_flat_width,
82 wall_width,
180a0f6f 83 tread_radius) {
8464810c 84 wheel_black(radius,
85 width,
86 shaft_radius,
87 shaft_flat_width,
403f9f0c 88 wall_width,
89 tread_radius);
180a0f6f 90 wheel_white(); }
8464810c 91
defb83a5 92module wheel_solid(radius,
93 width,
94 shaft_radius,
95 shaft_flat_width,
96 wall_width,
180a0f6f 97 tread_radius) {
98 difference() {
fd6dae02 99 rim(radius, wall_width * 2, width);
180a0f6f 100 translate([0, 0, width / 2]) {
101 tread(radius, tread_radius); } }
102 linear_extrude(height = qr_height) {
103 difference() {
25c7a966 104 square(qr_size, center = true);
fd6dae02 105 mounting_screw_flat(); } }
180a0f6f 106 translate([0, 0, qr_height]) {
defb83a5 107 motor_shaft_holder(shaft_radius,
108 shaft_flat_width,
109 wall_width,
180a0f6f 110 width - qr_height); } }
defb83a5 111
112/*
8464810c 113wheel(wheel_radius,
114 wheel_width,
115 motor_shaft_radius,
116 motor_shaft_flat_width,
403f9f0c 117 wall_width,
118 tread_radius);
defb83a5 119*/
120
121wheel_solid(wheel_radius,
122 wheel_width,
123 motor_shaft_radius,
124 motor_shaft_flat_width,
125 wall_width,
126 tread_radius);