I did this over 20 years ago with a Commodore 64 and a Bergmaster
multiple turret drill press. Of course, that was a *wee* bit
different. You'd have to build an interface card (maybe you can buy
one? -I had to build it back then) and write a device driver, then
write custom software.
A "device driver" is something I did on the C64, although a "device
driver" in that world wasn't anything like it is in Linux, just some
ML code that was called by a C64 BASIC program. The only reason it was
written in assembler was that it had to run faster than a BASIC
program could.
It worked fairly well, but I'm afraid I'm just reminiscing, I can't be
of much help in the modern world.