高级会员
注册日期: 06-11
帖子: 14579
精华: 1
现金: 224494 标准币
资产: 234494 标准币
|
【转帖】inherited entities
inherited entities
inherited entities
hello,
i have a problem at loading inherited entities:
when i define new class
----------------------------------------------------------------------------------------
class exoddbline : public oddbline
{
public:
oddb_declare_members(exoddbline);
}
odrx_dxf_define_members(exoddbline, oddbline, dbobject_constr, oddb::kdhl_current, oddb::kmreleasecurrent, 0, line, autocad);
exoddbline::rxinit();
odrxclassdictionary->putat("acdbline", exoddbline::desc());
----------------------------------------------------------------------------------------
opendwg library reads a line entity from dxf file directly into my new exoddbline class.
but, when i try similar with (ordinate) dimension:
----------------------------------------------------------------------------------------
class exoddbordinatedimension : public oddbordinatedimension
{
oddb_declare_members(exoddbordinatedimension);
}
odrx_dxf_define_members(exoddbordinatedimension, oddbordinatedimension, dbobject_constr, oddb::kdhl_current, oddb::kmreleasecurrent, 0, dimension, autocad);
exoddbordinatedimension::rxinit();
odrxclassdictionary->putat("acdbordinatedimension", exoddbordinatedimension::desc());
----------------------------------------------------------------------------------------
opendwg libary does not fill the data from ordinate dimension into my new class, but it fills it into oddbordinatedimension class.
what do i have to do, if i want that opendwg library fills the data directly into my new derived class of ordinate and other dimensions.
will this feature be available also at loading dwg files?
regards, tomaz
this method does not work while loading dwg files. it also does not work while loading dxf (for entities like polyline, vertex, dimension, insert).
what's the purpose of substituting run-time classes? maybe protocol extensions will work for you?
sergey slezkin
hi,
protocol extension do not work for me.
i need aditional data in some entities, so the best way to store it is in the entity class. if library do not create such class by default, i have to replace original class with my new one. (performance issue)
it would be nice, if it would work for dwg as it works for dxf.
regards, tomaz
standard way of storing additional data in entities is extended data (xdata) or xdictionary.
sergey slezkin
hello,
yes, i know that storing additional data should go into xdata, but this data is only needed while the application is running, and it is not stored into file.
1. entities are loaded.
2. entities are 'corrected' - also some additional data is stored in them
3. entities are converted to other format and written into file.
this is a converter from dxf/dwg into other file formats.
so, this functionality, that dwgdirect library creates inherited classes is not obligatory for the application, but it is the best way, to keep additional data, which is connected with each entity.
regards, tomaz
|