Electromagnets for lifting, handling or transporting of magnetic pieces or material