To solve the problem of trajectory optimization and connection of painting robot for complex geometry on the free-form surfaces,based on the combined surface of ruled surfaces,a mathematical model of spray gun trajectory optimization was established,meanwhile a kind of algorithm procedure was designed to solve the problem of trajectory connection to spray painting robot on combined surface of ruled surfaces according to the theory of curved surface modeling and intelligent algorithm.Firstly,according to surface character,the ruled surface and the paint gun mathematical model for complex geometry on free-form patches was established.Secondly,the selected juncture between combined surfaces of ruled surface was optimization by the paint gun model.The effectiveness of above model was verified.Based on the model,a algorithm program was devised.The simulation tests verified the validity and feasibility of the trajectory optimization.The continuity spraying of combined surface of ruled surfaces was realized.