Overview

The StixCtlCursor class is a cursor for STEP-NC process that can step through the process and pause at various events, such as a position change, beginning of a toolpath, end of an operation.

Create an instance, then assign assign a file to traverse with startProject(). By default, the cursor stops on each position change, but you can use setWanted() to select other types of events.

Call next() to advance through the process to the next requested event. At each iteration, you can examine the event, test conditions with the "getActive" functions, then take some action, like emit CNC control codes.

With a movement event, use getActiveType() to see if it is a linear move, arc, helix, etc. The getMoveEnd() function will return position information that you can inspect with the "getPos" and "getArc" series of functions, such as getPosXYZ() and getPosDirZ().

The cursor keeps its location as a stack of process frames. The "getActive" functions look at the top-most elements in the stack, but you can examine the whole thing with the "getFrame" series of functions. Each stack frame holds pointers to 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.

The examples below show some of the ways to use the cursor.

Constructor

StixCtlCursor();
StixCtlCursor(const StixCtlCursor &other);
StixCtlCursor& operator=(const StixCtlCursor &other);

The StixCtlCursor class provides a default constructor, a copy constructor, and an assignment operator for copying cursor state.

The default constructor initializes a blank cursor. The cursor will have the default event preferences (only STIXCTL_MOVE) and must be given an object to traverse with the StartProject() or StartExec() functions.

The copy constructor and assignment operator will duplicate the state of an existing cursor, including all event prefrerences and existing place in the process. This can be particularly useful for look-ahead operations. Duplicating a cursor is not a very expensive operation in either time or memory.

// CREATE EMPTY CURSOR
StixCtlCursor p;	

// Configure to look at certain events and a specific file
RoseDesign * design;
p.startProject(design);
p.setWantedAll(0); // clear any default events
p.setWanted(STIXCTL_SETUP_START);
p.setWanted(STIXCTL_EXEC_WORKPLAN_START);
p.setWanted(STIXCTL_EXEC_WORKPLAN_END);
p.setWanted(STIXCTL_OPERATION_START);


[ ... advance the cursor somewhat ... ]

StixCtlCursor lookahead;

// copy the current cursor state and look ahead for
// any upcoming probing operations.
lookahead = p;
lookahead.setWantedAll(0);
lookahead.setWanted(STIXCTL_OPERATION_START);

while (lookahead.next())
{
    // is getActiveOperation() a probe operation??
}

errorMsg()

const char * errorMsg()

The errorMsg() function returns a string description of an error condition. The next() function returns STIXCTL_ERROR when an error has occurred.

event()

StixCtlEvent event();

The event() function returns the result of 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.

getActiveAngUnit()

RoseUnit getActiveAngUnit();

The getActiveAngUnit() 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 getFrameAngUnit() function.

getActiveAux()

RoseObject * getActiveAux (unsigned num);

The getActiveAux() 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 STIXCTL_FRAME_MAXAUX 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 getFrameAux() function.

getActiveExec()

stp_machining_process_executable * getActiveExec();

The getActiveExec() 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 getActiveWorkingstep() will give you the object cast as a more specific C++ type.

getActiveFeature()

RoseObject * getActiveFeature();

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

getActiveLenUnit()

RoseUnit getActiveLenUnit();

The getActiveLenUnit() 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 getFrameLenUnit() function.

getActiveMfun()

stp_machining_functions * getActiveMfun();

The getActiveMfun() 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 getMoveIsCoolant(), getMoveIsMistCoolant(), and getMoveIsThruCoolant() 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 getFrameMfun() function.

getActiveObj()

RoseObject * getActiveObj();

The getActiveObj() 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 getActiveType() function. For example, a STIXCTL_TYPE_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 getFrameObj() function. Other functions, like getActiveWorkplan(), getActiveOperation(), or getActiveToolpath(), search the process stack for a particular type of object.

getActiveOperation()

stp_machining_operation * getActiveOperation();

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

getActiveParam()

double getActiveParam();

The getActiveParam() function returns the numeric parameter associated with the getActiveObj() 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 getFrameParam() function.

getActivePos()

StixCtlPos getActivePos(
	StixCtlPosType t,
	StixCtlCsys cs
	);

The getActivePos() 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 getMoveEnd() and getMoveStart() 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 getFramePos() function.

getActiveProject()

stp_product_definition * getActiveProject();

