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

problem during leader entity creation
problem during leader entity creation
hello
when i create leader entity having 2 vertex and mtext as a annotation entity in my application, it is created well. when i open this entity in my application, it opens well. but when i open this entity in autocad, it opens wrong.
during leader creation we provide 2 vertex, but the leader line is not formed with these 2 points. a point is calculated internaly and with this point we draw leader line.
when i open my leader entity in odamfcapp i found this calculated point wrong. this point is calculated incorrectly. in calculation of this point there is some contribution of annotation entity height and width. i can get annotation entity height and width by functions annoheight(), annowidth(). but there is not any function to set these values.
example :-
if i create a leader entity in autocad with start point (0,0,0) and end point (10,10,0). there are 3 values stored at dxf 10 which are (0,0,0), (9.82, 10, 0) and (10,10,0). values stored at dxf 40(text annotation height ) is 0.18 and at dxf 41(text annotation width ) is 0.36. these values are used in calculating point value (9.82, 10,0) stored at dxf 10.
if i create a leader entity in my application with start point (0,0,0) and end point (10,10,0). there are 3 values stored at dxf 10 which are (0,0,0), (10.36, 10, 0) and (10.18,10,0). there is no value stored at dxf 40(text annotation height ) and at dxf 41(text annotation width ) . there is not any function to set values at dxf 40 and dxf 41.
how can i set values at dxf 40 and 41 ? is there any function for that?
last edited by cad-mind; 1st june 2006 at 05:17 amfff">.
do you set annotation id to leader?
annotation width & height (dxf 40&41) are calculated by dd. hook line direction which is wrong in your case is determined by annotation's orientation.
what does happen if you open a file with your leader and mtext in autocad and slightly move the mtext? does the leader change appearence to correct?
sergey slezkin
anotation id is set but point is not calculated correctly.
yes i am setting anotation id to leader.
in my application first i creat leader line then attach anotation object mtext.
any anotation object is processed as delayed object and attached to leader entity. finaly leader entity with mtext is created but end point of leader line is not calculated according to anotation object.
obviousely if i open leader entity in autocad and do some changes, it apperence correct.
i am attaching a file for your reference. plz go through that.
attached files (26.0 kb, 11 views)

i tried the code below and the last leader's point is recalculated as expected (it becomes (9.91, 9.91) ).
code:
oddbblocktablerecordptr pbtr = pdb->getmodelspaceid().openobject(oddb::kforwrite);
oddbleaderptr pleader = oddbleader::createobject();
pleader->setdatabasedefaults(pdb);
pbtr->appendoddbentity(pleader);
/**********************************************************************/
/* add the vertices */
/**********************************************************************/
odgepoint3d point(0,0,0);
pleader->appendvertex(point);
point.x = 10.;
point.y = 10.;
pleader->appendvertex(point);
pleader->setdimtad(1);
/**********************************************************************/
/* create mtext
/**********************************************************************/
oddbmtextptr pmtext = oddbmtext::createobject();
pmtext->setdatabasedefaults(pdb);
oddbobjectid mtextid = pbtr->appendoddbentity(pmtext);
const double textheight = 0.5;
const double textwidth = 3.0;
pmtext->setattachment(oddbmtext::kbottomleft);
pmtext->setlocation(point);
pmtext->settextheight(textheight);
pmtext->setwidth(textwidth);
pmtext->setcontents(dd_t("mtext"));
/**********************************************************************/
/* attach the mtext as annotation to the leader */
/**********************************************************************/
pleader->attachannotation(mtextid);
sergey slezkin
yang686526离线中   回复时引用此帖
GDT自动化论坛(仅游客可见)
回复


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

高级搜索
显示模式

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

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

相似的主题
主题 主题发起者 论坛 回复 最后发表
【转帖】leader entity problem yang686526 DirectDWG 0 2009-05-06 04:44 PM
【转帖】last vertex in leader entity yang686526 DirectDWG 0 2009-05-06 04:35 PM
【转帖】getting modelspace object pointer for write 9programming te yang686526 DirectDWG 0 2009-05-05 11:30 AM
【转帖】『已解决』利用cad的api怎么画一个带箭头的“引线”(leader)? - 精华帖集合 yang686526 ObjectARX(VB.NET/C#) 0 2009-04-29 05:08 PM
【转帖】objectarx&dummies教程(十三)—— deriving from acdbentity yang686526 ObjectARX(C++) 0 2009-04-16 10:40 AM


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


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