Created
February 16, 2015 04:46
-
-
Save hyperair/c904b89618f7d6883d70 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| use <MCAD/gears/rack_and_pinion.scad> | |
| include <MCAD/units/metric.scad> | |
| $fs = 0.4; | |
| $fa = 1; | |
| N = 10; | |
| cp = 5; | |
| pitch_perimeter = cp * N; | |
| pitch_radius = pitch_perimeter / 2 / PI; | |
| addendum = 1.0 * cp / PI; | |
| dedendum = 1.1 * cp / PI; | |
| function get_fragments_from_r (r) = ( | |
| (r < 0.00000095367431640625) ? 3 : | |
| ceil (max (min (360 / $fa, r * 2 * PI / $fs), 5)) | |
| ); | |
| rack_length = cp; | |
| module our_rack () | |
| rack (cp = cp, N = 2, width = 10 + epsilon * 4, thickness = 10); | |
| linear_extrude (height = 10) | |
| difference () { | |
| circle (r = pitch_radius + addendum); | |
| union () | |
| for (t = [0:1/get_fragments_from_r (pitch_radius):1.01]) { | |
| rotate (t * 360, Z) | |
| translate ([ | |
| -rack_length / 2 + (pitch_perimeter * t) % rack_length, | |
| 5 + dedendum + pitch_radius | |
| ]) | |
| projection () | |
| our_rack (); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment