Hinged Box With Latch, Somewhat Parametric and Printable In One Piece

I searched the Thingiverse for a simple hinged box that was parametric and printed all in one piece. I couldn’t find one. I did find some really neat parametric boxes and lids though. I used none of their OpenSCAD code for this. I’ve printed probably a dozen one piece boxes with hinge during my testing. I wanted a tight hinge that would reliably print and NOT fuse together. During my testing I experimented with different speeds, temps, and tolerance values in my SCAD files. The attached OpenSCAD files prints reliably on my printer. The resulting hinge is a bit loose but it reliably does not fuse. Changing the tolerance by .1 does make a much tighter hinge, but sometimes I could not break it free. YMMV.”