高级会员
注册日期: 06-11
帖子: 14579
精华: 1
现金: 224494 标准币
资产: 234494 标准币
|
【转帖】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
|