Aiming at the problem that the programming of on-machine measurement in CNC machining process is heavily dependent on operators and the efficiency is lower, a MBD model-driven automatic generation method of on-machine measuring program is proposed. The characteristics of measuring program is analysed and the relationship between the parameters of measuring cycle and the features of MBD model is built. The approach of PMI (product manufacturing information) data identifying and extracting is presented. The scheme for transforming the PMI data and geometric features to measuring cycle parameters is constructed. In order to make the measuring program adapt to the change of probe position which stored in different tool magazine, the way of collecting the position automatically by OPC DA protocol is provided. On the basis of the proposed methods and approaches, an on-machine measuring program generating software system has been developed. The running result of the system is given, and the feasibility and effectiveness of the method were demonstrated.