During an initial measurement, the coordinates of an unknown object, for example a robot tool, are determined for the first time. The tool is moved once in the center of the light barrier and the tool data is generated. The tolerance field must be defined for this purpose, in which the tool is allowed to move. Furthermore, the starting point of the measurement must be taught. The robot then moves the tool within the tolerance range and measures itself automatically.