Parametric Enclosure with Lid

I was learning OpenSCAD and wanted to make an enclosure for an electronics project. Rather than create a box each time I thought it would make more sense to have a “library” file which could create the box I needed and be re-usable. This box could also be printed as-is to hold nearly anything. It will make a square-edged box, one with radiused corners, or a stylized version with two rounded and two squared corners opposing. It will optionally create vent holes; either round holes or square. A note about the $fn=200; parameter. This will greatly smooth all radiused surfaces. It will also kill your processor. My poor i7-4800MQ takes about 30 minutes to render the circular holed option when this is enabled. I highly suggest you leave it commented until you are ready to export your final .STL. Final thought: This renders properly but does not seem to like to preview. I’ve seen this a lot. If anyone knows why that is; I’m all ears.”

Link