The current version of the REST API is v3, and all endpoints can
currently be found grouped under the /v3/nc/
path. The
main concepts are as below:
/v3/nc/geometry
- Shell geometry used by the machining process/v3/nc/id
- Find EID number from UUID/v3/nc/project
- Name for the machining process/v3/nc/state
- Material removal state for the machining process/v3/nc/workplan
- Machining process, workplans and individual operations/v3/nc/setup
- ID of enclosing workplan with setup transform/v3/nc/tolerances
- Tolerances applied to the digital thread model/v3/nc/tool
- Test if tool is enabled/v3/nc/tools
- Find all tools or tool used by a workingstep/v3/nc/workpieces
- Basic information about all workpieces in the digital thread modelThese API endpoints return JSON objects describing 3D geometry and simulation state, machining process, workpieces, tolerances, and cutting tools.
Custom Apps may need new endpoints for value-added operations.
These should be placed under /v3/custom
to keep them
separate from the baseline endpoints.
At startup, the client opens a websocket on the server and listens for notifications. The server emits the following notifications
nc:delta
- Issued when the machine tool
position changes or material removal occurs. The argument is
a delta state object
nc:feed
- Issued every time the
machine tool feedrate changes. The argument is the numeric value of
the new feed.
nc:mtc
(MTstate.js)
nc:probe
nc:qifLoad
- Issued when a QIF file is
loaded and applied to the tolerances in the digital thread model. See
the qif load endpoint for
discussion.nc:speed
- Issued whenever the simulation
speed slider is changed. The argument is the new numeric value for
the speed factor. See the state loop
endpoint for more information.nc:spindle
- Issued every time the
machine tool spindle speed changes. The argument is the numeric value
of the new spindle speed. Defined in state.js.
nc:state
- Issued whenever the simulation
loop starts or stops. the argument is the string "play" when the loop
has started, and "pause" when the loop has stopped.
Upon inital connection to the server, the server will send the packaged client javascript to the browser. This client will then establishes a websocket connection back to the server to listen for the server events described above.
The first action of the client is to GET /v3/nc/state/key, and receive a key state object that describes the initial position of everything in the digital thread model. The client will parse the key state and executes the ApplyDelta logic described below. (Code in data_loader.js
Whenever the tool moves, the server will send
an nc:delta
event over the websocket, with
a delta state object that
describes the new dynamic shell and the positions of everything. The
client will parse the delta state and executes the ApplyDelta logic
described below. Code in cad_manager.js
Other events are occasionally generated, and the client responds by updating the responsive view with new feed rates, spindle speeds, speed slider position, play/pause button, etc.
On receipt of a KeyState or DeltaState, the client invokes the applyDelta function in nc.js