几何尺寸与公差论坛------致力于产品几何量公差标准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-05, 10:14 AM   #1
yang686526
高级会员
 
注册日期: 06-11
帖子: 14579
精华: 1
现金: 224494 标准币
资产: 234494 标准币
yang686526 向着好的方向发展
默认 【转帖】explodetoblock - external references

explodetoblock - external references
explodetoblock - external references
i am wanting to convert external references from a dwg file to our format. we currently do this with standard blocks by using oddbblockreference::explodetoblock(), which works well.
when i try this with it generates a number of oderror_duplicaterecordname errors, and eventually throws an "invalid owner object" exception.
i also looked at calling xrefdatabase to generate another database pointer, and recursively process each file for each reference. (i need a transformation matrix to position this correctly. in the past when my predecessor did this with 'standard blocks' he couldn't get this to work) this method also generates a number of oderror_duplicaterecordname, but throws an unknown exception.
could someone point me in the direction of some sample code that deals with external references please?
ddt version <=1.11 used simple inserting for xref loading. since 1.12 version ddt places xref in a separate database which can be accessed through oddbblocktablerecord::xrefdatabase() method.
we've fixed some bugs related to exploding xref inserts in 1.12.04 revision. but exploding xref inserts can produce incorrect drawing (while exploding xref inserts if xref drawing contains blocks with the same name as in the main drawing the blocks from the main drawing will be used). autocad does not explode xref inserts probably for this reason and we are going to refuse exploding xref insertions too.
oddbxrefman::bind() is intended for merging the entities of the xref to the main drawing, but it will be implemented only in dd 1.13 (version 1.13 has a tentative release date of the end of march, 2005).
if exploding xref inserts with dd >= 1.12.04 produces errors try to use next code as workaround:
code:
//oddbdatabase* pdb; // host database
//oddbobjectid objid; // id of xref block in host database
oddbblocktablerecordptr pblock = oddbblocktablerecord::cast(objid.openobject(oddb::kforwrite));
if (pblock.get() && pblock->isfromexternalreference())
{
odstring path = pblock->pathname();
oddbxrefman::unload(pblock);
oddbxrefman::detach(pblock);
oddbdatabaseptr pxrefdb = pdb->appservices()->readfile(path);
if (pxrefdb.get())
{
pdb->insert(oddbsymutil::blockmodelspacename(), "inserted_xref_block", pxrefdb);
}
}
regards,
sergey vishnevetsky
thanks sergey,
i have a problem that i have multiple instances of each xref (ie the name on the insert is not unique the second time around)
i am using 1.12.04, but can wait for 1.13 as that sounds like a better solution.
thanks for the help,
hugh
yang686526离线中   回复时引用此帖
GDT自动化论坛(仅游客可见)
回复


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

高级搜索
显示模式

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

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

相似的主题
主题 主题发起者 论坛 回复 最后发表
【转帖】example programs yang686526 DirectDWG 0 2009-05-05 09:54 AM
【转帖】error linking application yang686526 DirectDWG 0 2009-05-05 09:41 AM
【转帖】dwf7import link error yang686526 DirectDWG 0 2009-05-05 07:56 AM
【转帖】1.13 hostapp systemservices problems yang686526 DirectDWG 0 2009-05-04 02:48 PM
【转帖】external file references and sw api yang686526 SolidWorks二次开发 0 2009-04-13 10:50 AM


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


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