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

modified/new objects not updated properly [2.7.1]
modified/new objects not updated properly [2.7.1]
hi,
i am wondering if there has been any changes to the way new objects/entities are commited to the database since dwgdirect 2.4.2. the reason i am asking is because after switching to 2.7.1 i am having trouble rendering dynamically updated objects.
an example of such an operation would be (these applies to the same block):
1. erase an existing region (oddbregion)
2. update a polyline shape (oddbpolyline)
3. create a new region to reflect the polyline changes
the entity reference to this block (oddbblockreference) would then be set as modified with pent->recordgraphicsmodified(true), and then the view would be updated. the rendering system was only regenerating the modified data, as expected.
this worked very well in 2.4.2, but in 2.7.1 i have to save the database (dwg) and reload it to see the changes. by adding some logging to the rendering system i can see that the newly created objects are not processed immediately.
are there any extra function calls i have to do to make 2.7.1 "commit" the new data?

hi,
do you mean, if you modify or add entities inside block, block references for this block are not updated?
quote:
the rendering system was only regenerating the modified data, as expected.
this worked very well in 2.4.2, but in 2.7.1 i have to save the database (dwg) and reload it to see the changes.
i don't understand, after regeneration changes will be applied to block references, or only after complete file reloading?
do you have any example of incorrect behaviour, how we can reproduce it? (dwg file, odamfcapp modification or something else)
hi, thanks for the response.
quote:
originally posted by amark
do you mean, if you modify or add entities inside block, block references for this block are not updated?
almost, i mean that the graphics for the block references are not updated. i have only tested this with oddbregion entities, however. another important bit of information might be that this is the opengl rendering device.
in short: i create an oddbregion inside a block, regenerate the view and the block references does not display the newly created region entity.
quote:
originally posted by amark
i don't understand, after regeneration changes will be applied to block references, or only after complete file reloading?
i added some debug output to show the current object type being drawn inside the vectorizer device, and the oddbregion object is not listed in the vectorizer until i save and reload the file completely.
my guess is that there is some kind of cache in between that isn't updated after adding the region. this might be because i don't commit the changes properly.
quote:
originally posted by amark
do you have any example of incorrect behaviour, how we can reproduce it? (dwg file, odamfcapp modification or something else)
there is quite a lot of code involved so i'll just explain the relevant bit:
- an entity is selected (highlighted).
- the entity is an oddbblockreference. the referenced block contains a closed polyline and a region.
- entity grip points are shown based on the polyline inside (e.g one for each corner).
- you start dragging one of the corner grip points.
- for each view update, the region inside the block is recreated based on the polyline shape. in detail:
1. delete the old region entity
2. update the polyline shape based on the grip point modification
3. create a new region entity
4. mark the highlighted entity (the block reference) as modified (recordgraphicsmodified)
5. redraw the entire drawing
- the result should be a continuously updated region which follows the polyline shape.
it is a bit difficult to explain, but i hope this is understandable.

hi,
call pent->assertwriteenabled(false, true) instead of pent->recordgraphicsmodified(true) for your oddbblockreference entity, this call forces cache invalidation.
the regeneration always invalidate all caches in drawing and this is strange if modifications is not visible after it.
i have done some testing with the assertwriteenabled function, but it doesn't seem to help.
my debug code lists the type of object being drawn in the ontraitsmodified() function of the odgsopenglvectorizeview class. for this specific kind of custom object, which involves polylines, 3d faces and regions, only the generated regions does not show in the list. all the other object types are modified and updated correctly in the renderer.
for me it seems that the region entities "disappears" somewhere between the oddbdatabase and the odgsopenglvectorizedevice.

hi,
it looks like something wrong with entity appending to block table record, but i can't see why.
i've write simple test in odamfcapp:
- open block table record for write.
- create and append entity to opened record.
- call assertwriteenabled for all block references to that block.
block references caches updated successfully and created entity available on the screen.
if i don't call assetwriteenabled and call regen - all entities caches updated, and modified block changes also visible.
hi,
thanks for taking your time to write a test. could you also try this with oddbregion objects? it seems that i only get this problem with that particular object type.
here is the entire code used when creating the region object (put together from multiple functions):
code:
oddbpolyline ppolyfloor = <a valid polyline>;
oddbblocktablerecordptr pbtr = <a valid block table record>;
// create region from object curve segments
odrxobjectptrarray segments, regions;
segments.push_back( ppolyfloor.get() );
oddbregion::createfromcurves(segments, regions);
oddbentityptr entity = (oddbentityptr)regions[0];
// setup basic entity properties
entity->upgradeopen();
entity->setdatabasedefaults(pdb);
entity->setlayer("0", false);
entity->setlineweight(oddb::klnwtbyblock);
entity->setcolor( odcmcolor(odcmentitycolor::kbyblock) );
entity->setvisibility(oddb::kvisible);
entity->setcastshadows(true);
entity->setreceiveshadows(true);
// append entity to block
pbtr->appendoddbentity( entity.get() );
last edited by tag; 12th march 2009 at 04:13 amfff">.

hi,
i've test region creation with your code and found bug, but it is not related to gs. region normally added to gs and it worlddraw called, but it is draws nothing, so you does not have any calls for this entity in your ontraitsmodified.
problem related to our acis support. region internal cache updated properly only after stream loading, and incompletely updated after creation.
i add bug to our bugzilla (), and, i think, it will be fixed in next release.
temporarily you can use following workaround:
- get acis stream from region, using oddbregion::acisout method
- put stream back into region, using oddbregion::acisin method
hi,
thanks for your help! the workaround seems to work very well, i'm glad no large changes to the code were required.
a little follow-up question on the recordgraphicsmodified vs assertwriteenabled functions -- what is the difference between these two methods? is there any difference in performance and result?

hi,
it seems dd have a bug with recordgraphicsmodified, but it need further investigations. really recordgraphicsmodified must set graphicsmodified flag which forces onmodify call for entity drawable at closing, but it does not call any reactors currently.
assertwriteenabled is designed to be frequently called inside object at each modification. for example, it called inside transformby, setvisibility and some other methods. it's slightly slower than recordgraphicsmodified, but object reactors will be called on object close.

hi,
i add new bug to our bugzilla:
[ oddbentity::recordgraphicsmodified() behaviour is incorrect ]
yang686526离线中   回复时引用此帖
GDT自动化论坛(仅游客可见)
回复


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

高级搜索
显示模式

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

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

相似的主题
主题 主题发起者 论坛 回复 最后发表
【转帖】exporting objects as autocad 3d solids yang686526 DirectDWG 0 2009-05-05 10:33 AM
【转帖】custom objects yang686526 DirectDWG 0 2009-05-04 06:56 PM
【转帖】cant see objects in some file yang686526 DirectDWG 0 2009-05-04 05:36 PM
【转帖】objectarx&dummies教程(十二)—— deriving from acdbobject yang686526 ObjectARX(C++) 0 2009-04-16 10:40 AM
【发布】From ACIS:Chapter 6.Model Topology huangyhg CAD内核 1 2005-03-09 03:34 PM


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


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