The layout of hydraulic pipelines is an important step in the design of a hydraulic system.For machine tools which have a complicated assembly model, manual routing takes a lot of time. But there still exist some problems in the automatic routing module in three-dimensional design software. Those modules are not universal and the shapes are nonintuitive. Besides, the system are not easy to operate. To solve those problems, a 3D Automatic system for hydraulic pipelines on machine tools is developed. By using SolidWorks platform and VB.NET environment, the parametric design for models of pipeline spare parts is implemented based on secondary development principles and database technology. The intelligence layout for pipelines is implemented by using dynamic programming method and A-Star algorithm. Besides, a table is provided in the program to present the data for length of pipelines. The program is easy to operate, which effectively decrease workload for designing and shorten the design cycle.