| 1 | /* |
| 2 | Copyright (C) 2015 Daniel Watson |
| 3 | See the end of the file for license conditions. |
| 4 | */ |
| 5 | // challenge-bot |
| 6 | // GNU AGPLv3 (or later at your option) |
| 7 | // project available here: |
| 8 | // https://challenge-bot.com/ |
| 9 | |
| 10 | // use $fn = 20 while developing, 100 when about to print |
| 11 | // 20 will make previews fast |
| 12 | // 100 will make printing smooth |
| 13 | $fn = 100; |
| 14 | |
| 15 | wheel_square_spoke_size = 45; |
| 16 | wheel_square_spoke_thickness = 2; |
| 17 | |
| 18 | wall_width = 3; |
| 19 | |
| 20 | wheel_width = 7; |
| 21 | wheel_radius = |
| 22 | sqrt(2 * pow(wheel_square_spoke_size / 2, 2)) + wall_width / 2 + 1; |
| 23 | |
| 24 | motor_shaft_radius = 3.9; |
| 25 | motor_shaft_flat_width = 5.2; |
| 26 | |
| 27 | tread_radius = 4 / 2; |
| 28 | |
| 29 | module mounting_screw_flat() { |
| 30 | circle(1.1); } |
| 31 | |
| 32 | module motor_shaft_flat(radius, flat_width) { |
| 33 | intersection() { |
| 34 | circle(radius); |
| 35 | square([flat_width, radius * 2], center = true); } } |
| 36 | |
| 37 | module motor_shaft(radius, |
| 38 | flat_width, |
| 39 | shaft_length) { |
| 40 | linear_extrude(height = shaft_length) { |
| 41 | motor_shaft_flat(radius, flat_width); } } |
| 42 | |
| 43 | module rim(radius, wall_width, wheel_width) { |
| 44 | linear_extrude(height = wheel_width) { |
| 45 | difference() { |
| 46 | circle(radius); |
| 47 | circle(radius - wall_width); } } } |
| 48 | |
| 49 | module motor_shaft_holder_flat(radius, flat_width, wall_width) { |
| 50 | difference() { |
| 51 | motor_shaft_flat(radius + wall_width, |
| 52 | flat_width + wall_width); |
| 53 | motor_shaft_flat(radius, flat_width); } } |
| 54 | |
| 55 | module motor_shaft_holder(radius, flat_width, wall_width, height) { |
| 56 | linear_extrude(height = height) { |
| 57 | motor_shaft_holder_flat(radius, flat_width, wall_width); } } |
| 58 | |
| 59 | module tread(wheel_radius, tread_radius) { |
| 60 | rotate_extrude(convexity = 10) { |
| 61 | translate([wheel_radius, 0]) { |
| 62 | circle(tread_radius); } } } |
| 63 | |
| 64 | module wheel(radius, |
| 65 | width, |
| 66 | shaft_radius, |
| 67 | shaft_flat_width, |
| 68 | wall_width, |
| 69 | tread_radius) { |
| 70 | difference() { |
| 71 | rim(radius, wall_width * 2, width); |
| 72 | translate([0, 0, width / 2]) { |
| 73 | tread(radius, tread_radius); } } |
| 74 | linear_extrude(height = wheel_square_spoke_thickness) { |
| 75 | difference() { |
| 76 | square(wheel_square_spoke_size, center = true); |
| 77 | mounting_screw_flat(); } } |
| 78 | translate([0, 0, wheel_square_spoke_thickness]) { |
| 79 | motor_shaft_holder(shaft_radius, |
| 80 | shaft_flat_width, |
| 81 | wall_width, |
| 82 | width - wheel_square_spoke_thickness); } } |
| 83 | |
| 84 | /* |
| 85 | This file is part of challenge-bot. |
| 86 | |
| 87 | Challenge-bot is free software: you can redistribute it and/or modify |
| 88 | it under the terms of the GNU Affero General Public License as published by |
| 89 | the Free Software Foundation, either version 3 of the License, or |
| 90 | (at your option) any later version. |
| 91 | |
| 92 | GNU Affero Emacs is distributed in the hope that it will be useful, |
| 93 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 94 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 95 | GNU Affero General Public License for more details. |
| 96 | |
| 97 | You should have received a copy of the GNU Affero General Public License |
| 98 | along with challenge-bot. If not, see <http://www.gnu.org/licenses/>. |
| 99 | */ |