Using with MTConnect

To use the NC.js package for monitoring an MTConnect connection, follow the normal build instructions but build and start the server using the separate "-MT" configurations as below. This starts the server with the MTConnect support.

> npm run make-MT
> npm run start-MT
> npm run start-MT -- -f "path_to_file.stpnc"

Pressing Play on the client will start MTConnect monitoring and engage the simulator.

The MTConnect monitoring code is defined in MTstate.js

Selecting the MTConnect Source

In the config.js file, you will find a "machineList" property that is an array of name/address pairs. Populate this list with the addresses of your MTConnect servers.

"machineList" : [
   { name: 'Okuma', address: 'okuma.steptools.com:5000' }
]

GET on the /v3/nc/state/machines endpoint will return this array.

GET on the /v3/nc/state/machine endpoint will return the index within the array of the MTConnect server that is being monitored. By default the initial element (index '0') is monitored.

GET on the /v3/nc/state/machine/{idx} endpoint will change the server to monitor the MTConnect server at that position in the array.

Getting the MTConnect Status

GET on the /v3/nc/state/mtc endpoint will return an object with the latest information from the server. This object contains the current G-Code block number, speed and feed, and whether the connection is live.

{
  "feedrateUnits":"Millimeters/Second",
  "live":true,
  "spindleSpeed":"0",
  "feedrate":"0",
  "currentGcodeNumber":"2097",
  "baseFeed":-1,
  "optimizedFeed":-1
}