Abstract. The precision machining of shaft parts is of great significance in the fields of aerospace, automobile manufacturing and so on. For important high precision shaft parts processing, especially in the beginning of mass production, it is easy to produce single piece of waste. Aiming at the error compensation problem of single shaft part, this paper proposes that after the semi-finishing, the dimensional accuracy of the workpiece is tested by the trigger probe, based on the measurement result, the least squares mathematical model of machining error is established, through the CNC macro program, in accordance with the cutting position,the error is compensated in the finishing stage.Therefore, single shaft part on-line detection, error compensation, precision evaluation are integrated into one,which is good to improve its processing efficiency,processing conditions, and the quality of processing. Experiments show that this method can reduce the limit error by about 52.5%.