hi bob lathe / mill ?
all you need is a helix cycle; if there is a tool with :
... a single row of teeth ( image 01 ), and :
...... through hole, consider a linear-lead-out movement
...... blind hole, consider a radius-lead-out movement, so to achieve a smooth tool disengage from the material
... multiple rows of teeth ( image 02 ) : only radius lead-in and radius lead-out
if pitch<>lead, then you need to phase shift the helix start :
... on a lathe, if the thread is :
...... coaxial with the S axis, than simply change C origin
...... not coaxial with the S axis, than you need to rotate program coordinates ( rebuild the program ), or change Z start
... on a mill, simply use G11 P
each pass requires a helix with a bigger radius
if you wish, repeat the last helix, so to achieve spring passes / kindly