Overview

The Adaptive class is a cursor for STEP-NC process that can iterate through the process and pause at various events, such as a position change, beginning of a toolpath, end of an operation. An instance of the Adaptive class holds all state for a traversal, so by creating several objects, can have multiple independent traversals of the process.

Basic Use

Create a Finder and read some data, then create a cursor and initialize with StartProject(). The cursor iterates over the STEP-NC file most recently read by Finder.

Advance through the process by calling next() within a loop. Each call moves forward to the next process event. There are many different process events. By default, the cursor will only stop on a tool move event, but you can use set_wanted() to control the exact set of events that you will see.

At each iteration, you can examine the event, test conditions with the "get_active" functions, and take action to emit CNC control codes.

When dealing with a MOVE event, the get_active_type() function will indicate if it is a linear move, arc, helix, etc. The get_move_end() function returns a handle for the endpoint of a movement that you can inspect with the "get_pos" and "get_arc" series of functions, such as get_pos_xyz() and get_pos_dirz().

The cursor keeps its location as a stack of process frames. The "get_active" functions look at the top-most elements in the stack, but you can examine the whole thing with the "get_frame" functions. Each stack frame holds STEP objects, a type, a status, a numeric position number for things like a workplan element index or a curve T parameter, coordinate system transforms, and a set of positions.

Position Handles

Position handles are an integer value that identify position information held by the cursor. Use get_move_end() to find the handle for the end of a move, then use get_pos_xyz(), get_pos_dirz(), and related functions to get the coordinates, tool axis, and other parameters.

The handles returned by get_move_arc() and get_move_probe() are special positions held by certain process elements. These have their own series of access functions with the get_arc or get_probe prefix.

See get_pos_type for more information about the different types of position.

CtlEvent (supporting enum)

The CtlEvent enumeration identifies each of the different the process conditions (Tool move, workingstep change, etc) encountered by the cursor. These are described separately.

CtlStatus (supporting enum)

The CtlStatus enumeration identifies the state of each stack frame as you advance through the process with repeated calls to next(). This state is only useful to application code that is trying to customize the behavior of the traversal at a very detailed level. The STEP-NC Control Library has more discussion on this type.

CtlType (supporting enum)

The CtlType enumeration identifies each of the different kinds of STEP-NC elements that can appear on the process stack. These are described separately. Applications can use this for fine-grained decisions beyond what a CtlEvent provides, such as distinguishing between a move event that is a linear move, an arc move, or a helix move.

error_msg()

def error_msg(self) -> str:

The error_msg() function returns a string description of an error condition that is signaled when the next() function returns CtlEvent.ERROR.

event()

def event(self) -> CtlEvent:

The event() function returns the event at the current location in the process. This is the same value returned by the most recent call to next(). This is a convienience for code that has access to the process object but not the return value of the last call.

get_active_angunit()

def get_active_angunit(self) -> RoseUnit:

The get_active_angunit() function returns the angle unit in effect at the current location in the process. This comes from the top frame in the process stack. You can investigate the angle unit in effect at other points in the process stack using the get_frame_angunit() function.

get_active_aux()

def get_active_aux(self,
	auxidx: int
	) -> Object:

The get_active_aux() function returns an auxillary object from the top of the process stack. These vary depending on the process element but reference additional related objects, such as the toolpath axis curves, workplan setup, etc. A stack frame can hold at most five objects and the num parameter gives the index into this array.

You can investigate the auxillary objects in effect at other points in the process stack using the get_frame_aux() function.

get_active_exec()

def get_active_exec(self) -> Object:

The get_active_exec() function returns the executable (program structure element like workingstep, workplan, selective, or NC function) that is closest to the top of the process stack. If you are working on an operation or toolpath event, this is likely to be a workingstep and get_active_workingstep() will give you the same object.

get_active_feature()

def get_active_feature(self) -> Object:

The get_active_feature() function returns the feature definition associated with a workingstep, or None if the process stack does not contain a workingstep.

get_active_lenunit()

def get_active_lenunit(self) -> RoseUnit:

The get_active_lenunit() function returns the length unit in effect at the current location in the process. This comes from the top frame in the process stack. You can investigate the angle unit in effect at other points in the process stack using the get_frame_lenunit() function.

get_active_mfun()

def get_active_mfun(self) -> Object:

The get_active_mfun() function returns the machine functions instance that governs the current position within the process. The machine functions describes coolant state and other services provided by the machine tool. An operation or toolpath can specify a machine functions instance. If on the operation, it will apply to all toolpaths. If on a toolpath, it will override any settings from the operation.

The get_move_is_coolant(), get_move_is_mist_coolant(), and get_move_is_thru_coolant() functions return the coolant settings from the active machine functions.

The current location in the process is the top of the process stack. You can investigate the machine functions instance in effect elsewhere in the process stack using the get_frame_mfun() function.

get_active_obj()

def get_active_obj(self) -> Object:

The get_active_obj() function returns the STEP object associated with the current location in the process. This object is related to the type of the process element returned by the get_active_type() function. For example, a CtlType.EXEC_WORKSTEP type means that the object was recognized as a workingstep.

The current location in the process is the top of the process stack. You can investigate the object associated with other points in the process stack using the get_frame_obj() function. Other functions, like get_active_workplan(), get_active_operation(), or get_active_toolpath(), search the process stack for a particular type of object.

get_active_operation()

def get_active_operation(self) -> Object:

The get_active_operation() function returns the operation element if one exists on the process stack, or None if not present. Operations are not nested, so there is at most one operation somewhere on the stack.

get_active_param()

def get_active_param(self) -> float:

The get_active_param() function returns the numeric parameter associated with the get_active_obj() at the current location in the process. This is used with some types of object to track location along a curve, or position within a sequence. For example, when the object is a workplan, this will indicate where in the list of elements the cursor is.

This comes from the top frame in the process stack. You can investigate the parameter value in effect at other points in the process stack using the get_frame_param() function.

get_active_pos()

def get_active_pos(self,
	typ: CtlPosType,
	csys: CtlCsys = CtlCsys.WCS
	) -> int:

The get_active_pos() function searches for coordinate information associated with the current location in the process. The function takes a position type and coordinate system to search for. The get_move_end() and get_move_start() functions search for specific position types.

This comes from the top frame in the process stack. You can search for coordinate information held by other points in the process stack using the get_frame_pos() function.

get_active_project()

def get_active_project(self) -> Object:

The get_active_project() function returns the project object if one exists on the process stack, or zero if not present. If it exists, the project will be at the bottom of the stack. If the cursor is set with start_exec() to traverse an individual element, the project will be None.

get_active_status()

def get_active_status(self) -> CtlStatus:

The get_active_status() function returns the state of the process element at the current location in the process. This state changes as the cursor advances through process elements and is primarily for internal use by the cursor.

The current location in the process is the top of the process stack. You can investigate the state of other elements in the process stack using the get_frame_status() function.

get_active_tech()

def get_active_tech(self) -> Object:

The get_active_tech() function returns the technology instance that describes process parameters for the current position within the process. These parameters include feedrate and spindle speed. An operation or toolpath can specify a technology instance. If on the operation, it will apply to all toolpaths. If on a toolpath, it will override any settings from the operation.

The get_move_feed() and get_move_spindle() functions return the feed and speed settings from the active technology. Rapid feed is signaled by a flag on individual toolpaths, which is returned by the get_move_is_rapid() function.

The current location in the process is the top of the process stack. You can investigate the technology instance in effect elsewhere in the process stack using the get_frame_tech() function.

get_active_tool()

def get_active_tool(self) -> Object:

The get_active_tool() function returns the most recent tool instance that was requested by by the process. As the cursor advances through the process, it will encounter operations that call for a tool, but it will also pass through workplans, NC functions and other constructs that do not explicitly call for a tool.

The active tool only changes when an operation explicitly requests a different one, or upon a tool change/unload NC function. The cursor can return the tool change event CtlEvent.TOOL_CHANGE when this value changes, or you can simply compare the active tool with a known value each time you process a move event.

get_active_toolpath()

def get_active_toolpath(self) -> Object:

The get_active_toolpath() function returns the toolpath element if one exists on the process stack, or None if not present. Toolpaths are not nested, so there is at most one toolpath somewhere on the stack.

get_active_type()

def get_active_type(self) -> CtlType:

The get_active_type() function returns the type of the process element at the current location in the process. Combining the event and type gives more detail about the process. For example, a CtlEvent.MOVE event with a CtlType.MOVE_ARC type means that the process is describing a circular arc motion.

The current location in the process is the top of the process stack. You can investigate the type of the process elements elsewhere in the process stack using the GetFrameType() function.

get_active_workingstep()

def get_active_workingstep(self) -> Object:

The get_active_workingstep() function returns the workingstep element if one exists on the process stack, or zero if not present. Workingsteps are not nested, so there is at most one workingstep somewhere on the stack.

get_active_workplan()

def get_active_workplan(self) -> Object:

The get_active_workplan() function returns the workplan that is closest to the top of the process stack. If you are traversing a project, there should always be a main workplan.

get_active_xform()

def get_active_xform(self) -> List[float]:

The get_active_xform() function returns the coordinate system transform at the current location in the process. This includes any stacked setup transforms or workingstep toolpath placement.

