I'm trying to make a frame for a lithograph that I plan to 3D print for my wife for Mother's Day. I typically will have my differences be exactly the right size (rather than oversizing it for the sake of the preview) because it gives me a good feel for how accurate my math is (particularly when I'm accounting for the horizontal margin created by the compressed filament coming out of the nozzle).
In this case, however, it came back to bite me. I debugged this issue for quite a while assuming I had miscalculated something or that I had confused my order of rotations somehow.
Eventually, I oversized my cutout and sure enough, the holes appeared correctly. After poking at it, I realized I only need 0.000005 mm
on either side of my cutout for it to render correctly!
I've created a minimal reproducible example of my issue here:
outerRadius = 100;
height = 40;
wallWidth = 2;
innerRadius = outerRadius - wallWidth / sin(60);
apothem = innerRadius * cos(180 / 6);
// change this to 0 and see what happens!!
holeSizeCorrection = 0.00001;
module holes() {
for (face = [0:5]) {
rotate([0, 0, face * 60 + 30])
translate([apothem - holeSizeCorrection / 2, 0, height / 2])
rotate([0, 90, 0])
cylinder(h = wallWidth + holeSizeCorrection, r = height / 4, $fn = 4);
}
}
color("orange") difference() {
$fn = 6;
cylinder(h = height, r = outerRadius);
translate([0, 0, -height/4]) // because if it's exactly right, you can't see inside
cylinder(h = height * 2, r = innerRadius);
color("blue") holes();
}
When the holes I'm trying to cut in the polygon are exactly the width of the wall, it renders the preview correctly but the rendered output is incorrect. To verify that the shape was correct, I moved the holes out of the difference and it looks like this:
The preview (aside from the strange exact cut issue that usually happens) is correct as well. But, when I render it, it looks like this:
But, if I have the hole shape stick out 0.000005 mm
on either side, it renders just fine!
Now that I know to look for this kind of thing, it'll probably save me debugging time in the future. :) But, it would be nice to know if I've done something wrong as well.