The getActiveProject() function returns the project object if one exists on the process stack, or null. If it exists, the project will be at the bottom of the stack. If the cursor is set with startExec() to traverse an individual element, the project will be null.

getActiveStatus()

StixCtlStatus getActiveStatus();

The getActiveStatus() 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 getFrameStatus() function.

getActiveTech()

stp_machining_technology * getActiveTech();

The getActiveTech() function the technology instance that governs the current position within the process. The technology describes process parameters such as 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 getMoveFeed() and getMoveSpindle() 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 getMoveIsRapid() 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 getFrameTech() function.

getActiveTool()

stp_machining_tool * getActiveTool();

The getActiveTool() 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 STIXCTL_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.

getActiveToolIsProbe()

int getActiveToolIsProbe();

The getActiveToolIsProbe() function returns nonzero if the active tool is a probe servicing a probing operation. A touch probe is usually treated specially on machine tools. This will always be nonzero for probing operations, even if the probe does not specify a tool object and getActiveTool() is null.

getActiveToolpath()

stp_machining_toolpath * getActiveToolpath();

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

getActiveType()

StixCtlType getActiveType();

The getActiveType() 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 STIXCTL_MOVE event with a STIXCTL_TYPE_MOVE_ARC type means that the process is currently executing 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.

getActiveWorkingstep()

stp_machining_workingstep * getActiveWorkingstep(); 

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

getActiveWorkplan()

stp_machining_workplan * getActiveWorkplan();

The getActiveWorkplan() 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.

getActiveXform()

const double * getActiveXform();

The getActiveXform() function returns the coordinate system transform at the current location in the process. This includes any stacked setup transforms or workingstep toolpath placement. The return value is a pointer to a double[16] array that should be treated as volitile. It may change and the pointer may become invalid upon the next call that changes the process stack. Assign the value to a RoseXform or use rose_put_xform() to copy the array.

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

StixCtlProcess ctl;

RoseXform xf = ctl.getActiveXform();

double xf_array[16];
rose_xform_put(xf_array, ctl.getActiveXform());

getArcAngle()

double getArcAngle(
	StixCtlPos p,
	RoseUnit u = roseunit_deg
	);

The getArcAngle() function returns the angle parameter of an arc or helix move. Pass in the position returned from the getMoveArc() 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 getArcCenter() for a full example.

getArcAxis()

int getArcAxis (
	double ret_ijk[3],
	StixCtlPos p
	);

The getArcAxis() function copies the axis of rotation for an arc or helix into the return array. The position parameter should be a value from the getMoveArc() function. This value will always be present for an arc move, so the return value should always be nonzero.

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

getArcCenter()

int getArcCenter (
	double ret_xyz[3],
	StixCtlPos p,
	RoseUnit u = roseunit_as_is
	);

The getArcCenter() function copies the center point of an arc or helix into the return array. The position parameter should be a value from the getMoveArc() function. If an optional length unit is given, the value will be converted to that unit. This value will always be present for an arc move, so the return value should always be nonzero.

The example below shows how to get values associated with an arc move. A helix move is handled the same way.

if (ctl.event() == STIXCTL_MOVE &&
    ctl.getActiveType() == STIXCTL_TYPE_MOVE_ARC)
{
    StixCtlPos arc = ctl.getMoveArc();
    StixCtlPos end = ctl.getMoveEnd();
    double v[3];

    ctl.getPosXYZ(v, end);
    printf ("ARC MOVE TO: %.5g %.5g %.5g\n", v[0], v[1], v[2]);

    ctl.getArcCenter(v, arc);
    printf ("  CENTER AT: %.5g %.5g %.5g\n", v[0], v[1], v[2]);
    
    printf ("  DIRECTION: %s\n", ctl.getArcIsCW(arc)? "CW": "CCW");
    printf ("  RADIUS: %.5g\n", ctl.getArcRadius(arc));
    printf ("  ANGLE: %.5g\n", ctl.getArcAngle(arc));
    if (ctl.getArcIsFullCircle(arc)) printf ("  full circle\n");
}

getArcHeight()

double getArcHeight(
	StixCtlPos p,
	RoseUnit u = roseunit_as_is
	);

