高级会员
注册日期: 06-11
帖子: 14579
精华: 1
现金: 224494 标准币
资产: 234494 标准币
|
【转帖】problem reading subentities in dwginfields
problem reading subentities in dwginfields
problem reading subentities in dwginfields
hi,
we have created our own custom entity in autocad (dbx). saving and loading of a drawing with those entities goes great. but we also created a drx file to read the entities within our own viewer created with dwgdirect. and it crashes reading the subentities of our custom entity.
this is what we are trying to do:
odresult courcustom::dwginfields(oddbdwgfiler* pfiler)
{
assertreadenabled () ;
//----- read parent class information first.
odresult es = oddbentity::dwginfields (pfiler) ;
if ( es != eok )
return (es) ;
//----- object version number needs to be read first
int version = pfiler->rdint32();
//wrong version
if ( version > courcustom::lastknownversion )
return (emakemeproxy) ;
//-----
odint16 ifirstint = pfiler->rdint16();
odint16 isecondint = pfiler->rdint16();
odint16 ithirdint = pfiler->rdint16();
/// this is where the unhandled exception comes:
// reading the data that belongs to a lwpolyline
es = m_dbpolyline.dwginfields(pfiler);
return (pfiler->filerstatus ()) ;
}
it crashes in the function oddbdatabase::getmodelspaceid( ). my guess is it is because of that m_dbpolyline hasn't been added to the database.
but what to do about it? does someone knows a solution?
thanks in advance
yes, the problem is that dwginfields needs to know database of the entity. try to call m_dbpolyline.setdatabasedefaults() before calling dwginfields().
sergey slezkin
|