In this paper, we present an approach to solving the pipe routing problem that makes use of genetic algorithms (GAs) for optimization and the .dxf format for representation of the obstacle. GAs, a nondeterministic optimization method, is adopted due to its versatile features related to searching global optimal solution. A mathematical programming optimization approach is utilized as it allows the modeling of both the design constraints and objectives. It has been implemented to optimize the total length of the connecting pipes and number of bends while avoiding obstacles. The versatility of the current approach and its ability to accommodate and efficiently solve problems involving 3D freeform obstacles is demonstrated.