APIIo_​SetConstraintID

Set the drawing constraint for graphical user input.

    GSErrCode ACAPI_Interface (
        APIIo_SetConstraintID,
        API_ConstraintPars*     constraintPars
    );

 

Parameters

constraintPars
[in] Parameters of the drawing constraint.

 

Return Values

NoError
The function has completed with success.
APIERR_BADPARS
constraintPars is nullptr
APIERR_BADID
Invalid type of drawing constraint in constraintPars

For other common API errors see the API Errors document.

 

Remarks

This function is used to set drawing constraint before the user input.

It could be called just before APIIo_GetPointID, APIIo_GetLineID, APIIo_GetArcID, APIIo_GetPolyID or in the addPolyNodeProc, delPolyNodeProc callback functions. After finishing the input do not forget to call APIIo_ResetConstraintID function.

 

Example


API_GetPointType    pointInfo;
API_GetLineType     lineInfo;
API_ConstraintPars  constPars;
Int32               ind;
char                buffer [256];
GSErrCode           err;

BNZeroMemory (&pointInfo, sizeof (API_GetPointType));
BNZeroMemory (&lineInfo, sizeof (API_GetLineType));
BNZeroMemory (&constPars, sizeof (API_ConstraintPars));


CHCopyC ("Click the first point of the line", pointInfo.prompt);

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

if (err == NoError) {
    constPars.constType = APIConst_X;
    constPars.constValue = 2.0;
    constPars.useLocOrigo = true;
    err = ACAPI_Interface (APIIo_SetConstraintID, &constPars, nullptr);
    if (err == NoError) {
        CHCopyC ("Enter the second point of the line", lineInfo.prompt);
        lineInfo.startCoord = pointInfo.pos;                  /* line starts with the clicked point */
        err = ACAPI_Interface (APIIo_GetLineID, &lineInfo, nullptr);
    }
    ACAPI_Interface (APIIo_ResetConstraintID, nullptr, nullptr);
}

if (err == APIERR_CANCEL)
    ACAPI_WriteReport ("Input was interrupted", true);

 

See also the Interface_Functions example project of APIDevKit.

 

Requirements

Version: API 6.1 or later
Header: APIdefs_Interface.h

 

See Also

APIIo_ResetConstraintID
API_ConstraintPars
API_GetPolyType
API_RubberPolyCallbacks
APIIo_GetPointID
APIIo_GetLineID
APIIo_GetArcID
ACAPI_Interface
API Functions