Skip to content

Instantly share code, notes, and snippets.

@mildsunrise
Last active February 3, 2025 17:23
Show Gist options
  • Save mildsunrise/327a828e59ed97176ab7dbbaabb4d216 to your computer and use it in GitHub Desktop.
Save mildsunrise/327a828e59ed97176ab7dbbaabb4d216 to your computer and use it in GitHub Desktop.
OpenSCAD module for simple gears with round teeth

Simple module that makes gears with circular-shaped teeth. The gears maintain their shape even for extremely low teeth numbers up to 2. Parameters:

  • teeth: number of teeth.
  • step: width of one teeth (diameter of the circle).

Two gears produced with the same step will transfer movement, so one typically fixes a step for all the gears and varies teeth for each gear, which decides the radius and transfer ratio. Example:

$fn = 50;
color("yellow") translate([3.26,0.15]) rotate(90-$t*360/15) gear(15, 1);
color("red") translate([-2.02,-2.9]) rotate(-15+$t*360/4) gear(4, 1);
color("green") translate([-3.02,-5.65]) rotate(-42-$t*360/5) gear(5, 1);

Result

module gear(teeth, step, height=0.2) {
angle = 360/(teeth*2);
radius = (step/2) / sin(angle/2);
apothem = (step/2) / tan(angle/2);
module circles() {
for (i = [1:teeth])
rotate(i * angle * 2) translate([radius,0,0]) circle(step/2);
}
linear_extrude(height) difference() {
union() {
circle(apothem);
circles();
}
rotate(angle) circles();
}
}
@ZoomDomain
Copy link

I just looked on thingiverse for 50 minutes for something like this, for convoluted codes wih 200 variables, 500 lines of duchvontechnik words. mini awesome code!

@TomJansen
Copy link

thank you so much!

@rohitlabina
Copy link

Having white teeth is important because it makes your smile look bright and healthy, boosting your confidence in daily life. Stained or yellow teeth can happen due to coffee, tea, smoking, or poor oral hygiene. Regular teeth whitening helps remove stains and keeps your teeth looking fresh. One easy way to maintain white teeth is by using Colgate Whitening Toothpaste, which helps clean deep stains and gives a long-lasting shine. Good oral care, including brushing twice a day and avoiding foods that stain, can keep your teeth looking their best and improve your overall appearance.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment