Production of electric machines