几何尺寸与公差论坛------致力于产品几何量公差标准GD&T (GDT:ASME)|New GPS(ISO)研究/CAD设计/CAM加工/CMM测量  


返回   几何尺寸与公差论坛------致力于产品几何量公差标准GD&T (GDT:ASME)|New GPS(ISO)研究/CAD设计/CAM加工/CMM测量 » 仿射空间:CAX软件开发(三)二次开发与程序设计 » CAD二次开发 » AutoCAD二次开发 » DirectDWG
用户名
密码
注册 帮助 会员 日历 银行 搜索 今日新帖 标记论坛为已读


回复
 
主题工具 搜索本主题 显示模式
旧 2009-05-04, 06:29 PM   #1
yang686526
高级会员
 
注册日期: 06-11
帖子: 14579
精华: 1
现金: 224494 标准币
资产: 234494 标准币
yang686526 向着好的方向发展
默认 【转帖】crash in oddbblockreferenceexplode

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
yang686526离线中   回复时引用此帖
GDT自动化论坛(仅游客可见)
回复


主题工具 搜索本主题
搜索本主题:

高级搜索
显示模式

发帖规则
不可以发表新主题
不可以回复主题
不可以上传附件
不可以编辑您的帖子

vB 代码开启
[IMG]代码开启
HTML代码关闭



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


于2004年创办,几何尺寸与公差论坛"致力于产品几何量公差标准GD&T | GPS研究/CAD设计/CAM加工/CMM测量"。免责声明:论坛严禁发布色情反动言论及有关违反国家法律法规内容!情节严重者提供其IP,并配合相关部门进行严厉查处,若內容有涉及侵权,请立即联系我们QQ:44671734。注:此论坛须管理员验证方可发帖。
沪ICP备06057009号-2
更多