Skip to content

Instantly share code, notes, and snippets.

@nezuppo
Last active October 10, 2020 14:08
Show Gist options
  • Save nezuppo/399ccbb7767d4c52ffcec660c4c53f60 to your computer and use it in GitHub Desktop.
Save nezuppo/399ccbb7767d4c52ffcec660c4c53f60 to your computer and use it in GitHub Desktop.
// download Nut_job.scad from https://www.thingiverse.com/thing:193647
use <Nut_job.scad>
module for_nut_hole(hg, sth, clf, cod, crs) {
intersection() {
union() {
hex_countersink_ends(sth/2,cod,clf,crs,hg);
screw_thread(cod,sth,clf,hg,crs,-2);
}
translate([-cod / 2, -cod / 2])
cube([cod, cod, hg]);
}
}
module example() {
//Height of the nut
nut_height = 6;
//Outer diameter of the bolt thread to match (usually set about 1mm larger than bolt diameter to allow easy fit - adjust to personal preferences)
nut_thread_outer_diameter = 9;
//Thread step or Pitch (2mm works well for most applications ref. ISO262: M3=0.5,M4=0.7,M5=0.8,M6=1,M8=1.25,M10=1.5)
nut_thread_step = 2;
//Step shape degrees (45 degrees is optimised for most printers ref. ISO262: 30 degrees)
nut_step_shape_degrees = 45;
//Resolution (lower values for higher resolution, but may slow rendering)
resolution = 0.5;
nut_resolution = resolution;
difference() {
// ネジ穴を開けたい 3D オブジェクト
cube([10, 10, 10]);
// ネジ穴
translate([5, 5, 10 - nut_height])
for_nut_hole(nut_height, nut_thread_step, nut_step_shape_degrees,
nut_thread_outer_diameter, nut_resolution);
}
}
example();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment