This is a replacement case for Milwaukee M12 battery (3 cells type). It uses an original battery cap. The original battery case has very thin walls where two parts of the case are joined. Mine broke in a few places.
First you need to disassembly an original battery to extract cells and the battery cap (the black part of the battery). I used two screwdrivers and a bit of force to do so.
Next you need to print two pieces of the new case. I printed the main case body upside down to minimise the amount of required support. After printing I cleaned hooks in the lower part of the main case using X Acto knife.
Next you should try to insert an empty main case body into the cap to see if it fits perfectly. If not, remove it and use X Acto knife to fix the hooks. You can easily remove the printed case by inserting three small 2x4x25mm rectangular pins into holes in the cap. At this point you can check how your new battery fits your powertool.
When you are comfortable with the fit, remove the main case body from the cap, push cells extracted from the original battery through the case body, close it with a printed base and push everything inside the original cap.
I used 2mm shell and rather thick rigid support to get perfect hooks on the main body.