Magnetic mechanism