| 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 | wheel_square_spoke_size = 45; |
| 13 | wheel_square_spoke_thickness = 2; |
| 14 | |
| 15 | wall_width = 3; |
| 16 | |
| 17 | wheel_width = 9; |
| 18 | wheel_radius = sqrt(2 * pow(wheel_square_spoke_size / 2, 2)) + wall_width / 2; |
| 19 | |
| 20 | motor_shaft_radius = 3.7; |
| 21 | motor_shaft_flat_width = 4.8; |
| 22 | |
| 23 | tread_radius = 4 / 2; |
| 24 | |
| 25 | module mounting_screw_flat() { |
| 26 | circle(0.9); } |
| 27 | |
| 28 | module motor_shaft_flat(radius, flat_width) { |
| 29 | intersection() { |
| 30 | circle(radius); |
| 31 | square([flat_width, radius * 2], center = true); } } |
| 32 | |
| 33 | module motor_shaft(radius, |
| 34 | flat_width, |
| 35 | shaft_length) { |
| 36 | linear_extrude(height = shaft_length) { |
| 37 | motor_shaft_flat(radius, flat_width); } } |
| 38 | |
| 39 | module rim(radius, wall_width, wheel_width) { |
| 40 | linear_extrude(height = wheel_width) { |
| 41 | difference() { |
| 42 | circle(radius); |
| 43 | circle(radius - wall_width); } } } |
| 44 | |
| 45 | module motor_shaft_holder_flat(radius, flat_width, wall_width) { |
| 46 | difference() { |
| 47 | motor_shaft_flat(radius + wall_width, |
| 48 | flat_width + wall_width); |
| 49 | motor_shaft_flat(radius, flat_width); } } |
| 50 | |
| 51 | module motor_shaft_holder(radius, flat_width, wall_width, height) { |
| 52 | linear_extrude(height = height) { |
| 53 | motor_shaft_holder_flat(radius, flat_width, wall_width); } } |
| 54 | |
| 55 | module tread(wheel_radius, tread_radius) { |
| 56 | rotate_extrude(convexity = 10) { |
| 57 | translate([wheel_radius, 0]) { |
| 58 | circle(tread_radius); } } } |
| 59 | |
| 60 | module wheel(radius, |
| 61 | width, |
| 62 | shaft_radius, |
| 63 | shaft_flat_width, |
| 64 | wall_width, |
| 65 | tread_radius) { |
| 66 | difference() { |
| 67 | rim(radius, wall_width * 2, width); |
| 68 | translate([0, 0, width / 2]) { |
| 69 | tread(radius, tread_radius); } } |
| 70 | linear_extrude(height = wheel_square_spoke_thickness) { |
| 71 | difference() { |
| 72 | square(wheel_square_spoke_size, center = true); |
| 73 | mounting_screw_flat(); } } |
| 74 | translate([0, 0, wheel_square_spoke_thickness]) { |
| 75 | motor_shaft_holder(shaft_radius, |
| 76 | shaft_flat_width, |
| 77 | wall_width, |
| 78 | width - wheel_square_spoke_thickness); } } |