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

transformations using worlddraw
transformations using worlddraw
hi there,
i wish to read a file and obtain the data (& attributes like colour etc) of all the entities in world co-ordinates. reading the documentation & mails of the forum it seems that the library can handle matrix stacks and manage all the transformations.
so in the code below when i find an insert i push the transformation, process all entities in the block, and then pop the transformation.
each entity is processed by worlddraw, and this i assume introduces this entity into a vectorisation context, and therefore as your document states "the current model transformation is applied to all geometry introduced into this vectorization context.". i.e all the transformation are done by the library.
however, elsewhere you say: "the oddbentity class defines a virtual oddbentity::worlddraw() function, which is used for vectorization. each class derived from oddbentity overrides this function in order to perform custom vectorization. this function provides a convenient method for extracting the geometric representation of an entity in a generic manner."
does this mean that entity transformation is the responsibility of my application. ??
when i read a simple file of a rectangular insert with a translation, no entity transformation takes place.
or is there something wrong with my implementation ??
regards
gerry
//set up the dumper
worlddrawdumper wdd;
contextdumper ctx(idblock.database());
wdd.setcontext(&ctx);
short processblock (oddbobjectid idblock)
{
oddbblocktablerecordptr pblock;
oddbobjectiteratorptr pents;
pblock = idblock.openobject();
pents = pblock->newiterator();
//loop around all the entities
while (!pents->done())
{
oddbentityptr pent = pents->entity();
pents->step();
// is this an insert ?
if (pent->iskindof(oddbblockreference::desc()))
{
odgematrix3d odmatrix;
odmatrix = ((oddbblockreferenceptr)pent)->blocktransform ();
wdd.geometry().pushmodeltransform (odmatrix);
// process nested block recursively
processblock (((oddbblockreferenceptr)pent)->blocktablerecord());
wdd.geometry().popmodeltransform ();
else
{ //process non-insert entity
ret = pent->worlddraw(&wdd);
}
}
you need not treat block reference entity differently from others.
oddbblockrefernce::worldraw() performs:
1. push transformation (taking into account block's base point - your code does not honour it).
2. push clip boundary (if spatial filter is applied to block reference)
3. call geometry->draw(oddbblocktablerecord)
4. pop clip boundary (if was applied)
5. pop transform
6. iterate through attributes and draw them.
oddbblocktablerecord::worlddraw() iterates through block entities (taking into account sortents) and draw them.
"...all transformations are performed by library..."
this depends on point of view. if you are implementing worlddraw() function for your custom entity it's absolutely right.
the entity does not have to worry about outer transformations. they will be performed "by library" - rendering engine.
but it's not the case if you implement vectorization context as odgiworlddraw inheritor and call entity's worlddraw() passing your odgiworlddraw object. it will recieve not transformed primitives directly as they are called from entity's worlddraw().
if you implement your device class - you'll get transformed to device coordinates geometry.
see odvectorizeex sample.
sergey slezkin
yang686526离线中   回复时引用此帖
GDT自动化论坛(仅游客可见)
回复


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

高级搜索
显示模式

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

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

相似的主题
主题 主题发起者 论坛 回复 最后发表
【转帖】odreadex - entites generated by worlddraw yang686526 DirectDWG 0 2009-05-06 09:03 PM
【转帖】oddbpoint and worlddraw yang686526 DirectDWG 0 2009-05-06 08:01 PM
【转帖】how to retrieve simple features from entities yang686526 DirectDWG 0 2009-05-06 03:10 PM
【转帖】[求助]worlddraw->geometry().circle不显示 yang686526 ObjectARX(C++) 0 2009-04-16 02:33 PM


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


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