The getArcHeight() function only applies to helical moves (STIXCTL_TYPE_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 an optional length unit is given, the value will be converted to that unit. The position parameter should be a value from the getMoveArc() function. See getArcCenter() for a full example.

getArcIsCW()

int getArcIsCW (StixCtlPos p);

The getArcIsCW() function returns nonzero if an arc move is in the clockwise direction and zero 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 getMoveArc() function. See getArcCenter() for a full example.

getArcIsFullCircle()

int getArcIsFullCircle (StixCtlPos p);

The getArcIsFullCircle() function returns nonzero if an arc move is a complete 360 degree circle and zero otherwise. The position parameter should be a value from the getMoveArc() function. See getArcCenter() for a full example.

getArcIsOver180()

int getArcIsOver180 (StixCtlPos p);

The getArcIsOver180() function returns nonzero if an arc move is larger than 180 degrees circle and zero if it is 180 deg or less. The position parameter should be a value from the getMoveArc() function. See getArcCenter() for a full example.

getArcRadius()

double getArcRadius(
	StixCtlPos p,
	RoseUnit u = roseunit_as_is
	);

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

getFrameAngUnit()

RoseUnit getFrameAngUnit (unsigned stack_pos);

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

getFrameAux()

RoseObject * getFrameAux (
	unsigned stack_pos,
	unsigned num
	);

The getFrameAux() 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 STIXCTL_FRAME_MAXAUX objects and the num parameter gives the index into this array. Use getActiveAux to get the auxillary object on the top of the stack.

getFrameLenUnit()

RoseUnit getFrameLenUnit (unsigned stack_pos);

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

getFrameMfun()

stp_machining_functions * getFrameMfun (unsigned stack_pos);

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

getFrameObj()

RoseObject * getFrameObj (unsigned stack_pos);

The getFrameObj() 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 getFrameType() function. For example, a STIXCTL_TYPE_EXEC_WORKSTEP type means that the object was recognized as a workingstep. Use getActiveObj to get the STEP object on the top of the stack.

getFrameParam()

double getFrameParam (unsigned stack_pos);

The getFrameParam() function returns the numeric parameter associated with the getFrameObj() 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 getActiveParam to get the parameter value on the top of the stack.

getFramePos()

StixCtlPos getFramePos(
	unsigned stack_pos,
	StixCtlPosType t, 
	StixCtlCsys cs
	);

The getFramePos() 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 getActivePos to look for a position on the top of the stack.

getFrameStatus()

StixCtlStatus getFrameStatus (unsigned stack_pos);

The getFrameStatus() 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 getActiveStatus to get the status on the top of the stack.

getFrameTech()

stp_machining_technology * getFrameTech (unsigned stack_pos);

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

getFrameType()

StixCtlType getFrameType (unsigned stack_pos);

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

getFrameXform()

const double * getFrameXform (unsigned stack_pos);

The getFrameXform() function returns the coordinate system transform at a given location in the process stack. This includes any stacked setup transforms or workingstep toolpath placement. Use getActiveXform to get the transform on the top of the stack. The return value is a pointer to a double[16] array that should be treated as volitile. It may change and the pointer may become invalid upon the next call that changes the process stack. Assign the value to a RoseXform or use rose_put_xform() to copy the array.

getLastPos()

StixCtlPos getLastPos();

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

getLastRawPos()

StixCtlPos getLastRawPos();

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

getMoveArc()

StixCtlPos getMoveArc(
	StixCtlCsys cs = STIXCTL_CSYS_WCS
	);

The getMoveArc() function searches for an "arc" position (STIXCTL_POS_ARC) associated with a STIXCTL_MOVE event. Only STIXCTL_TYPE_ARC and STIXCTL_TYPE_HELIX moves have this information. Use the getArcCenter(), getArcAxis(), getArcRadius(), and getArcAngle() functions to get the numeric values for an arc. The getArcIsCW(), getArcIsOver180(), and getArcIsFullCircle() flags are also useful.

By default the function searches for arc information in the working coordinate system (STIXCTL_CSYS_WCS), although a different value can be provided.

getMoveEnd()

StixCtlPos getMoveEnd(
	StixCtlCsys cs = STIXCTL_CSYS_WCS
	);

The getMoveEnd() function is a special version of getActivePos() that searches for an "end" position (STIXCTL_POS_END) associated with the current location in the process. By default the function searches for a position in the working coordinate system (STIXCTL_CSYS_WCS), although a different value can be provided.

getMoveFeed()

double getMoveFeed (
	RoseUnit u = roseunit_as_is
	);

The getMoveFeed() function returns the feed rate in effect at a the current location in the process. If an optional unit is given, the value will be converted to that unit. The function returns ROSE_NULL_REAL if no value is defined. The feed value is controlled by the active technology instance. Use getMoveFeedUnit() 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 getMoveIsRapid() function.

StixCtlCursor p;

printf ("FEEDRATE: ");
double d = p.getMoveFeed();
if (p.getMoveIsRapid())
    printf ("RAPID\n");
else if (ROSE_FLOAT_IS_NULL(d))
    printf ("--\n");
else 
    printf ("%g %s\n", d, rose_get_unit_name(p.getMoveFeedUnit()));

getMoveFeedUnit()

RoseUnit getMoveFeedUnit();

The getMoveFeedUnit() function returns the native unit for the value provided by getMoveFeed().

getMoveIsCoolant()

int getMoveIsCoolant();

The getMoveIsCoolant() function returns nonzero 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.

getMoveIsMistCoolant()

int getMoveIsMistCoolant();

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

getMoveIsRapid()

int getMoveIsRapid();

The getMoveIsRapid() function returns nonzero 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.

getMoveIsThruCoolant()

int getMoveIsThruCoolant();

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

getMoveProbe()

StixCtlPos getMoveProbe(
	StixCtlCsys cs = STIXCTL_CSYS_WCS
	);

The getMoveProbe() function returns a "probe" position (STIXCTL_POS_PROBE) if a probing operation (type STIXCTL_TYPE_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 (WCS), although a different value can be provided.

This position contains parameters describing the start, end, and probing direction, expected value, and variable name.

getMoveSpindle()

double getMoveSpindle (
	RoseUnit u = roseunit_as_is
	);

The getMoveSpindle() function returns the spindle speed in effect at a the current location in the process. If an optional unit is given, the value will be converted to that unit. The function returns ROSE_NULL_REAL 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 getMoveSpindleUnit() to find the native unit for the spindle value.

StixCtlCursor p;

printf ("SPINDLE: ");
d = p.getMoveSpindle();
if (ROSE_FLOAT_IS_NULL(d))
    printf ("--\n");
else if (ROSE_FLOAT_IS_ZERO(d))
    printf ("STOPPED\n");
else 
    printf ("%g %s %s\n", fabs(d),
	    rose_get_unit_name(p.getMoveSpindleUnit()),
	    (d>0? "CCW": "CW"));

getMoveSpindleUnit()

RoseUnit getMoveSpindleUnit();

The getMoveSpindleUnit() function the native unit for the value provided by getMoveSpindle().

getMoveStart()

StixCtlPos getMoveStart(
	StixCtlCsys cs = STIXCTL_CSYS_WCS
	);

The getMoveStart() function is a special version of getActivePos() that searches for a "start" position (STIXCTL_POS_START) associated with the current location in the process. By default the function searches for a position in the working coordinate system (STIXCTL_CSYS_WCS), although a different value can be provided.

getPosAngUnit()

RoseUnit getPosAngUnit(StixCtlPos p);

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

getPosCsys()

StixCtlCsys getPosCsys(StixCtlPos p);

enum StixCtlCsys {
    STIXCTL_CSYS_WCS = 0,	// apply all transforms
    STIXCTL_CSYS_PART,		// apply wstep xforms but not setup xforms
    STIXCTL_CSYS_RAW		// apply no transforms
};

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

getPosDefaultDirX()

int getPosDefaultDirX(
	double ret_ijk[3],
	StixCtlPos p
	);

The getPosDefaultDirX() function always returns a nonzero value and sets the return parameter to the normalized IJK components of a default tool reference direction that can be used if getPosDirX() 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 getPosDirZ() or getPosDefaultDirZ().

getPosDefaultDirZ()

int getPosDefaultDirZ(
	double ret_ijk[3],
	StixCtlPos p
	);

The getPosDefaultDirZ() function always returns a nonzero value and sets the return parameter to the normalized IJK components of a default tool axis direction that can be used if getPosDirZ() 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.

getPosDirMove()

int getPosDirMove(
	double ret_ijk[3],
	StixCtlPos p
	);

The getPosDirMove() function returns nonzero if the values associated with a position identifier include a direction of motion along the toolpath, as normalized IJK coordinates. This value is calculated from the toolpath.

getPosDirSnorm()

int getPosDirSnorm(
	double ret_ijk[3],
	StixCtlPos p
	);

The getPosDirSnorm() function returns nonzero if the values associated with a position identifier include a surface normal direction at the position, as normalized IJK coordinates. This points out of the workpiece material. In a toolpath, this value comes from the "surface normal" curve property.

getPosDirSnormObj()

RoseObject * getPosDirSnormObj(StixCtlPos p);

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

getPosDirX()

int getPosDirX(
	double ret_ijk[3],
	StixCtlPos p
	);

The getPosDirX() function returns nonzero if the values associated with a position identifier include a tool reference direction as normalized IJK coordinates. 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.

getPosDirXObj()

RoseObject * getPosDirXObj(StixCtlPos p);

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

getPosDirZ()

int getPosDirZ(
	double ret_ijk[3],
	StixCtlPos p
	);

The getPosDirZ() function returns nonzero if the values associated with a position identifier include a tool axis as normalized IJK coordinates. This points from the tool tip back along the tool towards the machine. In a toolpath, this value comes from the "tool axis" curve.

getPosDirZObj()

RoseObject * getPosDirZObj(StixCtlPos p);

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

getPosIsEqual()

int getPosIsEqual(
	StixCtlPos p1,
	StixCtlPos p2
	);

The getPosIsEqual() 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 (p.getActiveType() == STIXCTL_TYPE_MOVE)
{
    if (p.getPosIsEqual(p.getMoveEnd(), p.getLastPos())) {
 	// Skip moves where start and end positions are the
 	// same.  Happens at toolpath connections, composite
 	// curves, and so on.
    }
}

getPosLenUnit()

RoseUnit getPosLenUnit(StixCtlPos p);

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

getPosParam()

double getPosParam (StixCtlPos p);

The getPosParam() 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 getActiveParam() or getFrameParam() 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.

getPosSpeedRatio()

int getPosSpeedRatio (
	double &num,
	StixCtlPos p
	);

The getPosSpeedRatio() function returns nonzero if the values associated with a position identifier include a speed override. 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.

getPosSpeedRatioObj()

RoseObject * getPosSpeedRatioObj(StixCtlPos p);

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

getPosType()

int getPosType(StixCtlPos p);

#define STIXCTL_POS_END		0
#define STIXCTL_POS_START 	1
#define STIXCTL_POS_ARC 	2

The getPosType() function returns an integer value that identifies the role of the position. Common values are STIXCTL_POS_END, STIXCTL_POS_START, and STIXCTL_POS_ARC.

getPosXYZ()

int getPosXYZ(
	double ret_xyz[3],
	StixCtlPos p,
	RoseUnit u = roseunit_as_is
	);

The getPosXYZ() function returns nonzero if the values associated with a position identifier include a position in space as XYZ cartesian coordinates. If the value is present, it is copied into the array parameter. If an optional length unit is given, the value will be converted to that unit. In a toolpath, this value comes from the "basic curve" property.

getPosXYZObj()

RoseObject * getPosXYZObj(StixCtlPos p);

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

getPosXsectParms()

int getPosXsectParms(
	double ijk[7],
	StixCtlPos p,
	RoseUnit u = roseunit_as_is
	);

The getPosXsectParms() function returns nonzero if the values associated with a position identifier include a set of cross section parameters. If the value is present, it is copied into the array parameter. If an optional length unit is given, the parameters will be converted to that unit. In a toolpath, this value comes from the "cross section area parameters" property.

getPosXsectObj()

RoseObject * getPosXsectObj(StixCtlPos p);

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

getProbeDirection()


int getProbeDirection (
	double ret_ijk[3],
	StixCtlPos p
	);

The getProbeDirection() function finds the measurement direction of a probing operation and copies the normalized IJK components into the provided array. The position parameter should be a value from the getMoveProbe() function. The function should always return a nonzero value.

getProbeDirectionObj()

stp_direction * getProbeDirectionObj(
	StixCtlPos p
	);

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

getProbeEnd()

int getProbeEnd (
	double ret_xyz[3],
	StixCtlPos p,
	RoseUnit u = roseunit_as_is
	);

The getProbeEnd() function finds the expected ending position of a probing operation and copies the XYZ coordinates into the provided array. If an optional length unit is given, the value will be converted to that unit. The position parameter should be a value from the getMoveProbe() function. The function should always return a nonzero value.

getProbeExpected()

double getProbeExpected(
	StixCtlPos p,
	RoseUnit u = roseunit_as_is
	);

The getProbeExpected() 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 getMoveProbe() function.

getProbeExpectedObj()

stp_measure_representation_item * getProbeExpectedObj(
	StixCtlPos p
	);

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

getProbeStart()

int getProbeStart (
	double ret_xyz[3],
	StixCtlPos p,
	RoseUnit u = roseunit_as_is
	);

The getProbeStart() function finds the starting position of a probing operation and copies the XYZ coordinates into the provided array. If an optional length unit is given, the value will be converted to that unit. The position parameter should be a value from the getMoveProbe() function. The function should always return a nonzero value.

getProbeStartObj()

stp_axis2_placement_3d * getProbeStartObj(
	StixCtlPos p
	);

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

getProbeVar()

const char * getProbeVar(
	StixCtlPos p
	);

The getProbeVar() function returns the string name of the STEP-NC variable associated with the probing operation. The position parameter should be a value from the getMoveProbe() function. !-- ============================== -->

getProbeVarObj()

stp_expression_representation_item * getProbeVarObj(
	StixCtlPos p
	);

The getProbeVarObj() 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 getMoveProbe() function.

getProbeWorkpiece()

stp_product_definition * getProbeWorkpiece(
	StixCtlPos p
	);

The getProbeWorkpiece() function returns the STEP workpiece associated with the probing operation. The position parameter should be a value from the getMoveProbe() function.

getStackPosOfType()

unsigned getStackPosOfType(
	StixCtlType
	);

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

getStackSize()

unsigned getStackSize();

The getStackSize() 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 "getActive" 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.

void printstack(StixCtlCursor &ctl)
{
    unsigned i,sz;
    for (i=0,sz=ctl.getStackSize(); idomain()->name(): ""),
	       (obj? obj->entity_id(): 0),
	       ctl.getFrameParam(i)
	    );
    }
}

