Obtaining a uniform and continuous winding pattern for non-axisymmetric mandrel using current filament winding techniques is still a challenge. In this study, an algorithm was developed to generate winding pattern for axisymmetric and non-axisymmetric mandrels. Firstly, the mandrel surface is divided into uniform quadrilaterals, and the centerline of the mandrel is extracted according to the vertices of the quadrilaterals. Then, based on the centerline, the mandrel is divided into multiple intervals. Combined with the stability analysis of the winding path on the triangular facets, a series of non-slippage winding paths are generated within the intervals. Finally, the non-slippage winding paths are adaptively adjusted, and a uniform winding pattern is generated for the mandrel through iteration. The simulation results demonstrate that the generated paths pass through uniform points on the same cross-section, ensuring the uniformity of the winding pattern. The winding paths realize free rotation at the ends of the mandrel, ensuring the continuity of the winding pattern. And the proposed method can be applied to various types of non-axisymmetric mandrels, overcoming the limitation of previous methods which can only generate winding patterns when the mandrel surface is represented by mathematical equations.