You can investigate the transform elsewhere in the process stack using the get_frame_xform() function.

get_arc_angle()

def get_arc_angle(self,
	posid: int,
	u: RoseUnit = RoseUnit.AS_IS
	) -> float:

The get_arc_angle() function returns the angle parameter of an arc or helix move. It expects the position handle returned from the get_move_arc() function. The value is normally in degrees and ranges from 0-360. You can get the value in radians by passing RoseUnit.RAD as the second parameter. See get_arc_center() for a full example.

get_arc_axis()

def get_arc_axis(self,
	posid: int
	) -> tuple[float, float, float]:

The get_arc_axis() function returns a tuple of the normalized IJK components for the axis of rotation of an arc or helix move. The position parameter should be a value from the get_move_arc() function. This value will always be present for an arc move.

This axis defines the plane that the arc turns in. The axis is defined such that the curve extends in a counter-clockwise direction from the start point to the end point. The get_arc_is_cw function compares this axis with the direction of motion to determine whether the toolpath is turning clockwise or counter clockwise.

get_arc_center()

def get_arc_center(self,
	posid: int,
	u: RoseUnit = RoseUnit.AS_IS
	) -> tuple[float, float, float]:

The get_arc_center() function returns a tuple of the center point XYZ coordinates associated with an arc or helix. The position parameter should be a value from the get_move_arc() function. If a length unit is given, the coordinates will be converted to that unit. This value will always be present for an arc move.

The example below shows how to get values associated with an arc move. A helix move is handled the same way but would test for CtlType.MOVE_HELIX.

If CTL.event() == step.CtlEvent.MOVE and CTL.get_active_type() == step.CtlType.MOVE_ARC:
    ARC = CTL.get_move_arc()
    END = CTL.get_move_end()
    
    XYZ = CTL.get_pos_xyz(end)
    print("ARC MOVE TO: ", XYZ[0], XYZ[1], XYZ[2])

    CTR = CTL.get_arc_center(arc)
    print("  CENTER AT: ", CTR[0], CTR[1], CTR[2])

    if CTL.get_arc_is_cw(arc):
	print("  DIRECTION: CW")
    else:
	print("  DIRECTION: CCW")

    print("  RADIUS: ", CTL.get_arc_radius(arc))
    print("  ANGLE: ", CTL.get_arc_angle(arc))

    if CTL.get_arc_is_full_circle(arc):
        print("full circle")

get_arc_height()

def get_arc_height(self,
	posid: int,
	u: RoseUnit = RoseUnit.AS_IS
	) -> float:

The get_arc_height() function only applies to helical moves (CtlType.MOVE_HELIX) and returns the separation between the start and end point of the helix, measured along the tool axis. The value may be positive or negative if the helix is moving up or down with respect to the tool.

If a length unit is given, the coordinates will be converted to that unit. The position parameter should be a value from the get_move_arc() function. See get_arc_center() for a full example.

get_arc_is_cw()

def get_arc_is_cw(self,
	posid: int
	) -> bool:

The get_arc_is_cw() function returns true if an arc move is in the clockwise direction and false if it is in the counter clockwise direction. This is an easy test for G2 or G3 When generating G-Code. The position parameter should be a value from the get_move_arc() function. See get_arc_center() for a full example.

get_arc_is_full_circle()

def get_arc_is_full_circle(self,
	posid: int
	) -> bool:

The get_arc_is_full_circle() function returns true if an arc move is a complete 360 degree circle and false otherwise. The position parameter should be a value from the get_move_arc() function. See get_arc_center() for a full example.

get_arc_is_over180()

def get_arc_is_over180(self,
	posid: int
	) -> bool:

The get_arc_is_over180() function returns true if an arc move is larger than 180 degrees circle and false if it is 180 deg or less. The position parameter should be a value from the get_move_arc() function. See get_arc_center() for a full example.

get_arc_radius()

def get_arc_radius(self,
	posid: int,
	u: RoseUnit = RoseUnit.AS_IS
	) -> float:

The get_arc_radius() function returns the radius of an arc move. If a length unit is given, the coordinates will be converted to that unit. The position parameter should be a value from the get_move_arc() function. See get_arc_center() for a full example.

get_frame_angunit()

def get_frame_angunit(self,
	idx: int
	) -> RoseUnit:

The get_frame_angunit() function returns the angle unit in effect at a given location in the process stack. Use get_active_angunit to get the angle unit on the top of the stack.

get_frame_aux()

def get_frame_aux(self,
	idx: int,
	auxidx: int
	) -> Object:

