I have 3d printed cams with magnets similar to what you have done. They do work just fine after some tweaking.
3d printing has brought modifying our trains to a whole new level. Example: is this Weaver H10 I converted to LEGACY. I ditched the old motor and installed a smaller Diesel motor but I need to reuse the old motor mount. So I designed an adapter plate to fit it.