ACAPI_​Notify_​GetTranParams

Returns the transformation parameters of the actual edit operation.

    GSErrCode  ACAPI_Notify_GetTranParams (
        API_ActTranPars*     actTranPars
    );

 

Parameters

actTranPars
[out] The transformation parameters to be returned.

 

Return Values

NoError
The function has been executed without error.
APIERR_BADPARS
The actTranPars parameter is nullptr.

For other common API errors see the API Errors document.

 

Remarks

This function is used to get the parameters of the actual editing operation. The transformation data is valid only between a APINotifyElement_BeginEvents and the following APINotifyElement_EndEvents notification.

By using this function your add-on is able to update some elements according to the user’s edit action.

 

Example


[ ... ]

API_Neig        **neig;
API_ActTranPars actTranPars;
API_EditPars    editPars;
Int32           elemIndex = 1;      // transform this element according to
GSErrCode       err;                // the last user edit parameters

    case APINotifyElement_Edit:

            BNZeroMemory (&editPars, sizeof (API_EditPars));

            ACAPI_Notify_GetTranParams (&actTranPars);

            switch (actTranPars.typeID) {
                case APIEdit_Drag:
                        editPars.typeID = APIEdit_Drag;
                        editPars.begC.x = 0.0;
                        editPars.endC.y = 0.0;
                        editPars.endC.z = 0.0;
                        editPars.endC.x = actTranPars.theDisp.x;
                        editPars.endC.y = actTranPars.theDisp.y;
                        editPars.endC.z = actTranPars.theDispZ;
                        break;
                case APIEdit_Rotate:
                        editPars.typeID = APIEdit_Rotate;
                        editPars.origC = actTranPars.theOrigo;
                        editPars.begC.x = editPars.origC.x + 1.0;
                        editPars.begC.y = editPars.origC.y;
                        editPars.begC.z = 0.0;
                        editPars.endC.x = editPars.origC.x + actTranPars.theCosA;
                        editPars.endC.y = editPars.origC.y + actTranPars.theSinA;
                        editPars.endC.z = 0.0;
                        break;
                case APIEdit_Mirror:
                        editPars.typeID = APIEdit_Mirror;
                        editPars.begC.x = actTranPars.theOrigo.x;
                        editPars.begC.y = actTranPars.theOrigo.y;
                        editPars.begC.z = 0.0;
                        editPars.endC.x = actTranPars.theOrigo.x + actTranPars.theAxeVect.x;
                        editPars.endC.y = actTranPars.theOrigo.y + actTranPars.theAxeVect.y;
                        editPars.endC.z = 0.0;
                        break;
                case APIEdit_Stretch:
                        editPars.typeID = APIEdit_Stretch;
                        editPars.endC.x = actTranPars.theDisp.x;
                        editPars.endC.y = actTranPars.theDisp.y;
                        editPars.endC.z = 0.0;
                        break;
            }

            editPars.withDelete = true;

            neig = reinterpret_cast<API_Neig**> BMAllocateHandle (sizeof (API_Neig), ALLOCATE_CLEAR, 0);
            if (neig != nullptr) {
                (*neig)[0].neigID  = APINeig_CircOn;
                (*neig)[0].index   = elemIndex;
                (*neig)[0].inIndex = 1;

                err = ACAPI_Element_Edit (neig, 1, &editPars);
                if (err != NoError)
                    GiveMessage_Err ("Error in ACAPI_Element_Edit", err);

                BMKillHandle (reinterpret_cast<GSHandle *> &neig);
            }
        }
        break;
}

 

Requirements

Version: API 4.1 or later
Header: ACAPinc.h

 

See Also

API_ActTranPars,
Notification Manager, API Functions