Skip to content

Conversation

@yegct
Copy link

@yegct yegct commented Jan 30, 2023

@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();
}

@Tecol87
Copy link

Tecol87 commented Aug 22, 2023

@rcolyer
Any comments on this?

@benzvan
Copy link

benzvan commented Feb 23, 2024

I was honestly a little confused at first how to use ScrewHole so I appreciate this feature.

@sbobowski
Copy link

This worked great. to allow multiple clearance holes to be placed in a single part using a loop!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants