Overview
The CtlEvent enumeration identifies the process conditions encountered by the Adaptive cursor. 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. The set_wanted() function controls what events the cursor will stop at when calling next().
CtlEvent Definition
class CtlEvent(IntEnum): DONE = 0 ERROR MOVE TOOL_CHANGE PROJECT_START PROJECT_END SETUP_START SETUP_END EXEC_WORKPLAN_START EXEC_WORKPLAN_NEXT EXEC_WORKPLAN_END EXEC_SELECT_START EXEC_SELECT_NEXT EXEC_SELECT_END EXEC_WORKSTEP_START EXEC_WORKSTEP_END EXEC_OTHER_START EXEC_OTHER_END EXEC_NCFUN OPERATION_START OPERATION_NEXTPATH OPERATION_END TOOLPATH_START TOOLPATH_END CURVE_START CURVE_END LAST_EVENT
Event Details
There are events for many different types of process 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.
The cursor normally only visits executables that are enabled, and at most one element of a selective. No START/END events are returned for skipped items. Set the cursor to visit all execs flag if you want 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 error_msg(). 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 get_active_type() 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 get_active_tool()
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 start_project() and is always available via the get_active_project() 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 get_active_workplan() 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 get_active_workplan() 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 get_active_exec() 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 get_active_workingstep() 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 get_active_exec() 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 get_active_exec() 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 get_active_operation() 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 get_active_toolpath() 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.