Motor Control with MPCnC

I assume you mean Vetric Aspire? You would need to edit the post processor for that for starting code and ending code. Just guessing here from the looks of this previous post:

I had an eye-opener scrolling the the Aspire manual. Wow. It can do a lot.

Post Processor Blocks
HEADER
±--------------------------------------------------

  • Commands output at the start of the file
    ±--------------------------------------------------
    begin HEADER
    “Commands”
    The header is the location for the instructions that are output once,
    at the start of the file, these generally setup modal commands for the controller.
    For example, the Header might contain a command to display the filename on the controller and a
    series of “G-Codes” to set the machine up, for instance G20 to tell the control that the moves are in
    inches, or G21 to tell the control that the moves are in millimetres.
    Variables that you might wish to be within the header section,
    could include:
    Information about the Material Block
    Minimum extent in X = [XMIN] Minimum extent in Y = [YMIN] Minimum extent in Z = [ZMIN]
    Maximum extent in X = [XMAX] Maximum extent in Y = [YMAX] Maximum extent in Z = [ZMAX]
    Length of material in X = [XLENGTH]"
    Length of material in Y = [YLENGTH]"
    Depth of material in Z = [ZLENGTH]"
    Home Position Information
    Home X = [XH] Home Y = [YH] H

FOOTER
The footer is the section of the post processor for instructions that are sent to the controller at the
end of a file. These might be instructions to return the tool to the home position, switch the spindle
off or switch the power off to the drives.
±--------------------------------------------------

  • Commands output at the end of the file
    ±--------------------------------------------------
    begin FOOTER
    “Commands”
    Variables that are commonly used include.
    G00 [XH] [YH] [ZH] Rapid to X,Y,Z Home position.
    M05 M Code often used to turn spindle off.
    M30 M Code often used to signify the end of the file

The CNC.js part? You can do a macro in the macro widget. One to start, the other to stop.