Watch the motion of your 3D printer's extruder, Star Wars style. Embed a 6mm X 2mm tall magnet while printing, multi-colored as well with a single extruder (swap mid-print).
I used .1mm layers, since I wanted this to be a small part that could be held by a single 6mm magnet, only 2mm tall.
Just insert a M600 command (or change filament) after the first 0.2mm to swap from grey to black (or your choice of colors), and then again just before the last 0.3mm, to insert the magnet; I just re-inserted the black filament at this point, instead of swapping colors for a part that wouldn't be seen when in use.
Version 2 added with extra detail.
The author hasn't provided the model origin yet.