Overview

The StixCtlPos is an opaque type identifies position information held by a StixCtlCursor. The position data may include all known aspects of a tool path location, such as the tool axis, surface normal, etc. This may come directly from STEP data or be interpolated from MTConnect or a curve solver. Fields declare the purpose, coordinate system and units so that we can convert as needed.

The getMoveEnd() function returns a position identifier for the end of a movement. Using the getPosXYZ(), getPosDirZ(), and related functions, you can get the location, tool axis, and other parameters.

The getMoveArc() and getMoveProbe() functions return identifiers for special positions held by certain types of process elements. These have their own series of access functions with the getArc or getProbe prefix.

StixCtlPos Definition

typedef unsigned StixCtlPos;

Position Details

A position has some combination of the following information. The query functions all return nonzero if a value is present and zero if the value is missing.
Position
The position in space as XYZ cartesian coordinates. In a toolpath, this value comes from the "basic curve". Retrieve with the getPosXYZ() function, which also accepts a unit enum for unit conversion.
Z Direction
The 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. Retrieve with the getPosDirZ() function.
X Direction
The 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. Retrieve with the getPosDirX() function.
Surface Normal Direction
The surface normal 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. Retrieve with the getPosDirSnorm() function.
Movement Direction
The direction of motion along the toolpath, as normalized IJK coordinates. This value is calculated from the toolpath. Retrieve with the getPosDirMove() function.
Speed Override
A single number, 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. Retrieve with the getPosSpeedRatio() function.
Cross Section Parameters
A series of seven numbers that characterize area of material removed at that point, measured perpendicular to the cutting tool axis. In a toolpath, this value comes from the "speed profile" curve property. Retrieve with the getPosXsectParms() function.
Position Type
An integer value that identifies the role of the position. Common values are STIXCTL_POS_END, STIXCTL_POS_START, and STIXCTL_POS_CENTER. Retrieve with the getPosType() function.
Coordinate System
The cursor may have several copies of a position in different coordinate systems. There will always be one in the working coordinate system with all transforms applied (STIXCTL_CSYS_WCS) and there may also be one with raw coordinates as they appear in the toolpath curves, before any transforms are applied (STIXCTL_CSYS_RAW). Retrieve with the getPosCsys() function.
Units
A position has length and angle units so that we can convert values when a different unit is needed. Retrieve with the getPosLenUnit() and getPosAngUnit() functions.

Examples

The simple cursor below gets the endpoint of every move and prints the location and tool axis.

StixCtlCursor ctl;
ctl.startProject(design);

while (ctl.next())
{
    // by default only stops at STIXCTL_MOVE events
    StixCtlPos pos = ctl.getMoveEnd();
    double v[3];

    if (ctl.getPosXYZ(v, pos))
	printf ("  XYZ: %.5g %.5g %.5g", v[0], v[1], v[2]);
    
    if (ctl.getPosDirZ(v, pos))
	printf ("  TOOL AXIS: %.5g %.5g %.5g", v[0], v[1], v[2]);
}

The sample function below prints all information available for a given position.

void printpos(StixCtlCursor &ctl, StixCtlPos p)
{
    double v[3];
    printf ("POSID: %u  typ %d", p, ctl.getPosType(p));
    switch (ctl.getPosCsys(p)) {
    case STIXCTL_CSYS_WCS:	printf(" WCS"); break;
    case STIXCTL_CSYS_RAW:	printf(" RAW"); break;
    case STIXCTL_CSYS_PART:	printf(" PART"); break;
    default: printf(" unknown cs"); break;
    }

    if (ctl.getPosXYZ(v, p))
	printf ("  XYZ: %.5g %.5g %.5g", v[0], v[1], v[2]);
    
    if (ctl.getPosDirZ(v, p))
	printf ("  ZDIR: %.5g %.5g %.5g", v[0], v[1], v[2]);

    if (ctl.getPosDirX(v, p))
	printf ("  XDIR: %.5g %.5g %.5g", v[0], v[1], v[2]);

    if (ctl.getPosDirSnorm(v, p))
	printf ("  SN: %.5g %.5g %.5g", v[0], v[1], v[2]);

    if (ctl.getPosDirMove(v, p))
	printf ("  MOVE: %.5g %.5g %.5g", v[0], v[1], v[2]);

    if (ctl.getPosSpeedRatio(v[0], p))
	printf ("  SPEED: %.5g", v[0]);

    printf ("  %s/%s",
	    rose_get_unit_name(ctl.getPosLenUnit(p)),
	    rose_get_unit_name(ctl.getPosAngUnit(p)));
    printf ("\n");
    
}