This is a simple 3D printable locking mechanism that I used for my printer enclosure. It consists of 4 3D printable parts. It is advised to glue the slider handle to the slider to prevent it from coming loose during use. As for mounting the cap and the latch, I would recommend using M4 Nuts and Bolts as these were used for my printer enclosure pictured above.
The author marked this model as their own original creation.