查看单个帖子
旧 2009-05-07, 12:33 PM   #1
yang686526
高级会员
 
注册日期: 06-11
帖子: 14579
精华: 1
现金: 224494 标准币
资产: 234494 标准币
yang686526 向着好的方向发展
默认 【转帖】reading entities 9using some custom data0

reading entities (using some custom data)
reading entities (using some custom data)
hello,
i am using dwgdirect 1.08.
is it possible, that dwgdirect library creates and returns object inherited from oddbline instead of object oddbline when reading entities from dxf/dwg file?
example:
class cline : public oddbline
{
private:
local_data;
public:
oddb_declare_members(cline);
}
main()
{
// read entities from block
if (pent->iskindof(cline))
{
... //do something with this line
}
}
can this be done?
how can i tell the library, to create and fill data into my inherited class instead of (oddbline)?
while i am writing to this forum, i would like an answer to another question
is method "isperiodic()" implemented for splines?
even if i create periodic spline, this function returns always false.
if this method is not yet implemented, i would like to know if it will be in next releases?
i really need to know these answers, so i will really appreciate any hint.
yes you can do this. after dd initialization and before file loading
you should call :
odrxclassdictionary()->putat("acdbline", cline ::desc());
you will also need to add the macro for defining the other methods needed:
class toolkit_export cline : public oddbline
{
public:
oddb_declare_members(cline);
i tried your suggestion and it works fine, when reading dxf files. but if library reads dwg files, my derived custom objects are not created (library still creates 'oddbline' object)
i defined members for cline like this:
odrx_dxf_define_members(cline,
oddbline,
dbobject_constr,
oddb::kdhl_1012,
oddb::kmrelease0,
0,
line,
autocad 2000)
is maybe something wrong with the parameter values in the macro?
what should i write in the place of dwgver, maintver, nproxyflags and appname?
am i doing something wrong, or is this functionality not supported for dwg files. is this maybe a bug?

hello,
i have one additional question.
in previous post i was asking if dwg direct library can read the entities data from dwg and dxf file into my custom derived objects (from original entities objects)
class myline : public oddbline
i got the answer for dxf file, but i still do not know why it does not work for dwg file.

now i tested the explode functionality ( in oddbpolyline enitity). is it possible, to tell dwgdirect library, to create myline and myarc objects instead of oddbline and oddbarc objects at exploding oddbpolyline entity?

regards, tomaz
this will not work while loading dwg file. only while loading dxf and creating new objects via createobject().
sergey slezkin

hi,
i am very disappointed to read this. i was almost sure, that user can use dwgdirect library for reading dwg and dxf files in the same way.
what is then the benefit of doing this for dxf files, if it can not be done for dwg?
i think, that this feature is very useful and it would be really nice, to have it implemented at loading dxf and dwg files.
is there a possibility that this will be implemented in the future?
if this will not be implemented, we have two choices, which are not very clean (and also not a good oo programming):
- have a parallel structures with additional data
- copy each entity from library to new custom entity and replace it with old one.
regards, tomaz
it's possible to implement this feature for loading dwg too but in 1.09 it do not work for dwg.
sergey slezkin

hello,
so, do you intend to implement it?
when do you think, this will be included in dwg direct library?
regards, tomaz
yang686526离线中   回复时引用此帖
GDT自动化论坛(仅游客可见)