- 积分
- 909
- 明经币
- 个
- 注册时间
- 2005-4-1
- 在线时间
- 小时
- 威望
-
- 金钱
- 个
- 贡献
-
- 激情
-
|
class AdskEntTemperature : public AcRxObject { public: ACRX_DECLARE_MEMBERS( AsdkEntTemperature );
virtual double reflectedEnergy( AcDbEntity * ) const = 0; };
ACRX_NO_DEFINE_MEMBERS( AsdkEntTemperature, AcRxObject);
//////////////////////////////////////
class AdskDefaultTemperature : public AdskEntTemperature { public: virtual double reflectedEnergy(AcDbEntity * pEnt) const;
}
double AdskDefaultTemperature::reflectedEnergy(AcDbEntity * pEnt) const { acutPrintf("\nThis entity has no aarea, and no reflection.\n"); return -1.0;
}
////////////////////////////////////// class AdskRegionTemperature : public AdskEntTemperature { public: virtual double reflectedEnergy(AcDbEntity * pEnt) const;
}
double AdskRegionTemperature::reflectedEnergy(AcDbEntity * pEnt) const { AcDbRegion * pRegion = AcDbRegion::cast( pTnt ); if ( pRegion == NULL ) acutPrintf("\nThis impossible has happened!\n");
double retVal; if (pRegion->getArea( retVal ) != Acad::eOK ) return -1.0; return retVal*42.0;
}
////////////////////////////////////// class AdskCircleTemperature : public AdskEntTemperature { public: virtual double reflectedEnergy(AcDbEntity * pEnt) const;
}
double AdskCircleTemperature::reflectedEnergy(AcDbEntity * pEnt) const { AcDbCircle * pCircle = AcDbCircle::cast( pTnt ); if ( pCircle == NULL ) acutPrintf("\nThis impossible has happened!\n");
return pCircle->radius()*6.21*42.0;
}
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 );
double eTemp = ACRX_X_CALL( pEnt, AsdkEntTemperature ) ->reflectedEnergy( pEnt ); acutPrintf("\nEnergy == %f \n", eTemp ); pEnt->close(); }
为什么我在入口函数文件头中一定义上述头文件,就会出错:
d:\AutoCAD二次开发\cascoacds\adskenttemperature.h(8) : error C2143: syntax error : missing ';' before '*' d:\autocad二次开发\cascoacds\adskenttemperature.h(8) : error C2501: 'cast' : missing storage-class or type specifiers d:\autocad二次开发\cascoacds\adskenttemperature.h(8) : warning C4183: 'cast': member function definition looks like a ctor, but name does not match enclosing class d:\autocad二次开发\cascoacds\adskenttemperature.h(13) : error C2065: 'AsdkEntTemperature' : undeclared identifier d:\autocad二次开发\cascoacds\adskenttemperature.h(13) : error C2275: 'AcRxObject' : illegal use of this type as an expression c:\objectarx2002\inc\rxobject.h(33) : see declaration of 'AcRxObject' d:\autocad二次开发\cascoacds\adskenttemperature.h(13) : error C2501: 'ACRX_NO_DEFINE_MEMBERS' : missing storage-class or type specifiers d:\autocad二次开发\cascoacds\adskenttemperature.h(13) : error C2078: too many initializers
应该是什么地方的设置不对,请做过的各位前辈指点。先谢谢你们了。 |
|