The pipe arrangement has been enabled to be more efficient and economical by recent development of CAD(Computer-Aided Design). However, it is difficult to design a piping layout automatically because of many constraints. We propose an automatic routing method for simple pipes considering both elbows and bends. In practical piping layouts, there are many bends connecting straight eccentric pipes which have gaps within the pipes' diameter. However, no precedence automatic piping algorithm has been taken into account pipelines with such bends. In order to solve the piping design problem including bends, we consider it to a routing problem in a directed and weighted graph. The nodes in the proposed graph have state variables not only locations but directions of the pipe. In addition, the presented method has specifications that sizes of each cell decomposing a design space are not restricted. The efficiency of the proposed method is demonstrated through several experiments.