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

redefine the dimension block referenced by dimension entity
redefine the dimension block referenced by dimension entity
what is the correct procedure to redefine an existing dimension block after it was created by the function recomputedimblock()? the dimension was drew in my program is expressed in my own class,when save the file in dwg,i set parameters to form oddbdimension and call recomputedimblock(),the dimension block created by recomputedimblock() is not exactly same as i drew,for example ,the length of extension line,the position of the dimension text... so i transform the dimension in my own class to new set of oddbentity and want to redefine the created dimension block.i have iterated the dimension block record and make all entities to erase mode and then append my new set of entities, but i find there is no change,the dimension block is still the original one created by recomputedimblock().what should i do? thanks a lot.
the sample is:
odrxmoduleptr pmoudle=:drxdynamiclinker()->loadmodule("recomputedimblock.drx");
oddbblocktablerecordptr bbtr;
oddbrotateddimensionptr pdimension = oddbrotateddimension::createobject();
pdimension->setdatabasedefaults(pdb);
oddbobjectid dimensionid = bbtr->appendoddbentity(pdimension);
pdimension->setdatabasedefaults(pdb);
pdimension->setxline1point(startpoint);
pdimension->setxline2point(endpoint);
pdimension->setdimlinepoint(dimlinept);
pdimension->usedefaulttextposition();
pdimension->recomputedimblock();
oddbobjectid blockid=pdimension->dimblockid();
oddbblocktablerecordptr pbtr=blockid.openobject(oddb::kforwrite);
oddbobjectiteratorptr pentiter = pbtr->newiterator();
for (pentiter->start(); !pentiter->done(); pentiter->step())
{
oddbentityptr pentity=pentiter->entity(oddb::kforwrite);
pentity->erase();
}
odgepoint3d ptstart,ptend;
oddbmtextptr pmtext = oddbmtext::createobject();
oddblineptr pline1 = oddbline::createobject();
...
pline1->setstartpoint(ptstart); //start point of the first extension line
pline1->setendpoint(ptend); //end point of the first extension line
pbtr->appendoddbentity(pline1);
...
pbtr->appendoddbentity(pmtext); //dimension text
...
hello,
recompute block is run while dimension is closed.your changes are replaced. so you need use
odrxmoduleptr pmoudle=:drxdynamiclinker()->loadmodule("dummyrecomputedimblock.drx");
instead of
odrxmoduleptr pmoudle=:drxdynamiclinker()->loadmodule("recomputedimblock.drx");
in this case pdimension->dimblockid(); returns you empty block so you needn't erase it.
note dimension block is recomputed by acad in case any dimension property is changed.
best regards,
sergey z.
thanks a lot.but i don't have the module of "dummyrecomputedimblock.drx",where can i obtain it?
btw,recomputedimblock() of dummyrecomputedimblock.drx seems does nothing but return, that means it will not create the dimension block,then how can i get the dimension block referenced by the oddbdimension entity?
1. if recomputedimblock creates a block with representation you don't like than most probably it means that you set some properties of dimension style (or their overrides on dimension entity) incorrectly. i mean setdimxxx() functions.
if you replace the block with your representation then after opening the file in autocad and changing anything (say color) in dimension the block will be regenerated by autocad according to properties of dimension and dimension style.
if dwgdirect and autocad generate different blocks for the same dimension than it's dd bug and it should be fixed in dd.
2. in extensions folder where are recomputedimblock and dummyrecomputedimblock. these 2 projects build drx with the same name.
in case of using dummyrecomputedimblock you can create block manualy with name *d and set it to dimension using oddbdimension::setdimblockid().
sergey slezkin
yang686526离线中   回复时引用此帖
GDT自动化论坛(仅游客可见)
 


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

高级搜索
显示模式

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

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

相似的主题
主题 主题发起者 论坛 回复 最后发表
【转帖】need dimension advice yang686526 DirectDWG 0 2009-05-06 06:20 PM
【转帖】memory leak issue yang686526 DirectDWG 0 2009-05-06 05:37 PM
【转帖】how to handle the dimension block reference yang686526 DirectDWG 0 2009-05-06 02:50 PM
【转帖】grouping in svg based on block hierarchy yang686526 DirectDWG 0 2009-05-05 11:41 AM
【转帖】a dimension error yang686526 DirectDWG 0 2009-05-04 03:05 PM


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


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