First, an operator sequentially teaches the start point A, the end point F
and junction points B, C, D, E on the welding path by moving the torch
head by jog feed without paying attention to the torch orientation. Next,
a reference plane to define the orientation of the torch is specified,
and an inclination angle and a forward angle representing the torch
orientation be inputted into a robot controller. On the basis of these
inputted angle data and the taught data, a basic welding orientation is
automatically calculated. Further auxiliary points are set around the
junction points B through E each forming corner parts connecting straight
lines; tool vectors which may give a smooth torch orientation change
through the corner parts are automatically calculated for the auxiliary
points and the junction points; and on the basis of the results, a
welding program is produced. Among elements which determine the torch
orientation, an element relating to the rotation around the torch axis
reflects the state at the time of teaching of points A to E.