Overview

The CtlEvent enumeration identifies the process conditions encountered by a Adaptive. The zero value indicates that the traversal is complete, and other values indicate a normal position change, the starting or ending of various process elements, or an error.

Use the SetWanted() function to request that a cursor stop at particular events. The cursor Next() function returns an event value, and Event() returns the most recent event.

The Print Workingsteps sample program shows how to select certain events when traversing a process. This type shadows the matching C++ enum in the STEP-NC Control Library.

The node version of this enum is a read-only object with fields for each enumerator value. Each field holds the correct numeric value. Use the "CtlEvent" property exported from the module.

CtlEvent Definition

enum CtlEvent { 		exports.CtlEvent = {  
    DONE =  0,				    DONE:  0,
    ERROR = 1,				    ERROR: 1,
    MOVE =  2,				    MOVE:  2, 
    TOOL_CHANGE,			    TOOL_CHANGE: 	…,
    PROJECT_START,			    PROJECT_START: 	…,
    PROJECT_END,			    PROJECT_END: 	…,
    SETUP_START,			    SETUP_START: 	…,
    SETUP_END,				    SETUP_END: 		…,
    EXEC_WORKPLAN_START,		    EXEC_WORKPLAN_START: …,
    EXEC_WORKPLAN_NEXT,			    EXEC_WORKPLAN_NEXT: …,
    EXEC_WORKPLAN_END,			    EXEC_WORKPLAN_END: 	…,
    EXEC_SELECT_START,			    EXEC_SELECT_START: 	…,
    EXEC_SELECT_NEXT,			    EXEC_SELECT_NEXT: 	…,
    EXEC_SELECT_END,			    EXEC_SELECT_END: 	…,
    EXEC_WORKSTEP_START,		    EXEC_WORKSTEP_START: …,
    EXEC_WORKSTEP_END,			    EXEC_WORKSTEP_END: 	…,
    EXEC_OTHER_START,			    EXEC_OTHER_START: 	…,
    EXEC_OTHER_END,			    EXEC_OTHER_END: 	…,
    EXEC_NCFUN,				    EXEC_NCFUN: 	…,
    OPERATION_START,			    OPERATION_START: 	…,
    OPERATION_NEXTPATH,			    OPERATION_NEXTPATH: …,
    OPERATION_END,			    OPERATION_END: 	…,
    TOOLPATH_START,			    TOOLPATH_START: 	…,
    TOOLPATH_END,			    TOOLPATH_END: 	…,
    CURVE_START,			    CURVE_START: 	…,
    CURVE_END,				    CURVE_END: 		…,
    LAST_EVENT				    LAST_EVENT: 	…
};					};

Event Details

There are events for many different types of object. When Next() returns an event, that particular type of object will be at the top of the process stack. The START/END events are returned before and after the contents of an object are processed.

By default, the cursor will only visit executables that are enabled, and at most one element of a selective. No START/END events are returned for the skipped items. Set the cursor to visit all execs if you need to see events for all items.

DONE
Zero value that indicates that the cursor has finished traversing. This event is always generated.
ERROR
Something has gone wrong and a description of the error is available in errorMsg(). The offending process element will be popped from the stack.
MOVE
The tool position has changed. This event is the only one selected by default, and is returned for each waypoint on a toolpath. Check GetActiveType() to see if the element on the top of the stack is a linear move, an arc move, or a helix move.
TOOL_CHANGE
The tool has changed. This event is issued before the OPERATION_START event only when an operation requests a tool that is different from the last one seen. Call GetActiveTool() for the new tool object.

The cursor may pass through workplans, functions, and other things that do not explicitly call for a tool, so the active tool is the last tool requested, even if the cursor is not currently in the middle of an operation.

If the tool changes as a result of the Load Tool or Unload Tool NC functions, the change event occurs after the EXEC_NCFUN event.

PROJECT_START / END
Marks the beginning and completion of a STEP-NC project. A file may only contain one project. The project is assigned to the cursor with startProject() and is always available via the GetActiveProject() function. Between these START and END events, the main workplan is pushed on the stack and processed.
SETUP_START / END
Marks the beginning and completion of a setup. These events are only issued for a workplan that contains a setup description. The workplan is on the top of the stack and available via the GetActiveWorkplan() function. These START and END events wrap the normal workplan start and end events described below.
EXEC_WORKPLAN_START / END
Marks the beginning and completion of workplan processing. These events issued for every workplan. The workplan is on the top of the stack and available via the GetActiveWorkplan() function. Between these START and END events, each element of the workplan is pushed on the stack and processed in sequential order.
EXEC_WORKPLAN_NEXT
Marks the move to a body element in the workplan sequence. The new body element is on the top of the stack but has not been examined yet. The workplan is one stack frame above. The parameter value in the workplan stack frame holds the sequence number of the element. Popping the stack will skip the element.
EXEC_SELECT_START / END
Marks the beginning and completion of a selective. The selective is on the top of the stack and available via the GetActiveExec() function. Between these START and END events, one element of the selective is chosen an pushed on the stack to be processed. The cursor will choose the first enabled executable that it encounters. If the cursor is set to visit all execs, it will iterate over all elements and visit each.
EXEC_SELECT_NEXT
Marks the move to a body element in the selective. The new body element is on the top of the stack but has not been examined yet. The selective is one stack frame above. The parameter value in the selective stack frame holds the sequence number of the element. Popping the stack will skip the element.
EXEC_WORKSTEP_START / END
Marks the beginning and completion of workingstep processing. The workingstep is on the top of the stack and available via the GetActiveWorkingstep() function. Between these START and END events, the operation of the workingstep is pushed on the stack and processed.
EXEC_OTHER_START / END
Marks the beginning and completion of some other type of executable. The executable is on the top of the stack and available via the GetActiveExec() function. Nothing is done by the cursor between the START and END events, but an application can use these to implement control flow for if/then, while loops, or parallel segments.
EXEC_NCFUN
Marks the arrival at an NC function element. The NC Function is on the top of the stack and available via the GetActiveExec() function. When a Load Tool or Unload Tool function is seen, the EXEC_NCFUN event will be followed by a TOOL_CHANGE event.
OPERATION_START / END
Marks the beginning and completion of operation processing. The operation is on the top of the stack and available via the GetActiveOperation() function. Between these START and END events, each toolpath associated with the operation is pushed on the stack and processed in sequential order.
OPERATION_NEXTPATH
Marks the move to a new toolpath in the operation. The new body element is on the top of the stack but has not been examined yet. The operation is one stack frame above. The parameter value in the operation stack frame holds the sequence number of the toolpath. Popping the stack will skip the path.
TOOLPATH_START / END
Marks the beginning and completion of an individual toolpath. The toolpath is on the top of the stack and available via the GetActiveToolpath() function. Between these START and END events, the toolpath curve is pushed on the stack and processed.
CURVE_START / END
Marks the beginning and completion of an individual toolpath curve. The stack frame on the top of the stack contains pointers to the separate curves for the toolpath basis (space curve), axis direction (tool axis), reference direction (x-axis for oriented non-rotating tools), surface normal, speed override ratio, and cross section parameters.

If the toolpath uses composite curves, the process stack may contain nested curves. The parameter value in the stack frame gives the location on the curve. Between these START and END events, the curve parameter is incremented over the full range of values and the matching position on the toolpath is pushed on the stack and processed to give MOVE events.

LAST_EVENT
Not an actual event. Marker testing whether a numeric value is in the range of known events.