Industrial painting automation with robots is very efficient and fast and often used in production lines. However, a big disadvantage is the off-line programming paradigm for the painting robots. This is time-consuming and can be justified economically only for large lot sizes. Hence, a totally new approach to robot programming is required to enable painting of small lot sizes. The objective of the FlexPaint project is to automate robot-programming applications of small lot sizes with a very high number of part variants. This article reports the new approach, referred to as an inverse approach that automatically generates the painting motion. This approach opens new markets for robotic applications. The automatic robot program generation enables, for the first time, painting parts of a lot size of one. The principle of this approach is based on formalizing the technological knowledge in a geometry library and a process library. Laser range sensors are used to obtain an accurate scan of the part. Process-relevant classes of features are detected as specified in the geometry library. Feature classes are linked in the process library to basic paint strategies, which are grouped to automatically generate the robot paint tool trajectory. Finally collisions-free and executable robot motions are automatically obtained for the actual robot kinematics. Painting results for several parts, e.g., different motors with gearboxes, would result with this new approach.