When a robot is printing a sequence of non-horizontal goal poses, its joint values often undergo significant variations, resulting in challenges such as singularities or exceeding joint limits. This paper proposes two new methods aimed at optimizing goal poses to solve the problem. The first method, employing an analytical approach, modifies the goal poses to maintain the 4th joint value of a 6-axis industrial robot at zero. This adjustment effectively reduces the motion range of the 5th and 6th axes. The second method utilizes numerical optimization to adjust the goal poses, aiming to minimize the motion range of all joints. Leveraging the analytical method to obtain one good initial value, numerical optimization is subsequently applied to complete the entire path optimization, creating an optimization workflow. It is also possible to use only analytical methods for computational efficiency. The feasibility and effectiveness of these two methods are validated through simulation and real project case.