The increasing diversity of products and variants requires a flexible and fast path generation in robot-based painting processes. In the state of the art, path generation in the painting industry is a time consuming and cost-intensive iteration process in which the generated paths are evaluated and optimized via painting trials. In this paper, we present a novel concept for a self-programming painting cell, which is based on the key technologies 3D-scanning, multi-physics painting simulations, and a contactless film thickness measurement using terahertz technology. The core element of this cyber-physical painting system is a unique combination of numerical painting simulations with a gradientbased multi-objective optimization method, to virtually compute painting paths that produce a homogeneous thickness on the painted object. In order to drastically reduce the time and computationally intensive numerical fluid dynamic simulations, a step-by-step coupling of an offline and online simulation was implemented. In a final step, a collision free robot motion without singularities is generated automatically from the computed painting path. The concept was validated under pilot plant conditions by the painting of a fender using an electrostatically assisted high-speed rotary bell atomizer. The paint film thickness, measured with terahertz technology was used as the target and validation criterion, as it shows a strong correlation to other quality values. The results show that the achieved film thickness was within the process specification, although deviations between simulated and measured film thicknesses were found in the edge zones of the workpiece.