Generally if you want close spindle control of an induction motor using a VFD, the VFD encoder option is ordered and a pulse generator or encoder is fitted to the motor shaft.
If you want to close the loop to the controller for synchronous tapping, then usually an encoder is added to the final spindle shaft, and this is used preferably with the above, although you may be able to get results with the final shaft encoder and use a good flux vector VFD.
To control the VFD by Sxxxx value & M3/4/5, you need an analogue output from your controller plus a fwd/rev controller output to the respective inputs on the VFD.
Some VFD's will accept ±10vdc with just a Start input.
Al.