I have made one similar in the past with success.
You will need to do some settings to mach3
and to create a special electronic board to transform pulses to analog voltage (find attached).
You have to select 2 outputs (1 for CW start and 1 for CCW start)
Go to "Config" -> "Ports and Pins" -> "Spindle setup"
and UNcheck the "disable spindle relays". Select which output you want for CW and CCW.
At "Motor Control" check "Use spindle motor output" & PWM control, and select 5KHz pulse frequency.
At "General parameters" select how many seconds you need for start & stop ramp. (The system will wait after M3 for your spindle to reach high speed.)
At "config" -> "ports and pins" -> "Motor outputs",
select which output you want for the "step pin" (this is the pulse output).
This pulse output from your pc will be connected to the input of the electronic circuit (J3)
and J4 to the inverter (note the polarity).
(The IC J2 can be any buffer like 74HC244)
The circuit needs 18-20VAC for power supply.
Also go to "config" -> "spindle pulley" and set the maximum rpm you want.
Control the speed by code like: S2000 (this is 2000rpm)
or by using the control in mach screen.
The trimmer on the board is the gain. (Here means to make equal the DRO of rpm with the true speed of the spindle.)
To adjust it, start the inverter from mach and give some speed (eg. 2000rpm), now measure (or watch on the inverter) the true rpm,
and adjust the trimmer to make it equal.
If something is not so clear or not mentioned here, ask for it, we may can help.
John