高级会员
注册日期: 06-11
帖子: 14579
精华: 1
现金: 224494 标准币
资产: 234494 标准币
|
【转帖】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
|