查看单个帖子
旧 2009-05-06, 02:20 PM   #1
yang686526
高级会员
 
注册日期: 06-11
帖子: 14579
精华: 1
现金: 224494 标准币
资产: 234494 标准币
yang686526 向着好的方向发展
默认 【转帖】how to check entity type when looping through db

how to check entity type when looping through db
how to check entity type when looping through db
i am using c#. how do i chech the entity type when i loop through all entities in a database?
how do i get all the linetype definitions? it used to be pen down on positive number and pen up on negative number.....
how do i find the shape file and read the symbols?...
thanks
entity type:
you can determine if an entity (or object) is of specific type or derived from some class using isa() and iskindof() methods of odrxobject:
if (pobj->iskindof(oddbentity::desc())
if (pobj->isa(oddbole2frame::desc())
other method
oddblineptr pline = oddbline::cast(pobj);
if (!pline.isnull())
{ // this is line
}
if you need to process a number of different entities (to have some kind of switch) the most effective way is to use protocol extensions (see odreadex sample).
line type data:
it is stored in oddblinetypetablerecord objects.
what shape data do you want to access?
sergey slezkin
thanks....
when i was using the odx, the shape entity has an objecthandle points to a symbol file and has an index to the symbol in symbol file. how do i get those info now?...
from dbshape.h:
odint16 shapenumber() const;
oddbobjectid styleid() const;
last function returns id of oddbtextstyletablerecord.
sergey slezkin
when using typelib viewer to open odax.dll, i don't see any properties match "styleid" or "shapenumber" under acadshape....
should i look somewhere else???
sorry, all i wrote is about c++ interface. using activex you have access only to shape name (dxf group code 2)
sergey slezkin
i have to make decision on what library to use. is the activex going to match the c++ interface in the future?
no. activex interface will never be like c++ one.
c++ interface is similar to objectarx/dbx.
acitivex interface mimics autocad's vba. it can be use from basic, delphi etc. but c++ interface provides more control.
sergey slezkin
yang686526离线中   回复时引用此帖
GDT自动化论坛(仅游客可见)