The get_frame_aux() function returns an auxillary object from a given location in the process stack. These objects vary depending on the process element but reference additional related objects, such as the toolpath axis curves, workplan setup, etc. A stack frame can hold at most five objects and the "num" parameter gives the index into this array. Use get_active_aux to get the auxillary object on the top of the stack.

get_frame_lenunit()

def get_frame_lenunit(self,
	idx: int
	) -> RoseUnit:

The get_frame_lenunit() function returns the length unit in effect at a given location in the process stack. Use get_active_lenunit to get the length unit on the top of the stack.

get_frame_mfun()

def get_frame_mfun(self,
	idx: int
	) -> Object:

The get_frame_mfun() function returns the machine functions instance that that is in effect at a given location in the process stack. Use get_active_mfun to get the machine functions instance for the top of the stack.

get_frame_obj()

def get_frame_obj(self,
	idx: int
	) -> Object:

The get_frame_obj() function returns the STEP object associated with a given location in the process stack. This object is related to the type of the process element returned by the get_frame_type() function. For example, a CtlType.EXEC_WORKSTEP type means that the object was recognized as a workingstep.

Use get_active_obj to get the STEP object on the top of the stack.

get_frame_param()

def get_frame_param(self,
	idx: int
	) -> float:

The get_frame_param() function returns the numeric parameter associated with the get_frame_obj() at a given location in the process stack. This is used with some types of object to track location along a curve, or position within a sequence. For example, when the object is a workplan, this will indicate where in the list of elements the cursor is.

Use get_active_param to get the parameter value on the top of the stack.

get_frame_pos()

def get_frame_pos(self,
	pos: int,
	typ: CtlPosType,
	csys: CtlCsys = CtlCsys.WCS
	) -> int:

The get_frame_pos() function searches for coordinate information at a given location in the process stack. The function takes a position type and coordinate system to search for. Use get_active_pos to look for a position on the top of the stack.

get_frame_status()

def get_frame_status(self,
	idx: int
	) -> CtlStatus:

The get_frame_status() function returns the state of the process element at a given location in the process stack. This state changes as the cursor advances through process elements and is primarily for internal use by the cursor. Use get_active_status to get the status on the top of the stack.

get_frame_tech()

def get_frame_tech(self,
	idx: int
	) -> Object:

The get_frame_tech() function returns the technology data object that that is in effect at a given location in the process stack. Use get_active_tech to get the technology instance for the top of the stack.

get_frame_type()

def get_frame_type(self,
	idx: int
	) -> CtlType:

The get_frame_type() function returns the type of the process element at a given location in the process stack. Use get_active_type to get the type on the top of the stack.

get_frame_xform()

def get_frame_xform(self,
	idx: int
	) -> List[float]:

The get_frame_xform() function returns the coordinate system transform at the current location in the process stack. This includes any stacked setup transforms or workingstep toolpath placement. Use get_active_xform() to get the transform on the top of the stack.

get_last_pos()

def get_last_pos(self) -> int:

The get_last_pos() function returns the endpoint of the last move event. This position value will always be in the working coordinate system (CtlCsys.WCS).

get_last_raw_pos()

def get_last_raw_pos(self) -> int:

The get_last_raw_pos() function returns the endpoint of the last move event in the raw coordinate system (CtlCsys.RAW). A move will always have a WCS position, but this may return zero if the move did not have a RAW position.

get_move_arc()

def get_move_arc(self,
	csys: CtlCsys = CtlCsys.WCS
	) -> int:

The get_move_arc() function searches for an "arc" position (CtlPosType.ARC) associated with a CtlEvent.MOVE event. Only CtlType.ARC and CtlType.HELIX moves have this information. Use get_arc_center(), get_arc_axis(), get_arc_radius(), and get_arc_angle() to get the numeric values for an arc. The get_arc_is_cw(), get_arc_is_over180(), and get_arc_is_full_circle() flags are also useful.

The function searches for an arc position in the working coordinate system (CtlCsys.WCS) by default, or in the given coordinate system.

get_move_end()

def get_move_end(self,
	csys: CtlCsys = CtlCsys.WCS
	) -> int:

The get_move_end() function is a special version of get_active_pos() that searches for an "end" position (CtlPosType.END) associated with the current location in the process.

The function searches for a position in the working coordinate system (CtlCsys.WCS) by default, or in the given coordinate system.

get_move_feed()

def get_move_feed(self,
u: RoseUnit = RoseUnit.AS_IS
) -> float:

The get_move_feed() function returns the feed rate in effect at a the current location in the process. If an unit argument is given, the value will be converted to that unit. The feed value is controlled by the active technology instance. Use get_move_feed_unit() to find the native unit for the feed value.

Toolpaths may also override the feed rate with a "rapid" flag, which you can check using the get_move_is_rapid() function.

