I designed the case in OpenSCAD. It consists of four printed pieces: the main body / battery compartment, a battery compartment cap, a lens holder, and the front bezel. Completing the assembly are the battery holder (purchased), the PCB, and the lens:
The OpenSCAD file has a layout variable that produces an exploded view like above, or a printing layout shown here:
I've printed these parts in both normal PLA and polymax. Normal PLA is too brittle for a flashlight like this that could easily get dropped. ABS would be better, but I'm not set up to print ABS at the moment. This was the first time I have used polymax, which is a kind of enhanced PLA - it prints like PLA (actually far better in my opinion), and is supposed to be more resilient than even ABS. After a few days working with it, I'm completely sold on the concept. It has printed better than any ABS or PLA I've used before, and seems quite strong. It's also much better for minor touch-ups like drilling out holes to the proper diameter than normal PLA. If the polymax were a little cheaper, I'd switch over entirely. With the cost being about 2x normal PLA, I might just use polymax where necessary for strength or for final copies of finished projects.
The screw holes in the bezel and case were designed to use 2-28 3/8" thread-rolling screws, which work very well in the polymax. The holes are deliberately undersized for printing, so that they can be cleanly drilled afterwards. I cleaned out the bezel holes with a succession of 1/16", 3/32", and 5/64" bits, which let the screws fit through without binding. The case holes, which the screws will self-tap, were cleared out with the 1/16", then the mouth of each was widened just slightly with the 3/32" to allow the screw to start.
I printed the first prototype at a 346 micron layer height in normal PLA. With these parameters, the resulting parts has a rough fit. The final versions (two so far) have been printed with 127 micron layers with polymax filament - these parts fit much better.
Here are all the components roughly lined up. The battery compartment case is already attached to the end of the battery holder with a piece of double-stick foam tape.
Here's the detail of the PCB mounting. The lens is designed to press-fit on the LED case. This holds the PCB in the flashlight.