几何尺寸与公差论坛------致力于产品几何量公差标准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)
-   -   【转帖】ext Into Polyline For Shx Fonts (http://www.dimcax.com/hust/showthread.php?t=18725)

yang686526 2009-05-07 04:44 PM

【转帖】ext Into Polyline For Shx Fonts
 
text into polyline for shx fonts
text into polyline for shx fonts
hi,
i am trying to read polyline information from oddbtext entity for shx fonts, but get an access violation in the odgigeometrysimplifier.textproc
here is what i am doing
odgitextstyle gistyle;
gifromdbtextstyle(text->textstyle(), gistyle);
gistyle.settextsize(text->height());
gistyle.setxscale(text->widthfactor());
gistyle.setobliquingangle(text->oblique());
odstring strtxt = ptext->textstring();
const odchar *pstrmsg = strtxt.c_str();
odint32 ilen = strtxt.getlength();
odgevector3d normal = ptext->normal();
double dangle = ptext->rotation();
odgevector3d direction;
direction.rotateby(dangle, odgevector3d::kzaxis);
direction.transformby(odgematrix3d:: planetoworld(normal));
odgepoint3d position = ptext->position();
odgigeometrysimplifier geom;
geom.textproc(position, normal, direction, pstrmsg, ilen, true, gistyle);
am i doing somethign wrong here?
thanks in advance
krishna

you must set draw context to simplifier using function odgigeometrysimplifier::setdrawcontext()
sincerely yours,
george udov
quote:
originally posted by george udov
you must set draw context to simplifier using function odgigeometrysimplifier::setdrawcontext()
thank you george for the response, i have been able to call the function successfully but cant seem to figure how to get the text out as polyline. could you help with some sample code or direct me to some code in the existing samples? what we are trying to do is extract the text as polyline and feed it to our viewing system as polylines.
regards
krishna

then you should define inheritant of odgigeometrysimplifier (just like in odvectorizeex sample). in this inheritant you should override polylineproc() (or polylineout() )function. this function will be "callback" for polylines
sample code (only for understanding the technique)
code:
class mygeometrysimplifier : public odgigeometrysimplifier
{
public:
polylineproc(odint32 nbpoints,
const odgepoint3d* pvertexlist,
const odgevector3d* ,
const odgevector3d* pextrusion,
odint32 )
{
// here you'll receive polylines
}
}
mygeometrysimplifier geom;
geom.textproc(position, normal, direction, pstrmsg, ilen, true, gistyle);
sincerely yours,
george udov


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