几何尺寸与公差论坛------致力于产品几何量公差标准GD&T (GDT:ASME)|New GPS(ISO)研究/CAD设计/CAM加工/CMM测量

几何尺寸与公差论坛------致力于产品几何量公差标准GD&T (GDT:ASME)|New GPS(ISO)研究/CAD设计/CAM加工/CMM测量 (http://www.dimcax.com/hust/index.php)
-   DirectDWG (http://www.dimcax.com/hust/forumdisplay.php?f=89)
-   -   【转帖】need help to set trackingpercen (http://www.dimcax.com/hust/showthread.php?t=17305)

yang686526 2009-05-06 06:23 PM

【转帖】need help to set trackingpercen
 
need help to set trackingpercent
need help to set trackingpercent
can you help me how to set trackingpercent(space between characters in the text). fff">i could not find any example code. i am using following code.
but it is not allowing odgitextstyletraits:: createobject() method.
oddbmtextptr pmtext = oddbmtext::createobject();
odgepoint3d location;
location.x = 30.0;
location.y = 20.0;
location.z = 0.0;
pmtext->setlocation(location);
pmtext->settextheight(0.4);
pmtext->setattachment(oddbmtext::ktopleft);
pmtext->setcontents("sample {\\c2;mtext} created by {\\c5;font}");
pmtext->setwidth(9);
odgitextstyle pgitextstyle;
pgitextstyle.settrackingpercent(0.9);
pgitextstyletrait = odgitextstyletraits::createobject(); // i am getting crash at this point
pgitextstyletrait->settextstyle(pgitextstyle);
oddbtextstyletablerecordptr ptextstyletablerecord = oddbtextstyletablerecord::createobject();
//odgidrawabletraitsptr pgidrawabletraits = odgidrawabletraits::createobject();
odgidrawabletraits* pgidrawabletraits = dynamic_cast<odgitextstyletraits*>pgitextstyletrai t.get();
ptextstyletablerecord->setattributes(pgidrawabletraits);
oddbobjectid styleid = ptextstyletablerecord->objectid();
pmtext->settextstyle(styleid);
you don't need create object odgitextstyletraits. you may set ptextstyletablerecord->setxscale(double xscale) ( where xscale is the same trackingpercent) or insert in mtext content the switch "\w<scale>;". for example your text will be ("\w0.9;sample {\\c2;mtext} created by {\\c5;font}");
best regards,
sergey z.


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