ABSTRACT This paper presents a novel approach for optimizing the contour path of fused deposition 3D printing slices to mitigate the limitations of inefficiency and time consumption associated with the process. The proposed algorithm leverages the Hopfield Neural Network (HNN) and an improved whale optimization algorithm to plan the printing order of each contour and optimize the network parameters, respectively. In particular, the algorithm transforms the running trajectory planning problem of the assembled tool head into a travel problem, which allows for a more efficient path planning approach. The HNN is then employed to determine the optimal path for each contour, with the network optimization process utilizing a nonlinear weight update method to overcome the drawbacks of the traditional HNN that is prone to generating invalid paths and falling into local optimality during operation. The network optimization process is designed to automatically adjust the link weights between neurons within a specific range, thereby ensuring that the network reaches the desired energy minima and outputs the optimal path for 3D printed slice contours. The proposed algorithm was tested in part printing experiments, and the results demonstrated a significant reduction in single-layer contour path lengths, printing times, and an enhancement in dimensional accuracy and surface quality of the printed parts compared to the traditional parallel scanning method. The proposed algorithm represents a significant contribution to the field of 3D printing, as it provides an efficient and effective approach for optimizing the contour path of fused deposition 3D printing slices. The findings of this study hold significant implications for improving the efficiency and quality of 3D printing and could potentially lead to further advancements in the field.