5

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: enter image description here

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: enter image description here

But, if I have the hole shape stick out 0.000005 mm on either side, it renders just fine! enter image description here

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.

D. Patrick
  • 165
  • 6

1 Answers1

4

openSCAD simply allows having surface solutions that result in a wall of 0 thickness. The walls appear to clip in those areas and can at times be seen from both sides, like in your example:

a 0 thickness wall clipping

A 0 thickness wall is also exportable into an STL as a set of triangles spun up by vertices that are in each other's plane but have inverted normal vectors for the two sides - which means that the construct exists for the computer - and I have used this in 3D designs for a hologram-effect, even if it does not result in a physically possible property set.

An example of that effect is this cube (made in blender), that has the back wall purple, all others are grey - and the internal wall is at the same X-value as the back wall. You see the grey wall clipping despite the normal of it pointing to +X while the normal of the purple wall is into -X.

enter image description here

By having your cookie-cutter extrude not just to but through the back wall, you force a solution that disallows the 0-surface solution and thus solves the problem of creating those artifact walls.

Note that the 0-surface wall persists in the slicer preview:

enter image description here enter image description here

But rest assured: almost all slicers ignore walls that are too thin to be printed, and a 0 thickness wall especially is ignored:

enter image description here

Trish
  • 22,760
  • 13
  • 53
  • 106