几何尺寸与公差论坛------致力于产品几何量公差标准GD&T (GDT:ASME)|New GPS(ISO)研究/CAD设计/CAM加工/CMM测量

几何尺寸与公差论坛------致力于产品几何量公差标准GD&T (GDT:ASME)|New GPS(ISO)研究/CAD设计/CAM加工/CMM测量 (http://www.dimcax.com/hust/index.php)
-   DirectDWG (http://www.dimcax.com/hust/forumdisplay.php?f=89)
-   -   【转帖】determine oddbentity type (http://www.dimcax.com/hust/showthread.php?t=15674)

yang686526 2009-05-04 07:22 PM

【转帖】determine oddbentity type
 
determine oddbentity type
determine oddbentity type
following code:
oddbobjectiteratorptr it = pblock->newiterator();
for (it->start(); !it->done(); it->step())
{
oddbentityptr pent = it->objectid().safeopenobject();
if( pent->iskindof( oddbline::desc() ) )
{
}
}
so this works! but i would prefer another way like:
switch( pent->getentitytype() )
{
case oddbentity::kline:
case oddbentity::kcircle:
}
couldn't find anything!
any suggestions?
thanx
robert
you can eighter initialize a map<odrxclass*,somefunctionpointer> and to maintain it by your self, or to use the extension classes functionality provided by dwgdirect.
or just the if,else,if,else structure. but the extension classes would be the reccommended solution in this case.
hope this helps.
regards
chudomir
>but the extension classes would be the reccommended solution in this case.
hi thanx,
but what do you mean by extension classes how to use them?
an example would be nice!
thanx
rob
protocol extensions is a method to add your own interface to rxobjects.
using protocol extesions is illustrated in odreadex sample.
sergey slezkin
oh so now i understand but it seems like this works also with the desc()
is this right?
greets and thanx again
rob
desc() returns pointer. it will work with if() else if()...
but not with switch-case.
sergey slezkin


所有的时间均为北京时间。 现在的时间是 11:56 PM.