getVisitAllExecs()

int getVisitAllExecs()

The getVisitAllExecs() function describes how the cursor picks executables to visit on a traversal. Use setVisitAllExecs() 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.

getWanted()

int getWanted(StixCtlEvent e);

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

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

next()

StixCtlEvent next();

The next() function advances the cursor until the next event of interest. The return value indicates an event, or a zero value (STIXCTL_DONE) when finished. The return value is also available by calling event().

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

the function returns STIXCTL_ERROR if a problem is seen. The errorMsg() function returns a description of the problem.

RoseDesign * design;
StixCtlCursor p;

p.startProject(design);
while (p.next())
{
    // process the events in p.event() 
}

reset()

void reset(); 

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

setVisitAllExecs()

void setVisitAllExecs(int yn)

The setVisitAllExecs() 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.

setWanted()

void setWanted(StixCtlEvent e, int val = 1);

The setWanted() 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 setWantedAll() function can turn all events on or off with a single call. See StixCtlEvent for a full list of events.

The following example turns some events on and off.

StixCtlCursor p;

// turn on all events for executables 
p.setWanted(STIXCTL_EXEC_WORKPLAN_START);
p.setWanted(STIXCTL_EXEC_WORKPLAN_NEXT);
p.setWanted(STIXCTL_EXEC_WORKPLAN_END);
p.setWanted(STIXCTL_EXEC_SELECT_START);
p.setWanted(STIXCTL_EXEC_SELECT_END);
p.setWanted(STIXCTL_EXEC_WORKSTEP_START);
p.setWanted(STIXCTL_EXEC_WORKSTEP_END);
p.setWanted(STIXCTL_EXEC_OTHER_START);
p.setWanted(STIXCTL_EXEC_OTHER_END);
p.setWanted(STIXCTL_EXEC_NCFUN);


// turn off notification for NC functions
p.setWanted(STIXCTL_EXEC_NCFUN, 0);

setWantedAll()

void setWantedAll(int val);

The setWantedAll() function sets a boolean value for all known events indicating whether the cursor will stop for that event. Use setWanted() to control an individual event. See StixCtlEvent for a full list of events.

StixCtlCursor p;

p.setWantedAll(1);	// turn all events on
p.setWantedAll(0);	// turn all events off

startExec()

void startExec(
	stp_machining_process_executable * mpe
	);

The startObject() function initializes the cursor to begin traversing the given process executable. This will overwrite any traversal that was in progress, but does not change or reset any of the events selected by setWanted().

startProject()

void startProject(RoseDesign * d);

The startProject() function initializes the cursor to begin traversing the STEP-NC project in the file. This will overwrite any traversal that was in progress, but does not change or reset any of the events selected by setWanted().