Skip to content

Instantly share code, notes, and snippets.

@hikalium
Created April 25, 2025 16:42
Show Gist options
  • Save hikalium/829cf2e4e32a8562c1c1014cefbe7808 to your computer and use it in GitHub Desktop.
Save hikalium/829cf2e4e32a8562c1c1014cefbe7808 to your computer and use it in GitHub Desktop.
$fs=$preview ? 1 : 0.1; // Don't generate smaller facets than 0.1 mm
$fa=$preview ? 15 : 5; // Don't generate larger angles than 5 degrees
screw_height = 20;
screw_radius = 10;
screw_pos_neg_offset = 1;
screw_pos_neg_ratio = (screw_pos_neg_offset + screw_radius) / screw_radius;
module bolt() {
linear_extrude(
height = screw_height,
twist = screw_height * 20,
slices = screw_height * 5
) {
circle(r=screw_radius, $fn=6);
}
}
module nut() {
difference() {
linear_extrude(height = screw_height) {
circle(r=screw_radius * 1.5, $fn=6);
}
scale([screw_pos_neg_ratio, screw_pos_neg_ratio, 1]) bolt();
}
}
bolt();
color("#ffff0022") nut();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment