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

odd behavior concerning nested references.
odd behavior concerning nested references.
i have noticed some peculiar behavior with some code i have written pertaining to references and nested references. i have attached two sets of files in one zip file. when opened in adt 3.3, they look identical as far as the reference attachments. however, when ran through my dll using open design, the external references returned are different. in one set, i can see "all the way to the bottom" of the reference chain (1.dwg->2.dwg->3.dwg) although they appear to be nested and you would think that i could only see 2.dwg when looking at 1.dwg with opendesign. in the other set, if i analyze 1.dwg, i can only see 2.dwg as you would expect. i have used an objectarx debug utility to see some of the properties of the block record as adt sees it and they look identical in both cases.
after further analysis, it seems like it depends on the order in which the references were attached. if i first attached 1 to 2, then 2 to 3 it would act as you would expect. if you attached 2 to 3 then 1 to 2, then i can see all of them by looking at 1.
so the question is, can someone tell me what the hell is going on here?
i have also included in the zip file, a test app and the dll i wrote. you simply input the whole path to the file in the text box and press the button. a messagebox will appear with the references and rasters found. the number code after the path distiguishes the type. 0-overlay 1-attachment 2-raster. a chunk of the code for the dll is in the code.txt file.
i understand if my explanation is a bit confusing.
if you don't see what i am saying, let me know and i will try to explain it more clearly.
edit: it turns out i can't post a file that big. the big one is the dll.
if someone wants me to email it to them, i will. otherwise i will need
to host it somewhere else.
attached files
another interesting effect that semi-explains the behavior i am describing
in the post above.
if i open 1.dwg from the set that i can only see 2.dwg with my dll in adt 3.3 and then save the drawing. then the dll reports 2 and 3 back to me.
so, it seems that once references are resolved in autocad/adt once,
the file is aware of the nested references for that file and they are
available in that file from then on.
is there any call that would tell me that a reference found for a file
is from another reference?
i can't see an obvious one.
oddbsymboltablerecord::isdependent() returns true for table records which come from external references. if it returns true for block table record it means that the block is from external reference. if the block is external reference itself - it's nested xref.
sergey slezkin
quote:
originally posted by sergey slezkin
oddbsymboltablerecord::isdependent() returns true for table records which come from external references. if it returns true for block table record it means that the block is from external reference. if the block is external reference itself - it's nested xref.
so isfromexternalreference() && !isdependent() should return references that aren't nested? that's not the behavior i am seeing. isdependent is not returning true for any block table record, nevermind the ones that are from external references.
i tried this in arx and the behavior is identical for the block table.
what am i missing here?
sorry, i was wrong about isdependent().
you can use oddbxrefgraph class.
see example of its usage in odamfcapp sample (xrefviewdlg.cpp)
you can see how it works in odamfcapp if you select insert/xref manager and click graph button at upper left corner of the dialog.
sergey slezkin
thanks for the reply. i see what they are doing using the xrefgraph
and that works out well. here is the code i have written for everyone
else's reference. the function that contains this code returns a delimited string with reference info.
//get the xrefgraph from the loaded database
oddbxrefgraph::getfrom(pdb, m_graph);
n = m_graph.numnodes();
for(int i=0; i<n; ++i)
{
oddbxrefgraphnode* pnode = m_graph.xrefnode(i);
if(pnode!=m_graph.rootnode())
{
oddbblocktablerecordptr pxrefblock = pnode->blockid().safeopenobject();
if (!pnode->isnested()) { //we don't want to get the nested references.
if (pxrefblock->isfromoverlayreference()) {
strcat(inbuf,pxrefblock->pathname());
strcat(inbuf,delimiter);
strcat(inbuf,"0");
strcat(inbuf,delimiter);
}
else {
strcat(inbuf,pxrefblock->pathname());
strcat(inbuf,delimiter);
strcat(inbuf,"1");
strcat(inbuf,delimiter);
}
}
}
}
yang686526离线中   回复时引用此帖
GDT自动化论坛(仅游客可见)
回复


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

高级搜索
显示模式

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

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

相似的主题
主题 主题发起者 论坛 回复 最后发表
【转帖】nested blocks yang686526 DirectDWG 0 2009-05-06 06:26 PM
【转帖】handle references of dwg spec yang686526 DirectDWG 0 2009-05-05 11:44 AM
【转帖】getting references code problem yang686526 DirectDWG 0 2009-05-05 11:31 AM
【转帖】finding dwf and dgn references yang686526 DirectDWG 0 2009-05-05 10:57 AM
【转帖】creating nested blocks yang686526 DirectDWG 0 2009-05-04 06:49 PM


所有的时间均为北京时间。 现在的时间是 04:08 PM.


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