if CTL.get_move_is_rapid():
   print ("RAPID")
else:
   print ("FEED", CTL.get_move_feed())

get_move_feed_unit()

def get_move_feed_unit(self) -> RoseUnit:

The get_move_feed_unit() function returns the native unit for the value provided by get_move_feed().

get_move_is_coolant()

def get_move_is_coolant(self) -> bool:

The get_move_is_coolant() function returns true if flood coolant has been requested at the current location in the process. The coolant settings are controlled by the active machine functions instance. Mist and through spindle coolant can also be requested.

get_move_is_mist_coolant()

def get_move_is_mist_coolant(self) -> bool:

The get_move_is_mist_coolant() function returns true if mist coolant has been requested at the current location in the process. See get_move_is_coolant() for more discussion of coolant settings.

get_move_is_rapid()

def get_move_is_rapid(self) -> bool:

The get_move_is_rapid() function returns true if rapid motion has been requested at the current location in the process. This is not controlled by the technology instance - instead, toolpaths can override the feed rate with a "rapid" flag.

get_move_is_thru_coolant()

def get_move_is_thru_coolant(self) -> bool:

The get_move_is_thru_coolant() function returns true if through-spindle coolant has been requested at the current location in the process. See get_move_is_coolant() for more discussion of coolant settings.

get_move_probe()

def get_move_probe(self,
	csys: CtlCsys = CtlCsys.WCS
	) -> int:

The get_move_probe() function returns a "probe" position (CtlPosType.PROBE) if a probing operation (type CtlType.OP_PROBE) exists on the process stack. The operation need not be at the top of the stack, the function will search the stack for it. With no arguments, the function searches for a position in the working coordinate system (CtlCsys.WCS), although a different value can be provided.

This position contains parameters describing the start, end, and probing direction, expected value, and variable name. Use get_probe_start(), get_probe_end(), get_probe_direction(), get_probe_expected(), and get_probe_var() to retrieve these values.

get_move_spindle()

def get_move_spindle(self,
	u: RoseUnit = RoseUnit.AS_IS
	) -> float:

The get_move_spindle() function returns the spindle speed in effect at the current location in the process. If a unit is given, the value will be converted to that unit. The function returns None if no value is defined. A value of zero indicates spindle stopped. A positive value indicates counter-clockwise rotation and a negative value indicates clockwise rotation.

The spindle speed value is controlled by the active technology instance. Use get_move_spindle_unit() to find the native unit for the spindle value.

get_move_spindle_unit()

def get_move_spindle_unit(self) -> RoseUnit:

The get_move_spindle_unit() function returns the native unit for the value provided by get_move_spindle().

get_move_start()

def get_move_start(self,
	csys: CtlCsys = CtlCsys.WCS
	) -> int:

The get_move_start() function is a special version of get_active_pos() that searches for a "start" position (CtlPosType.START) associated with the current location in the process. With no arguments, the function searches for a position in the working coordinate system (CtlCsys.WCS), although a different value can be provided.

get_pos_angunit()

def get_pos_angunit(self,
posid: int
) -> RoseUnit:

The get_pos_angunit() function returns the angle unit associated with the position values.

get_pos_csys()

def get_pos_csys(self,
	posid: int
	) -> CtlCsys:


class CtlCsys(IntEnum):
    WCS		# apply all transforms
    PART	# apply wstep xforms but not setup xforms
    RAW		# apply no transforms

The get_pos_csys() function returns the coordinate system associated with the position values. This value distinguishes between several version of the same point with different transforms applied.

get_pos_default_dirx()

def get_pos_default_dirx(self,
	posid: int
	) -> tuple[float, float, float]:

The get_pos_default_dirx() function returns a tuple of the normalized IJK components of a default tool reference direction that can be used if get_pos_dirx() does not find a value. This default is the same reference direction (X axis) computed when initializing a STEP axis placement with just the Z axis given by get_pos_dirz() or get_pos_default_dirz().

get_pos_default_dirz()

def get_pos_default_dirz(self,
	posid: int
	) -> tuple[float, float, float]:

The get_pos_default_dirz() function returns a tuple of the normalized IJK components of a default tool axis direction that can be used if get_pos_dirz() does not find a value. This default is computed by starting with (0,0,1) and then applying any toolpath and setup transforms that are in effect.

get_pos_dirx()

def get_pos_dirx(self,
	posid: int
	) -> tuple[float, float, float]:

The get_pos_dirx() function returns a tuple of the normalized IJK components for the tool reference direction associated with a position identifier. This points from the tool tip along the X axis, usually towards the front of a non-rotating tool. In a toolpath, this value comes from the "tool reference direction" curve. Returns None if this value is not present. You can use use get_pos_default_dirx() for a direction if one is not present.

