APIIo_​DrawRubberLineID

Draws graphical feedback during an input process.

    GSErrCode ACAPI_Interface (
        APIIo_DrawRubberLineID,
        API_RubberLineType*     rubberLine
    );

 

Parameters

rubberLine
[in] Definition of the line to be drawn.

 

Return Values

NoError
The function has completed with success.
APIERR_GENERAL
no rubber line callback function has been defined

For other common API errors see the API Errors document.

 

Remarks

This function is used to draw rubber lines while a user input. The function can be called only from the RubberLineInfoProc passed to the given input function; APIIo_GetPointID or APIIo_GetLineID or APIIo_GetArcID or APIIo_GetPolyID.

The line is defined with the two endpoint coordinates.

6.1  Note that during an input in the 3D model window the z coordinate can also be used to draw the feedback.

 

Example


/*------------------------------------------------------**
** Callback function to draw the rubber lines           **
**------------------------------------------------------*/
static void __ACENV_CALL    RubberLineCallBack (const API_RubberLineInfo *info)

{
    API_RubberLineType  rubberLine;

    BNZeroMemory (&rubberLine, sizeof (API_RubberLineType));

    rubberLine.lineThick = APIRubberLine_Simple;
    /* draws a unit square around the actual cursor position */

    rubberLine.c2.x = info->actCoord.x - 0.5;
    rubberLine.c2.y = info->actCoord.y - 0.5;
    rubberLine.c2.z = info->actCoord.z;
    rubberLine.c1 = rubberLine.c2;
    rubberLine.c2.y += 1.0;
    ACAPI_Interface (APIIo_DrawRubberLineID, &rubberLine, nullptr);

    rubberLine.c1 = rubberLine.c2;
    rubberLine.c2.x += 1.0;
    ACAPI_Interface (APIIo_DrawRubberLineID, &rubberLine, nullptr);

    rubberLine.c1 = rubberLine.c2;
    rubberLine.c2.y -= 1.0;
    ACAPI_Interface (APIIo_DrawRubberLineID, &rubberLine, nullptr);

    rubberLine.c1 = rubberLine.c2;
    rubberLine.c2.x -= 1.0;
    ACAPI_Interface (APIIo_DrawRubberLineID, &rubberLine, nullptr);

    return;
}

/*------------------------------------------------------**
** Filtered point input with rubberline feedback        **
**------------------------------------------------------*/
void    PutColumnOnAHotspot (void)

{
    GSErrCode           err;
    API_GetPointType    pointInfo;
    API_Element         elem;

    BNZeroMemory (&pointInfo, sizeof (API_GetPointType));
    CHCopyC ("Click onto a hotspot to create column", pointInfo.prompt);

    pointInfo.changeFilter = true;        /* let the cursor gravitate to hotspot neigs only */
    ACAPI_Interface (APIIo_InitNeigFilterID, pointInfo.filter, (void *) APIInitNeigFilter_Empty);
    ACAPI_Interface (APIIo_SetNeigFilterID, pointInfo.filter, (void *) APINeig_Hot);

    err = ACAPI_Interface (APIIo_GetPointID, &pointInfo, (void *) RubberLineCallBack);

    if (err) {
        if (err == APIERR_CANCEL)
            ACAPI_WriteReport ("Input was interrupted", true);
        else
            ACAPI_WriteReport ("Error in GetPoint", true);
    } else {
        if (pointInfo.neig.neigID != APINeig_Hot) {
            ACAPI_WriteReport ("There is no hotspot at the clicked position", true);
        } else {
            BNZeroMemory (&elem, sizeof (API_Element));
            elem.header.type = API_ColumnID;
            err = ACAPI_Element_GetDefaults (&elem, nullptr);
            if (err == NoError) {
                elem.column.origoPos.x = pointInfo.pos.x;
                elem.column.origoPos.y = pointInfo.pos.y;
                err = ACAPI_Element_Create (&elem, nullptr);
            }
        }
    }

    return;
}

 

Requirements

Version: API 2.1 or later
Header: APIdefs_Interface.h

 

See Also

API_RubberLineType RubberLineInfoProc
APIIo_GetPointID
APIIo_GetLineID
APIIo_GetArcID
APIIo_GetPolyID
APIIo_DrawRubberArcID
ACAPI_Interface
API Functions