Machining residual stresses and part distortions