ObjectARX, AutoCAD. Среда программирования библиотеки C++


     Ангел из мрамора на сайте http://mskmonument.ru. |     

Compute the reflected energy in


if (pRegion->getArea(retVal) != Acad::eOk)
return -1.0;
return retVal * 42.0;
}
// AsdkEntTemperature implementation for circles
//
class AsdkCircleTemperature : public AsdkEntTemperature
{
public:
virtual double reflectedEnergy(AcDbEntity* pEnt) const;
};
double
AsdkCircleTemperature::reflectedEnergy( AcDbEntity* pEnt) const
{
AcDbCircle *pCircle = AcDbCircle::cast(pEnt);
// Compute the reflected energy in a manner distinctly
// different than for AcDbRegion.
//
return pCircle->radius() * 6.21 * 42.0;
}
// This function has the user select an entity and then
// calls the reflectedEnergy() function in the protocol
// extension class attached to that entity’s class.
//
void
energy()
{
AcDbEntity *pEnt;
AcDbObjectId pEntId;
ads_name en;
ads_point pt;
if (acedEntSel("\nSelect an Entity: ", en, pt) != RTNORM)
{
acutPrintf("Nothing Selected\n");
return;
}
acdbGetObjectId(pEntId, en);
acdbOpenObject(pEnt, pEntId, AcDb::kForRead);
// call the protocol extension class’s method
//
double eTemp = ACRX_X_CALL(pEnt, AsdkEntTemperature)->reflectedEnergy(pEnt);
acutPrintf("\nEnergy == %f\n", eTemp);
pEnt->close();
}
// Pointers for protocol extension objects. These pointers
// are global so that they can be accessed during
// initialization and cleanup.
//
AsdkDefaultTemperature *pDefaultTemp;
AsdkRegionTemperature *pRegionTemp;
AsdkCircleTemperature *pCircleTemp;
// Initialization function called from acrxEntryPoint() during
// kInitAppMsg case. This function is used to add commands
// to the command stack and to add protocol extension
// objects to classes.
//
void
initApp()
{
acrxRegisterService("AsdkTemperature");
AsdkEntTemperature::rxInit();
acrxBuildClassHierarchy();
pDefaultTemp = new AsdkDefaultTemperature();
pRegionTemp = new AsdkRegionTemperature();
pCircleTemp = new AsdkCircleTemperature();
// Add the protocol extension objects to the appropriate

Содержание  Назад  Вперед