Engineering Magnetic Anisotropy In Nanostructured 3D And 4F Ferromagnets