Selfcorrecting by measurement during machining