get_pos_dirx_obj()

def get_pos_dirx_obj(self,
	posid: int
	) -> Object:

The get_pos_dirx_obj() function returns the STEP object, if any, that is the source of the tool reference direction for the given position.

get_pos_dirz()

def get_pos_dirz(self,
	posid: int
	) -> tuple[float, float, float]:

The get_pos_dirz() function returns a tuple of the normalized IJK components for the tool axis direction associated with a position identifier. This points from the tool tip back along the tool towards the machine. In a toolpath, this value comes from the "tool axis" curve. Returns None if this value is not present. You can use get_pos_default_dirz() for a direction if one is not present.

get_pos_dirz_obj()

def get_pos_dirz_obj(self,
	posid: int
	) -> Object:

The get_pos_dirz_obj() function returns the STEP object, if any, that is the source of the tool axis direction for the given position.

get_pos_is_equal()

def get_pos_is_equal(self,
	pos1: int,
	pos2: int
	) -> bool:

The get_pos_is_equal() function compares two positions to see if they are equal. This only compares the position, tool axis, and tool reference directions. This is useful for comparing the start and end positions of a linear move. The last move on one toolpaths curve normally shares the same point as the start of the next curve.

if CTL.get_active_type() == step.CtlType.MOVE:
   if CTL.get_pos_is_equal(CTL.get_move_end(), CTL.get_last_pos()):
   	# Skip moves where start and end positions are the
 	# same.  Happens at toolpath connections, composite
 	# curves, and so on.

get_pos_lenunit()

def get_pos_lenunit(self,
	posid: int
	) -> RoseUnit:

The get_pos_lenunit() function returns the length unit associated with the position values.

get_pos_move_dir()

def get_pos_move_dir(self,
	posid: int
	) -> tuple[float, float, float]:

The get_pos_move_dir() function returns a tuple of the normalized IJK components for the direction of motion along the toolpath associated with a position identifier. This value is calculated from the toolpath.

get_pos_param()

def get_pos_param(self,
	posid: int
	) -> float:

The get_pos_param() function returns the numeric parameter associated with the position. This normally describes the location along the most recent curve on the process stack that the point came from. The parameter value from get_active_param() or get_frame_param() usually describes the parameter value at the end of a move, whereas a position might describe the start, end, or via points in the middle of a move.

get_pos_snorm_dir()

def get_pos_snorm_dir(self,
	posid: int
	) -> tuple[float, float, float]:

The get_pos_snorm_dir() function returns a tuple of the normalized IJK components for the surface normal direction associated with a position identifier. This points out of the workpiece material. In a toolpath, this value comes from the "surface normal" curve property. This returns None if no surface normal curve is present.

get_pos_snorm_dir_obj()

def get_pos_snorm_dir_obj(self,
	posid: int
	) -> Object:

The get_pos_snorm_dir_obj() function returns the STEP object, if any, that is the source of the surface normal for the given position.

get_pos_speed_ratio()

def get_pos_speed_ratio(self, posid: int) -> float:

The get_pos_speed_ratio() function returns the speed override value if one is associated with a position identifier, or None if it is not present. This single number is a multiplier for the feedrate. A value of one indicates the programmed feed, two indicates double the base feed, etc. In a toolpath, this value comes from the "speed profile" curve property.

get_pos_speed_ratio_obj()

def get_pos_speed_ratio_obj(self,
	posid: int
	) -> Object:

The get_pos_speed_ratio_obj() function returns the STEP object, if any, that is the source of the speed profile ratio for the position.

get_pos_type()

def get_pos_type(self,
	posid: int
	) -> CtlPosType:

class CtlPosType(IntEnum):
    END
    START
    ARC
    VIA1
    VIA2
    PROBE
    RETRACT

The get_pos_type() function returns a value that identifies the role of the position, such as as CtlPosType.END for the end of a move, CtlPosType.START for the start, and CtlPosType.ARC for the center and other characteristics of an arc or helix move.

get_pos_xsect()

def get_pos_xsect(self,
	posid: int,
	u: RoseUnit = RoseUnit.AS_IS
	) -> dict[str, float]

The get_pos_xsect() function returns a dictionary of cross section parameters associated with a position identifier. These parameters describe a 2D profile in the plane normal to the feed direction. The function also takes an optional length unit for converting the values. In a toolpath, this value comes from the "cross section area parameters" property. The function returns None if no cross section property is present

The dictionary parameters are:

