makcnc,
I would suggest that you a have a read of the Mach manuals and watch the videos to become more
familar with how Mach works. Also there are many sources of info on gcode.
To write a plug in or macro requires a good understanding of the above and knowledge of what you
want to accomplish.
RICH