Skip to content

Instantly share code, notes, and snippets.

@davidsharp
Last active October 26, 2025 13:35
Show Gist options
  • Select an option

  • Save davidsharp/e1da5ec8487dd33fe7a3df780d9751ec to your computer and use it in GitHub Desktop.

Select an option

Save davidsharp/e1da5ec8487dd33fe7a3df780d9751ec to your computer and use it in GitHub Desktop.

Revisions

  1. davidsharp revised this gist Oct 26, 2025. 1 changed file with 7 additions and 5 deletions.
    12 changes: 7 additions & 5 deletions jack-o-lantern-mouth-happy-accident.scad
    Original file line number Diff line number Diff line change
    @@ -8,25 +8,27 @@ module smile(){
    circle(radius+15);
    }
    }
    module teeth(top,bot,sides=3){
    module teeth(top,bot,top_gap=8,bot_gap=10,sides=3){
    tooth_rot = sides == 4 ? 45 : 90;
    top_offset = top % 2 == 0 ? 0.5 : 0;
    bot_offset = bot % 2 == 0 ? 0.5 : 0;
    for(i=[0:1:top-1]){
    translate([0,40,0])
    rotate([0,0,180+(i*top*8)-(top*8)])
    rotate([0,0,180+((i+top_offset-1)*top*top_gap)])
    translate([0,radius+15,0])
    rotate([0,0,tooth_rot])
    circle(8,$fn=sides);
    }
    for(i=[0:1:bot-1]){
    rotate([0,0,180+(i*bot*8)-(bot*8)])
    rotate([0,0,180+((i+bot_offset-1)*bot*bot_gap)])
    translate([0,radius,0])
    rotate([0,0,tooth_rot+180])
    circle(5,$fn=sides);
    circle(6,$fn=sides);
    }
    }

    linear_extrude(3)
    difference(){
    smile();
    teeth(3,3,3);
    teeth(3,2,8,15,3);
    }
  2. davidsharp revised this gist Oct 26, 2025. 1 changed file with 3 additions and 5 deletions.
    8 changes: 3 additions & 5 deletions jack-o-lantern-mouth-happy-accident.scad
    Original file line number Diff line number Diff line change
    @@ -10,14 +10,14 @@ module smile(){
    }
    module teeth(top,bot,sides=3){
    tooth_rot = sides == 4 ? 45 : 90;
    for(i=[0:1:top]){
    for(i=[0:1:top-1]){
    translate([0,40,0])
    rotate([0,0,180+(i*top*8)-(top*8)])
    translate([0,radius+15,0])
    rotate([0,0,tooth_rot])
    circle(8,$fn=sides);
    }
    for(i=[0:1:bot]){
    for(i=[0:1:bot-1]){
    rotate([0,0,180+(i*bot*8)-(bot*8)])
    translate([0,radius,0])
    rotate([0,0,tooth_rot+180])
    @@ -28,7 +28,5 @@ module teeth(top,bot,sides=3){
    linear_extrude(3)
    difference(){
    smile();
    teeth(2,2,3);
    teeth(3,3,3);
    }

    // wrong, but kinda works in this instance, lol
  3. davidsharp created this gist Oct 26, 2025.
    34 changes: 34 additions & 0 deletions jack-o-lantern-mouth-happy-accident.scad
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,34 @@
    radius = 50;

    module smile(){
    difference(){
    translate([0, 0, 0])
    circle(radius);
    translate([0, 40, 0])
    circle(radius+15);
    }
    }
    module teeth(top,bot,sides=3){
    tooth_rot = sides == 4 ? 45 : 90;
    for(i=[0:1:top]){
    translate([0,40,0])
    rotate([0,0,180+(i*top*8)-(top*8)])
    translate([0,radius+15,0])
    rotate([0,0,tooth_rot])
    circle(8,$fn=sides);
    }
    for(i=[0:1:bot]){
    rotate([0,0,180+(i*bot*8)-(bot*8)])
    translate([0,radius,0])
    rotate([0,0,tooth_rot+180])
    circle(5,$fn=sides);
    }
    }

    linear_extrude(3)
    difference(){
    smile();
    teeth(2,2,3);
    }

    // wrong, but kinda works in this instance, lol