admax
The maximum axial depth of the tool contact cross section. The axial depth is measured parallel to the tool axis. For turning, this is measured parallel to the spindle axis.
rdmax
The maximum radial depth of the tool contact cross section. The radial depth is perpendicular to both tool axis and feed direction.
xmaxofs
The location along the X axis where the maximum radial depth measure is located. This is the radial offset of the origin (lower left corner) of tool contact cross section measured from the tool tip.
ymaxofs
The location along the Y axis where the maximum axial depth measure is located. This is the axial offset of the origin (lower left corner) of tool contact cross section measured from the tool tip.
csa
The total cross section area of the tool engagement.
xcgofs
The radial offset of the center of gravity of this cross section area. It is measured from the tool tip.
ycgofs
The axial offset of the center of gravity of this cross section area. It is measured from the tool tip.
Cross Section Parameters

get_pos_xsect_obj()

def get_pos_xsect_obj(self,
	posid: int
	) -> Object:

The get_pos_xsect_obj() function returns the STEP object, if any that is the source of the cross section parameter information for the position.

get_pos_xyz()

def get_pos_xyz(self,
	posid: int,
	u: RoseUnit = RoseUnit.AS_IS
	) -> tuple[float, float, float]:

The get_pos_xyz() function returns a tuple of the XYZ cartesian coordinates associated with a position identifier. If a length unit is given, the value will be converted to that unit. In a toolpath, this value comes from the "basic curve" property.

get_pos_xyz_obj()

def get_pos_xyz_obj(self,
	posid: int
	) -> Object:

The get_pos_xyz_obj() function returns the STEP object, if any, that is the source of the location information for the position.

get_probe_direction()

def get_probe_direction(self,
	posid: int
	) -> tuple[float, float, float]:

The get_probe_direction() function finds the measurement direction of a probing operation and returns a tuple of the normalized IJK components. The position parameter should be a value from the get_move_probe() function.

get_probe_direction_obj()

def get_probe_direction_obj(self,
	posid: int
	) -> Object:

The get_probe_direction_obj() function returns the STEP direction object, if any, that is the source of the measurement direction for the probing parameters.

get_probe_end()

def get_probe_end(self,
	posid: int,
	u: RoseUnit = RoseUnit.AS_IS
	) -> tuple[float, float, float]:

The get_probe_end() function finds the expected ending location of a probing operation and returns a tuple of the XYZ coordinates. If an optional length unit is given, the coordinates will be converted to that unit. The position parameter should be a value from the get_move_probe() function.

get_probe_expected()

def get_probe_expected(self,
	posid: int,
	u: RoseUnit = RoseUnit.AS_IS
	) -> float:

The get_probe_expected() function returns the expected distance of travel for a probing operation. If an optional length unit is given, the value will be converted to that unit. The position parameter should be a value from the get_move_probe() function.

get_probe_expected_obj()

def get_probe_expected_obj(self,
	posid: int
	) -> Object:

The get_probe_expected_obj() function returns the STEP measure object, if any, that is the source of the expected distance of travel for the probing operation parameters.

get_probe_start()

def get_probe_start(self,
	posid: int,
	u: RoseUnit = RoseUnit.AS_IS
	) -> tuple[float, float, float]:

The get_probe_start() function finds the starting position of a probing operation and returns the XYZ coordinates as a tuple. If an optional length unit is given, the coordinates will be converted to that unit. The position parameter should be a value from the get_move_probe() function.

get_probe_start_obj()

def get_probe_start_obj(self,
	posid: int
	) -> Object:

The get_probe_start_obj() function returns the STEP axis placement object, if any, that is the source of the start position for the probing operation parameters.

get_probe_var()

def get_probe_var(self,
	posid: int
	) -> str:

The get_probe_var() function returns the string name of the STEP-NC variable associated with the probing operation. The position parameter should be a value from the get_move_probe() function.

get_probe_var_obj()

def get_probe_var_obj(self,
	posid: int
	) -> Object:

The get_probe_var_obj() function returns the STEP expression object, if any, that is the source of the variable name in the probing operation. The position parameter should be a value from the get_move_probe() function.

get_probe_workpiece()

def get_probe_workpiece(self,
	posid: int
	) -> Object:

The get_probe_workpiece() function returns the STEP workpiece data object associated with the probing operation. The position parameter should be a value from the get_move_probe() function.

get_stack_pos_of_type()

def get_stack_pos_of_type(self,
	t: CtlType
	) -> int:

The get_stack_pos_of_type() function searches the stack for the most recent frame of a given type and returns the position. The function returns get_stack_size() if the value is not found.

get_stack_size()

def get_stack_size(self) -> int:

The get_stack_size() function returns the number of elements currently on the process stack. As the cursor traverses a process, it pushes these "stack frame" elements onto a stack to keep track of the location within the process.

The top of the stack contains the information relevent to the current location within the process. These values are available through the various "get_active" functions. You can also examine the information in individual stack frames with the "GetFrame" series of functions.

