It can be accomplished via Mach3 using VisualBasic (M codes). Take a look at this thread for some hints ...
Mach Support forum Page two of posts.
As I have read the Rex has digital and analog i/o.
Is it possible to program some logic for this i/o and is this done in the Rex or via some software like Mach 3.