The automatic generation of flow path is the key and most difficult task in Hydraulic Manifold Blocks (HMB) design. This paper divides the HMB layout space into grids, and sets the HMB boundaries and existing flow paths to obstacles, and the paths generated using maze algorithm are regarded as the initial population of genetic algorithm. The optimal path with the shortest path and least turnings can be obtained using genetic algorithm. The ports of flow path can be connected after the generation of technical holes based on the blind holes. The design parameters of holes, such as starting point coordinates, orientations and depths, can be obtained through a series of algorithms, and then drive the secondary development system HMBDesigner based on SolidWorks to generate three-dimensional solid model. This paper also discusses the generation method of multi-port flow path and multiple flow paths.