I recently posted about a glasses case I had printed and mentioned that I had the idea of creating a rubbery lining using TPU filament. The case has rounded corners and a gentle chamfer round the top and bottom edges so modelling it was more complicated than just measure a box shape. I explored some of the different options for creating what I wanted using OpenSCAD with the BOSL2 library and ended up with two stacked prismoids. Both have the rounding on the vertical edges but the lower one is slightly smaller in the X and Y dimensions, creating the chamfer. There are probably other ways I could have done it too but this worked within the OpenSCAD Playground site I can use online if I have a quiet patch at work.
The downside was that, when I loaded my demo script on my home computer, the rendering seemed to take about 45 seconds. Given that the shape isn’t very complex, that seemed an unusually long time. Time for some troubleshooting.
What I did was go back to some very simple code. Initially I created a prismoid with identical bottom and top dimensions and no other refinements. That was done in a fraction of a second. Making the bottom a little smaller than the top also worked almost as swiftly. The killer, which pushed rendering to over 10 seconds was also rounding the edges. It turned out that the $fs and $fa special variables, which I’d set to 0.1 to give a visually smooth finish to the curve, was the cause. I changed both to 1 and that brought me back to lightning speed and I was then able to return to my original code, which dropped to taking about 1.9s.
Probably those variables could have been raised higher. When I ran the model off, the printed curves were perfectly smooth to the touch. Better yet, the prototype print dropped neatly inside the glasses case with a perfect fit. Time to load up the TPU and see how that does.