Abstract Due to the complexity of the right and left tooth surfaces of the straight profile toroidal worm, it is difficult in 3D modeling and NC programming. Based on the equal residual height algorithm, this paper deduces the calculation formula of the cutter contact and cutter point of the tooth surface of the straight profile toroidal worm by using the round nose milling cutter, calculates the cutter point coordinates and rotation angles of each point of the tooth surface of the straight profile toroidal worm through the UG secondary development interface and Visual Studio software, and generates the numerical control code on this basis. The machining simulation and experiment show that the machining efficiency and error of the straight profile torus worm machined by the tool path prepared by the equal residual height method are better than that of the isoparametric method.