threads-scad
threads-scad copied to clipboard
Allow ScrewHole to be called without children
@rcolyer,
A small change allowing ScrewHole to be called without children.
This does not affect any existing use. This allows me to generate multiple screw holes in a module and subsequently difference()
the entire union, leading to cleaner code. Imagine, a module that generates a pattern of three holes, which we reuse across multiple objects.
// Preexisting functionality, unchanged
ScrewHole(5, 10)
cylinder(h=10,d=10);
// New functionality
translate([10,0,0])
ScrewHole(5, 10);
// More complicated new functionality showing
// hole generation in a method
module many_holes() {
union() {
translate([-10,5,0])
ScrewHole(5,10);
translate([+10,5,0])
ScrewHole(5,10);
translate([0,-10,0])
ScrewHole(5,10);
}
}
difference() {
cylinder(h=10,d=30);
many_holes();
}
translate([40,0,0])
difference() {
cube([30,30,20], center=true);
many_holes();
}
@rcolyer Any comments on this?
I was honestly a little confused at first how to use ScrewHole so I appreciate this feature.
This worked great. to allow multiple clearance holes to be placed in a single part using a loop!