Skip to content

Instantly share code, notes, and snippets.

@peterwallhead
Created September 25, 2022 05:13
Show Gist options
  • Save peterwallhead/57169ca18682f13a7772322597e08518 to your computer and use it in GitHub Desktop.
Save peterwallhead/57169ca18682f13a7772322597e08518 to your computer and use it in GitHub Desktop.
Use https://openscad.org/ to quickly design and iterate a 3D printable spring.
module springLeaf(height=10, leaf_spacing=10, spring_width=30) {
difference() {
union() {
translate([0,-spring_width,0])
cylinder(h=height, d=leaf_spacing, $fn=36);
translate([-leaf_spacing/2,-spring_width,0])
cube([leaf_spacing,spring_width-(leaf_spacing/2),height]);
}
union() {
translate([-leaf_spacing/4,-spring_width,-1])
cube([leaf_spacing,spring_width-(leaf_spacing/2)+1,height+2]);
translate([0,-spring_width,-1])
cylinder(h=height+2, d=leaf_spacing/2, $fn=36);
}
}
}
module springGenerator(leaves = 1) {
union() {
for(i = [1:leaves]) {
if(i % 2) {
translate([i*(leaf_spacing*0.75),0,0])
springLeaf(spring_height, leaf_spacing, spring_width);
} else {
translate([i*(leaf_spacing*0.75),-spring_width-(leaf_spacing/2),spring_height])
rotate([180,0,0])
springLeaf(spring_height, leaf_spacing, spring_width);
}
}
translate([(leaves*(leaf_spacing*0.75))+(leaf_spacing/4),-spring_width,0])
cube([leaf_spacing/4,spring_width-(leaf_spacing/2),spring_height]);
}
}
spring_height = 10;
spring_width = 30;
leaf_spacing = 10;
leaves = 10;
springGenerator(leaves);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment