A 4D printer for smart materials with magneto- and electro-mechanical properties