The example below prints the stack of STEP objects that give the path through the process to the current location of the cursor.

get_visit_all_execs()

def get_visit_all_execs(self) -> bool:

The get_visit_all_execs() function describes how the cursor picks executables to visit on a traversal. Use set_visit_all_execs() to change the value.

The default value is false, which indicates that the cursor examines the "enabled" flag on each executables and skips any that are marked as disabled. It will only visit one member of a selective. It will pick one if the selective has multiple enabled elements.

A value of true indicates that the cursor ignores the "enabled" flag and visits all executables that are reachable from the starting object. This includes all members of a selective.

get_wanted()

def get_wanted(self,
	event: CtlEvent
	) -> bool:

The get_wanted() function returns a boolean value indicating whether the cursor will stop for a particular event.

By default, cursors stop on every toolpath movement (CtlEvent.MOVE), but you can change this with the set_wanted() function. See CtlEvent for a full list of events.

next()

def next(self) -> CtlEvent:

The next() function moves forward in the process until the next event of interest. The return value indicates an event, or a zero value (CtlEvent.DONE) when finished. The return value is also available by calling event().

By default, the cursor will return on every toolpath movement (CtlEvent.MOVE), but this can be changed to return at the start or end of every workplan, operation, toolpath, etc. See CtlEvent for a full list of events.

the function returns CtlEvent.ERROR if a problem is seen. The error_msg() function returns a description of the problem.

CTL = step.Adaptive()
CTL.start_project(D)

while True:
    E = CTL.next()

    if E is step.CtlEvent.MOVE:
        # do something
        continue
    
    if E is step.CtlEvent.DONE:
        break

reset()

def reset(self) -> None:

The reset() function clears the process stack and resets the cursor. You must call start_project() to begin another traversal.

set_visit_all_execs()

def set_visit_all_execs(self,
	yn: bool
	) -> None:

The set_visit_all_execs() function controls how the cursor picks executables to visit on a traversal.

The default value is false, the cursor examines the "enabled" flag on each executables and skips any that are marked as disabled. It will only visit one member of a selective. It will pick one if the selective has multiple enabled elements.

When true, the cursor ignores the "enabled" flag and visits all executables that are reachable from the starting object. This includes all members of a selective.

set_wanted()

def set_wanted(self,
	event: CtlEvent,
	yn: bool = True
	) -> None:

The set_wanted() function sets a boolean value indicating whether the cursor will stop for a particular event. The first parameter is the event and the second one is the boolean value, which defaults to True.

The set_wanted_all() function can turn all events on or off with a single call. See CtlEvent for a full list of events.

The following example turns some events on and off.

CTL = step.Adaptive()

# turn on all events for executables
CTL.set_wanted(step.CtlEvent.EXEC_WORKPLAN_START)
CTL.set_wanted(step.CtlEvent.EXEC_WORKPLAN_NEXT)
CTL.set_wanted(step.CtlEvent.EXEC_WORKPLAN_END)
CTL.set_wanted(step.CtlEvent.EXEC_SELECT_START)
CTL.set_wanted(step.CtlEvent.EXEC_SELECT_END)
CTL.set_wanted(step.CtlEvent.EXEC_WORKSTEP_START)
CTL.set_wanted(step.CtlEvent.EXEC_WORKSTEP_END)
CTL.set_wanted(step.CtlEvent.EXEC_OTHER_START)
CTL.set_wanted(step.CtlEvent.EXEC_OTHER_END)
CTL.set_wanted(step.CtlEvent.EXEC_NCFUN)


# turn off notification for NC functions
CTL.set_wanted(step.CtlEvent.EXEC_NCFUN, False)

set_wanted_all()

def set_wanted_all(self,
	yn: bool = True
	) -> None:

The set_wanted_all() function configures the cursor to stop or not stop at all known events. The default, True, stops at all events. Use set_wanted() to control an individual event. See CtlEvent for a full list of events.

CTL = step.Adaptive()
CTL.set_wanted_all()	 	# turn all events on
CTL.set_wanted_all(True)	# turn all events on
CTL.set_wanted_all(False)	# turn all events off

start_exec()

def start_exec(self,
	mpe: Object
	) -> None:

The start_exec() function initializes the cursor to begin traversing the given executable (instance of the EXPRESS type machining_process_executable). This will overwrite any traversal that was in progress, but does not change or reset any of the events selected by set_wanted().

start_project()

def start_project(self,
	d: Design
	) -> None:

The start_project() function sets the cursor to begin traversing the STEP-NC project in the given design. This will replace any traversal that was in progress, but does not change or reset any of the events selected by set_wanted().