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

dimension style incorrect behavior
dimension style incorrect behavior
hi,
i have noticed a strange behavior connected to the dimension styles.
i have a drawing with one dimension in it. if i change the standard dim style(eg. changing arrow types to circles) and call "regen" after that, everything seems to be ok. the arrows are changed. what i'm expecting is all the next created dimensions to have circles for arrow types. but if i create a new one, the arrows are not circles - it seems the newest settings for the standard dim style are not considered at creation. is this is a dd bug? is there a way to create dims according to the latest settings in the dim style?
here is a sample source code used in odamfcapp(ver. 2.2.0) to prove the strange behavior
code:
oddbblocktablerecordptr pblock = m_pdb->getactivelayoutbtrid().safeopenobject(oddb::kforwrite);
{
int i = 0;
odstring snames;
for (oddbobjectiteratorptr piter = pblock->newiterator(); !piter->done(); piter->step(), i++ )
{
oddbrotateddimensionptr pdim = piter->entity()->objectid().safeopenobject(oddb::kforwrite);
oddbobjectid pstandarddimstyleid = m_pdb->getdimstylestandardid();
oddbdimstyletablerecordptr pstandarddimstyleptr = pstandarddimstyleid.safeopenobject(oddb::kforwrite);
pstandarddimstyleptr->setdimblk(dd_t("_dot"));
}
//create a new dim
odgepoint3d pt1start(500,1000,0), pt1end(700,1000,0);
oddbblocktablerecordptr pmodel = m_pdb->getmodelspaceid().safeopenobject(oddb::kforwrite);
{
oddbrotateddimensionptr ptemp1 = oddbrotateddimension::createobject();
ptemp1->setxline1point(pt1start);
ptemp1->setxline2point(pt1end);
ptemp1->setdimlinepoint(odgepoint3d(500,1050,0));
pmodel->appendoddbentity(ptemp1);
}
m_pviewer->redrawwindow();
}
thanks in advance,
nino
your code does not set dimension style to newly created dimension.
besides current database dimension style (dimstyle variable) database dim* variables may contain overrides.
call pdim->setdatabasedefaults().
this function will set current dimension style and dim* overrrides (if any).
sergey slezkin
hi, sergey.
thanks for the attention. i tried to call setdatabasedefaults() but the newly created dimension is still different.
that's what i am trying:
code:
odgepoint3d pt1start(5,5,0), pt1end(7,5,0);
oddbblocktablerecordptr pmodel = m_pdb->getmodelspaceid().safeopenobject(oddb::kforwrite);
{
oddbrotateddimensionptr pdim1 = oddbrotateddimension::createobject();
pdim1->setxline1point(pt1start);
pdim1->setxline2point(pt1end);
pdim1->setdimlinepoint(odgepoint3d(5,5.5,0));
pdim1->setdatabasedefaults(m_pdb);
pmodel->appendoddbentity(pdim1);

}
//change the standard dimstyle
oddbobjectid pstandarddimstyleid = m_pdb->getdimstylestandardid();
oddbdimstyletablerecordptr pstandarddimstyleptr = pstandarddimstyleid.safeopenobject(oddb::kforwrite);
pstandarddimstyleptr->setdimblk(dd_t("_dot"));
//create a new dim
odgepoint3d pt2start(5,10,0), pt2end(7,10,0);
{
oddbrotateddimensionptr pdim2 = oddbrotateddimension::createobject();
pdim2->setxline1point(pt2start);
pdim2->setxline2point(pt2end);
pdim2->setdimlinepoint(odgepoint3d(5,10.5,0));
pdim2->setdatabasedefaults(m_pdb);
pmodel->appendoddbentity(pdim2);
}
m_pviewer->redrawwindow();
how can i set dimension style to the newly created dims?
regards,
nino
you can set the dimstyle using pdimension->setdimensionstyle().
why you have the described results:
database stores a number of dimension variables: the default dimension style id and all values of dim* variables. if some dim* variables stored in database differ from corresponding values stored in current dimension style values of these variables are added to newly created dimension as overrides (they are stored in xdata).
after you changed dimblk in standard dimstyle the value of dimblk stored in database was unchanged. it differs from dimblk in current style and is added as dimblk override to newly created dimensions.
after changing dimblk in current dimstyle you can change it in database defaults too:
code:
oddbdimstyletablerecordptr pstandarddimstyleptr = pstandarddimstyleid.safeopenobject(oddb::kforwrite);
pstandarddimstyleptr->setdimblk(dd_t("_dot"));
pdb->setdimblk(pstandarddimstyleptr->dimblk());
after that new dimensions will be created with dot arrows.
sergey slezkin
hi, sergey.
it works now. thanks for the detailed explanation.
regards,
nino
yang686526离线中   回复时引用此帖
GDT自动化论坛(仅游客可见)
 


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

高级搜索
显示模式

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

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

相似的主题
主题 主题发起者 论坛 回复 最后发表
【转帖】current dimension style yang686526 DirectDWG 0 2009-05-04 06:54 PM
【转帖】changing the font associated with the standard text style yang686526 DirectDWG 0 2009-05-04 05:44 PM
【转帖】limit style tolerancing vs bilateral yang686526 American standards 0 2009-04-29 08:40 PM
【转帖】htt;www.dimcax.com/hust/newthread.h/do=newthread7f=52 huangyhg PC-DMIS 1 2009-04-06 11:11 AM


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


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