查看单个帖子
旧 2009-05-07, 04:50 PM   #1
yang686526
高级会员
 
注册日期: 06-11
帖子: 14579
精华: 1
现金: 224494 标准币
资产: 234494 标准币
yang686526 向着好的方向发展
默认 【转帖】ext With Shx Font By Polylines

text with shx font by polylines
text with shx font by polylines
we hav ean application that already manages ttf fonts.
now, i would like to explode a text written with an shx font
to polylines. the only way i found is to use
textproc function.
so, lloking to this forum and to the manual, what i do is:
class mygeometrysimplifier : public odgigeometrysimplifier
{
public:
void polylineproc(odint32 nbpoints,
const odgepoint3d* pvertexlist,
const odgevector3d* ,
const odgevector3d* pextrusion,
odint32 );
};
odgitextstyle gistyle;
gifromdbtextstyle(ptext->textstyle(), gistyle);
gistyle.settextsize(ptext->height());
gistyle.setxscale(ptext->widthfactor());
gistyle.setobliquingangle(ptext->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();
mygeometrysimplifier geom;
geom.setdrawcontext(odgibasevectorizer::drawcontex t());
geom.textproc(position, normal, direction, pstrmsg, ilen, true, &gistyle);
the function
geom.setdrawcontext(odgibasevectorizer::drawcontex t());
gives me an error of overload during compilation.
what can i do?
i am not so skilled in opendwg and any help on how to represent a shx text by polylines will be very well accepted.
thank you in advance.
fede
can you be more specific please: what you have and what you want to get?
what is "ptext" in the code you cited?
in what context this code is executed?
how odgibasevectorizer relates to this context?
vladimir
quote:
originally posted by wvk
can you be more specific please: what you have and what you want to get?
what is "ptext" in the code you cited?
in what context this code is executed?
how odgibasevectorizer relates to this context?
sorry vladimir,
as i wrote i am not so skilled in opendwg.
we have a software application to transform dxf files in cnc programs for
automatic machine. this machine works only with lines and arcs.
i have ptext that is a oddbtextptr.
my target is to obtain the polylines describing the text pointed by ptext.
at the moment by windows api we can obtain the points describing
the true type font pointed by ptext.
i would like to obtain a similar thing also with shf fonts.
so at first i have searched for an shx file format description but i have found nothing that could help me.
i have found on this forum a similar question and so i tried to use it but, as i told, i am not skilled in opendwg.
we don't use till now odgibasevectorizer.
so my question is: starting from my current status, how can i obtain the polylines describing the text?
i thank you in advance.
bye,
ft
vectorizing device may be inherited from odgibasevectorizer.
code:
#include "gi/gigeometrysimplifier.h"
#include "gi/gibasevectorizer.h"
#include "gicontextfordbdatabase.h"
class dumpvectorizer : public odgigeometrysimplifier, public odgibasevectorizer
{
public:
void polylineout(odint32 n, const odgepoint3d* pts)
{
// here lines should be processed
}
};
vectorization then will look like:
code:

odstaticrxobject<dumpvectorizer> dv;
odstaticrxobject<odgicontextfordbdatabase> gicontext;
gicontext.setdatabase(ptext->database());
dv.setdrawcontext(&dv);
dv.setcontext(&gicontext);
dv.textproc(position, normal, direction, pstrmsg, ilen, true, &gistyle);
where textproc parameters are the same as you posted.
or better:
code:
odstaticrxobject<dumpvectorizer> dv;
odstaticrxobject<odgicontextfordbdatabase> gicontext;
gicontext.setdatabase(ptext->database());
dv.setdrawcontext(&dv);
dv.setcontext(&gicontext);
dv.output().setdestgeometry(dv);
dv.draw(ptext);
to avoid manual normal,etc calculation
vladimir
last edited by vkalinin; 7th september 2005 at 05:33 amfff">.
thank you very much vladimir!!
ft
yang686526离线中   回复时引用此帖
GDT自动化论坛(仅游客可见)