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

bug(?) in odgibasevectorizer when gsmodel is enabled
bug(?) in odgibasevectorizer when gsmodel is enabled
we are still on dd 1.13.xx, so if this is a bug, it may already be fixed.
we are using the wingdi renderer with gsmodel enabled.
we recently encountered a problem whereby modifying a layer's on/off status, regenerating the cache, and then repainting the screen did not yield the correct results. turning the layer off resulted in the elements still being drawn, while turning the layer on resulted in the elements not being drawn.
the problem seems to be related to this code in odgibasevectorizer:
code:
void odgibasevectorizer::updatelayertraits(odgisubentitytraitsdata& subentitytraits) const
{
if(m_layerid!=subentitytraits.layer())
{
m_layerid = subentitytraits.layer();
odgidrawableptr player = m_pcontext->opendrawable(subentitytraits.layer());
if (player.get())
{
m_layertraitsdata.set(player);
// logical cohesion with db : gs implementation must "know" that layer may be from xref
m_effectivelayerid = player->id();
}
else
{
m_layertraitsdata = layertraits();
m_effectivelayerid = 0;
}
}
::setlayerflagstotraits(subentitytraits, m_layertraitsdata.flags(), m_pcontext->isplotgeneration());
}
when the drawing traits are updated (for each element that is processed), odgibasevectorizer::updatelayertraits saves the layer id and the layer traits. as long as elements are on the same layer, the same layer traits can be used without having to resolve the layer id and retrieve the traits again. in our case, we had a dxf file with some layers, call them a, b, c. each layer had some elements, call them a1, a2, ..., b1, b2, ..., etc. as it turns out, the elements appeared in the file like this: a1, a2, a3, ..., b1, b2, b3, ..., c1, c2, c3, ... that is, for a given layer, all of its elements were stored consecutively in the file. now, turn on a and turn off b and c. invalidate the cache (invalidategsmodel). redraw the screen (using wingdi renderer).
as the file is processed, first the new cache is generated. odgibasevectorizer::updatelayertraits is executed for each element that is processed. only elements from layer a are added to the cache because layers b and c are off. at the end of the cache generation phase, odgibasevectorizer has saved the m_layerid and associated layer traits associated with layer c, since the last element in the file is on layer c.
after the cache has been generated, it is drawn to the screen. the cache contains only elements from layer a. during the drawing, odgibasevectorizer::updatelayertraits is called for each element (from the cache) that is drawn. at the end of drawing the cache to the screen. odgibasevectorizer has saved the m_layerid and associated layer traits associated with layer a, since the last element that was drawn from the cache to the screen is on layer a.
now, turn off layer a, invalidate the cache, and repaint the screen.
again, the file must be processed to create the new cache. while processing the elements from layer a, odgibasevectorizer::updatelayertraits notes that its saved m_layerid is the same as the layer id of the elements, so it does not get the current layer traits. the last time that m_layerid and its associated layer traits were saved, layer a was on, so the saved traits reflect that. therefore, the elements from layer a are added to the cache with their layer status as "on", even though the current on/off status of layer a is "off". after all elements have been processed and, if necessary, added to the cache, the cache is drawn to the screen. since the cache contains the elements from layer a, those elements are drawn to the screen, even though the current status of layer is that it is "off".
i have not been able to reproduce the problem in odamfcapp, but i haven't debugged through it to see exactly why.
to work around the problem, i added the following redfff"> lines to exgdivectorizeview::update, before sending the update to odgsbasevectorizeview:
code:
odgisubentitytraitsdata myfromtraits;
odgisubentitytraitsdata mytotraits;
affecttraits(&myfromtraits,mytotraits);
odgsbasevectorizeview::update();
the effect is to clear odgibasevectorizeview's saved m_layerid and its associated traits. in the situation that i described above, the layer id for layer a is cleared. as the new cache is being generated, when the layer a elements are encountered, their layer id does not match the saved layer id (since the saved layer id has been cleared), so the current layer traits must be retrieved. that ensures that, when the cache is generated, it always starts with the current state of all of the layers, not that layer state as it existed the last time that the cached representation of the drawing was drawn to the screen.
i am attaching the dxf file that exposed this problem. i don't think that there is anything particularly special about the file, other than the element layout is as i described. in the case of this file, the "houses" layer is the layer that was causing our problems.
attached files
i just wanted to bump this post to the top again. since we have implemented a fix as described in my original post, we are not waiting on a fix from the dd guys.
however, if you have read the post and if the information that i provided sufficiently explained the problem (or my interpretation of it, anyway), i wanted to know if dd agrees with my assessment and whether this problem will be addressed in a future version?
thanks.
hi,
there was a bug (cr 2827) that had been fixed in dd 1.13.04 by clearing m_layerid in odgsbasevectorizeview::beginviewvectorization().
thanks for the information! we have been stuck on a slightly older version of dd for a while now. we hope to upgrade to the current version very soon.
yang686526离线中   回复时引用此帖
GDT自动化论坛(仅游客可见)
 


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

高级搜索
显示模式

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

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



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


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