This magnetic lamp fell off my bandsaw and hit the floor shattering the black peg style switch. I took it apart and modeled a new one for the 3D printer. I had my doubts but it was a near perfect copy and the geometry was pretty simple to do for a beginner.
Kind of complicated, it holds a spring that pushes on a brass rod that rests across the metal contacts on and off depending on the 90 degree position it’s rotated. The clicking on and off sound is the spring riding up the ramps and dropping on its position.