高级会员
注册日期: 06-11
帖子: 14579
精华: 1
现金: 224494 标准币
资产: 234494 标准币
|
【转帖】odgigeometry and text function
odgigeometry and text function
odgigeometry and text function
hi everyone...
im'trying to write an input tracker that displays a distance from a given point when the user moves the mouse inside the drawing area.....
i need to display distance in a numeric value near the cursor position.
do i have to use odgigeometry::text function ?
if so, i tried but nothing appens...
this is the piece of code i'm using:
odgevector3d direction(pts[0].x-pts[1].x, pts[0].y-pts[1].y, pts[0].z-pts[1].z);
odgevector3d normal = direction;
normal = normal.rotateby(_pi/2.0, odgevector3d::kzaxis);
double dist1 = distance3d(pts[0].x, pts[0].y, pts[0].z, pts[1].x, pts[1].y, pts[1].z);
cstring txt1; txt1.format(_t("%.0f mm"), dist1);
pts[1] = odgepoint3d((pts[1].x + (dist1/2.0)*cos(angle)), (pts[1].y + (dist1/2.0)*sin(angle)), insertpt.z);
odgitextstyle style;
style.set(_t("txt.shx"), _t("bigfont.shx"), 100, 1, 1, 1, false, false, false, false, false);
style.setfont(_t("arial"), false, false, default_charset, default_pitch);
style.settextsize(100);
geom.text(pts[1], normal, direction, txt1, txt1.getlength(), true, &style);
but nothing is shown....
where is the mistake ??????
is there any simple example in the documentation ?
thanks very much!!
hello
try to call style.loadstylerec(oddbbasedatabase* pdb) after initialize text style.
note you need to set
style.set(_t("txt.shx"), _t("bigfont.shx"), 100, 1, 1, 1, false, false, false, false, false);
or
style.setfont(_t("arial"), false, false, default_charset, default_pitch);
in your case arial will be used.
best regards,
sergey z.
quote:
originally posted by sergey z.
hello
try to call style.loadstylerec(oddbbasedatabase* pdb) after initialize text style.
note you need to set
style.set(_t("txt.shx"), _t("bigfont.shx"), 100, 1, 1, 1, false, false, false, false, false);
or
style.setfont(_t("arial"), false, false, default_charset, default_pitch);
in your case arial will be used.
thank you very much sergey !!!!!
now it works
|