APIIo_​GetArcID

Performs an arc input.

    GSErrCode ACAPI_Interface (
        APIIo_GetArcID,
        API_GetArcType*         arcInfo,
        RubberLineInfoProc*     rubberLineInfoProc
    );

 

Parameters

arcInfo
[in/out] Parameters of the arc input operation.
rubberLineInfoProc
[in] Callback function for custom feedback drawing.

 

Return Values

NoError
The function has completed with success.
APIERR_BADPARS
arcInfo is nullptr
APIERR_BADPLANE
invalid plane definition in arcInfo
APIERR_BADWINDOW
the operation cannot be performed in the current front window of the application
APIERR_CANCEL
the input was canceled by the user

For other common API errors see the API Errors document.

 

Remarks

This function is used to let the user input an arc graphically.

If the input process has failed, the function returns APIERR_CANCEL. Otherwise the result is returned in the startCoord (if the start coordinate has not been given before the arc input), negArc, pos and neig fields of arcInfo.

The center point and the start point of the arc can be defined directly, or entered graphically with the APIIo_GetPointID and APIIo_GetLineID interface functions.

The prompt string displayed in the control box which can contain instructions about the action. You can control the cursor gravity above neigs and the cursor shapes, and set the input plane. There is a possibility of drawing own graphical feedback during the input with passing a pointer to your rubber line callback function. For more details on the utilization refer to the documentation of the API_GetArcType structure.

Do not invoke any input operation while there are modal dialogs open.

 

Example


API_GetPointType    pointInfo;
API_GetLineType     lineInfo;
API_GetArcType      arcInfo;
char                buffer [256];
GSErrCode           err;

BNZeroMemory (&pointInfo, sizeof (API_GetPointType));
BNZeroMemory (&lineInfo, sizeof (API_GetLineType));
BNZeroMemory (&arcInfo, sizeof (API_GetArcType));

CHCopyC ("Click the arc center point", pointInfo.prompt);
pointInfo.changeCursorSet = true;

/* show cross cursors suggesting the center point */
pointInfo.cursorSet.nothingOnCursor     = APICursor_XPoint;
pointInfo.cursorSet.pointOnCursor       = APICursor_ArrowXPoint;
pointInfo.cursorSet.lineOnCursor        = APICursor_PencilXPoint;
pointInfo.cursorSet.refPointOnCursor    = APICursor_ArrowXPoint;
pointInfo.cursorSet.refLineOnCursor     = APICursor_PencilXPoint;
pointInfo.cursorSet.crossOnCursor       = APICursor_ArrowXPoint;
pointInfo.cursorSet.normalOnCursor      = APICursor_PencilXPoint;
pointInfo.cursorSet.tangentOnCursor     = APICursor_ArrowXPoint;

err = ACAPI_Interface (APIIo_GetPointID, &pointInfo, nullptr);

if (!err) {
    CHCopyC ("Enter the arc start point", lineInfo.prompt);
    lineInfo.startCoord = pointInfo.pos;
    lineInfo.changeCursorSet = true;

    /* use hand cursors for drawing the radius of the arc */
    lineInfo.cursorSet.nothingOnCursor  = APICursor_Hand;
    lineInfo.cursorSet.pointOnCursor    = APICursor_MiniHand;
    lineInfo.cursorSet.lineOnCursor     = APICursor_MiniHand;
    lineInfo.cursorSet.refPointOnCursor = APICursor_MiniHand;
    lineInfo.cursorSet.refLineOnCursor  = APICursor_MiniHand;
    lineInfo.cursorSet.crossOnCursor    = APICursor_MiniHand;
    lineInfo.cursorSet.normalOnCursor   = APICursor_MiniHand;
    lineInfo.cursorSet.tangentOnCursor  = APICursor_MiniHand;

    err = ACAPI_Interface (APIIo_GetLineID, &lineInfo, nullptr);
}

if (!err) {
    CHCopyC ("Enter the arc end point", arcInfo.prompt);
    arcInfo.origo = lineInfo.startCoord;
    arcInfo.startCoord = lineInfo.pos;
    arcInfo.startCoordGiven = true;
    arcInfo.changeCursorSet = true;

    /* use eye cursors for getting the arc */
    arcInfo.cursorSet.nothingOnCursor   = APICursor_Eye;
    arcInfo.cursorSet.pointOnCursor     = APICursor_DoubleEye;
    arcInfo.cursorSet.lineOnCursor      = APICursor_DoubleEye;
    arcInfo.cursorSet.refPointOnCursor  = APICursor_DoubleEye;
    arcInfo.cursorSet.refLineOnCursor   = APICursor_DoubleEye;
    arcInfo.cursorSet.crossOnCursor     = APICursor_DoubleEye;
    arcInfo.cursorSet.normalOnCursor    = APICursor_DoubleEye;
    arcInfo.cursorSet.tangentOnCursor   = APICursor_DoubleEye;

    err = ACAPI_Interface (APIIo_GetArcID, &arcInfo, nullptr);
}

if (!err) {
    sprintf (buffer, "Origo coordinates:  (%Lf, %Lf)", arcInfo.origo.x, arcInfo.origo.y);
    ACAPI_WriteReport (buffer, false);
    if (arcInfo.negArc)
        sprintf (buffer, "Arc begins:  (%Lf, %Lf)\nArc ends:    (%Lf, %Lf)",
                arcInfo.pos.x, arcInfo.pos.y, arcInfo.startCoord.x, arcInfo.startCoord.y);
    else
        sprintf (buffer, "Arc begins:  (%Lf, %Lf)\nArc ends:    (%Lf, %Lf)",
                arcInfo.startCoord.x, arcInfo.startCoord.y, arcInfo.pos.x, arcInfo.pos.y);
    ACAPI_WriteReport (buffer, false);
} else if (err == APIERR_CANCEL)
    ACAPI_WriteReport ("Input was interrupted", true);

 

Requirements

Version: API 2.1 or later
Header: APIdefs_Interface.h

 

See Also

API_GetArcType,
RubberLineInfoProc, APIIo_DrawRubberLineID, APIIo_GetPointID, APIIo_GetLineID, APIIo_GetPolyID,
ACAPI_Interface, API Functions