几何尺寸与公差论坛------致力于产品几何量公差标准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 to check entity type when looping through db (http://www.dimcax.com/hust/showthread.php?t=16619)

yang686526 2009-05-06 02:20 PM

【转帖】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


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