Modern 3D scanners can measure the geometry with high accuracy and within a short time. In turn, currently produced CNC machine tools allow for very accurate manufacturing; however, processes beyond the machining cycle remain time-consuming. This paper presents the idea and experimental tests of the scanning system in the CNC machine, which allows to speed up on-machine measurements, align clouds of 3D data points with an accuracy close to that of the machine itself, and finally set the workpiece coordinate system for machining. This modern approach is in line with Industry 4.0, combining the terms of data processing, machine vision, manufacturing automation, and human-machine interfaces. The future implementation of the proposed system as an interchangeable tool will allow performing autonomous measurements, inspection, and supervision of the workspace, without engaging the machine operator. The system calibration and experimental results using the industrial 3D scanner and CNC machine are described.