几何尺寸与公差论坛------致力于产品几何量公差标准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)
-   -   【转帖】how do i get the type of the entity (http://www.dimcax.com/hust/showthread.php?t=16579)

yang686526 2009-05-05 12:28 PM

【转帖】how do i get the type of the entity
 
how do i get the type of the entity?
how do i get the type of the entity?
i have a bit of a problem and can't work it out.
i have this object:
oddbentityptr pent;
from the above information, how can i get a text string that says it is a polyline, circle etc?
i tried pent->desc->name() but that returned oddbentity...
the desc() function is a static member, and is supposed to be used as a descriptor of a certain class, i.e. oddbpolyline::desc(), oddblayertablerecord::desc(), etc.
the function you need is isa(). pent->isa()->name() would return the real string type of entity (but in objectarx notation - for example "acdbpolyline", not "oddbpolyline"). it is virtual and you can use through parent pointers.
you probably know that to check the type of an object you must use iskindof() function - iskindof(oddbline::desc()) - this is the place to use the static desc() member function.
hope this helps.
regards
chudomir
quote:
originally posted by chudo
the function you need is isa(). pent->isa()->name() would return the real string type of entity (but in objectarx notation - for example "acdbpolyline", not "oddbpolyline"). it is virtual and you can use through parent pointers.
you probably know that to check the type of an object you must use iskindof() function - iskindof(oddbline::desc()) - this is the place to use the static desc() member function.
hi
for some reason, i did not get an email notification, so i am glad i checked! but yes, this is exactly what i need. i do indeed use iskindof to test the entity type, but i only do that to locate two entity types - 3d polyline and block reference. any other entity type is not allowed, and thus i wanted to know the entity type to give the user feedback.
thank you for resolving this for me.
andrew


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