crash in oddbblockreference::explode
crash in oddbblockreference::explode
hello forum,
if you replace the codamfcappdoc:

nopendocument method by the code below and then open the attached dwg with the newly built odamfcappdll, you will get a crash in oddbblockreference::explode.
i use dwgdirect 2.6.1.
please could you fix the issue ?
code:
static void explodeblockrecursive(const oddbblockreferenceptr &inblockref)
{
odrxobjectptrarray entities ;
if(inblockref->explode(entities) == eok)
{
for(int i = 0 ; i < entities.length() ; i++)
{
if(entities[i]->iskindof(oddbblockreference::desc()))
{
oddbblockreferenceptr blockref = oddbblockreference::cast(entities[i]) ;
explodeblockrecursive(blockref) ;
}
}
}
}
bool codamfcappdoc:

nopendocument(lpctstr lpszpathname)
{
oddbdatabasedoc::setdoctoassign(this);
m_pdb = theapp.openfile(lpszpathname);
//oddbxrefman::loadall(m_pdb);
for ( odrxiteratorptr it = oddbdatabasecollection()->newiterator(); !it->done(); it->next())
trace_db_events(oddbdatabaseptr(it->object()));
oddbblocktablerecordptr blockrecord = m_pdb->getmodelspaceid().safeopenobject() ;
oddbobjectiteratorptr objectiterator = blockrecord->newiterator();
for(objectiterator->start() ; objectiterator->done() == false ; objectiterator->step())
{
oddbblockreferenceptr block = oddbblockreference::cast(objectiterator->objectid().safeopenobject()) ;
if(block.isnull() == false && block->handle() == oddbhandle(0x10d3a4))
{
explodeblockrecursive(block) ;
}
}
return (!m_pdb.isnull());
}attached files
it's not crash, it's c++ exception.
the reason is a circle entity with zero radius. it can't be transformed by block refernce matrix to ellipse entity.
autocad also can't transform it. in explode command it creates another block containing only zero-radius circle and makes block refence to it with the same transformation as the source block reference.
i entered cr 5202 for it into our bugzilla:
and fixed it (svn revision 140549)
sergey slezkin
quote:
originally posted by jerome roche
hello forum,
if you replace the codamfcappdoc:

nopendocument method by the code below and then open the attached dwg with the newly built odamfcappdll, you will get a crash in oddbblockreference::explode.
i use dwgdirect 2.6.1.
please could you fix the issue ?
code:
static void explodeblockrecursive(const oddbblockreferenceptr &inblockref)
{
odrxobjectptrarray entities ;
if(inblockref->explode(entities) == eok)
{
for(int i = 0 ; i < entities.length() ; i++)
{
if(entities[i]->iskindof(oddbblockreference::desc()))
{
oddbblockreferenceptr blockref = oddbblockreference::cast(entities[i]) ;
explodeblockrecursive(blockref) ;
}
}
}
}
bool codamfcappdoc:

nopendocument(lpctstr lpszpathname)
{
oddbdatabasedoc::setdoctoassign(this);
m_pdb = theapp.openfile(lpszpathname);
//oddbxrefman::loadall(m_pdb);
for ( odrxiteratorptr it = oddbdatabasecollection()->newiterator(); !it->done(); it->next())
trace_db_events(oddbdatabaseptr(it->object()));
oddbblocktablerecordptr blockrecord = m_pdb->getmodelspaceid().safeopenobject() ;
oddbobjectiteratorptr objectiterator = blockrecord->newiterator();
for(objectiterator->start() ; objectiterator->done() == false ; objectiterator->step())
{
oddbblockreferenceptr block = oddbblockreference::cast(objectiterator->objectid().safeopenobject()) ;
if(block.isnull() == false && block->handle() == oddbhandle(0x10d3a4)fff">)
{
explodeblockrecursive(block) ;
}
}
return (!m_pdb.isnull());
}
hello roche
oddbhandle(0x10d3a4)fff">,what type of entity this one or by "0x10d3a4" id which type of entity is indicated. please let me know.
quote:
originally posted by sslezkin
it's not crash, it's c++ exception.
the reason is a circle entity with zero radius. it can't be transformed by block refernce matrix to ellipse entity.
autocad also can't transform it. in explode command it creates another block containing only zero-radius circle and makes block refence to it with the same transformation as the source block reference.
i entered cr 5202 for it into our bugzilla:
and fixed it (svn revision 140549)
thanks
oddbhandle(0x10d3a4) which types of object id it is? is it "block refernce"
last edited by
yamagata@ustage.net; 2nd october 2008 at 12:52 amfff">.
you can examine the entity in odamfcapp sample:
load the file.
edit/find - type in object handle as hex value : "10d3a4"
selection in tree control will be set on this object.
quote:
originally posted by sslezkin
you can examine the entity in odamfcapp sample:
load the file.
edit/find - type in object handle as hex value : "10d3a4"
selection in tree control will be set on this object.
thanks sslezkin
i will check it.
--tauhid