Abstract:The limitations of the existing parts detection method were analyzed. According to the characteristics of the part, mechanical, optical and electronic integration program was adopted. The two top clamping mode was used to position the workpiece.The different grating sensors were used to detect data in X/Z directions and around Z direction, and high-precision data acquisition card was used to acquire data, USB interface was used to realize communication between PC and the data acquisition equipment. Taking Windows systems as a platform and LabVIEW graphical programming language as a tool, the software part was designed, the data collected were processed using the least squares method, the part eligibility was determined automatically. Efficient, automated testing of shaft parts meet the testing needs of general machine shop.