Using Protocol Extension Functionality in an Application

To make use of protocol extension functionality, you need to obtain the class descriptor object for a particular class. Once you have obtained a pointer to the class descriptor object, you can call any of the methods for that class. The following is an example of using the AsdkEntTemperature protocol extension for the AcDbEntity class:

AcDbEntity *pEnt;
AsdkEntTemperature *pTemp;
pTemp = AsdkEntTemperature::cast(
    pEnt->x(AsdkEntTemperature::desc()));
double eTemp = pTemp -> reflectedEnergy (pEnt);

You can use the ACRX_X_CALL macro to simplify this code as follows:

double eTemp = ACRX_X_CALL(pEnt,
     AsdkEntTemperature)->reflectedEnergy(pEnt);