高级会员
注册日期: 06-11
帖子: 14579
精华: 1
现金: 224494 标准币
资产: 234494 标准币
|
【转帖】getting correct text size and width factor
getting correct text size and width factor?
getting correct text size and width factor?
hi,
i am using dwgdirect version 1.14 with vc2005. i am having the following problem.
if i use the following code as is written in the odvectorizeex example then the size of the font and the width factor are not correct and are always 1.0000 and 1.0000 respectively. the code is
odgitextstyle& textstyle;
textstyle.textsize();
textstyle.xscale();
and on the other hand, if i use the following code as is written in the odreadex example then the size and the width factor of the font are returned correctly. the code is
oddbtext* ptext;
ptext->height();
ptext->widthfactor();
can any body please tell me that how i can get the correct font size and the width factor by using the first method because i am using vectorization in my application.
please help me!
best regards,
faisal.
quote:
originally posted by f_shaukat
hi,
i am using dwgdirect version 1.14 with vc2005. i am having the following problem.
if i use the following code as is written in the odvectorizeex example then the size of the font and the width factor are not correct and are always 1.0000 and 1.0000 respectively. the code is
odgitextstyle& textstyle;
textstyle.textsize();
textstyle.xscale();
and on the other hand, if i use the following code as is written in the odreadex example then the size and the width factor of the font are returned correctly. the code is
oddbtext* ptext;
ptext->height();
ptext->widthfactor();
can any body please tell me that how i can get the correct font size and the width factor by using the first method because i am using vectorization in my application.
please help me!
best regards,
faisal.
hi faisal,
method odgiconveyorgeometrydumper::textproc() has parameters const odgevector3d& direction and const odgevector3d& upvector. text size and width factor may be calculate by next way:
textsize() = upvector.length()
widthfactor() = direction.length()/upvector.length()
best regards,
sergey z.
getting correct text size and width factor
hi sergey z.
thank you very much for your reply. first, in the odgiconveyorgeometrydumper::textproc() there are no direction and up vector but only u and v vectors. i used both u and v vectors interchangeable for the direction and up vectors but the result was some times wrong. i have attached an exmaple dwg file on which the above method gives wrong result for at least one text entry.
secondly, i have one more question regarding the same attached file. there is an acdbmtext entry in this file. if this file is vectorized then the odgiconveyorgeometrydumper::textproc() method gets control for all of the acdbtext entries but it does not gets control for the acdbmtext entry and the control goes to the odgiconveyorgeometrydumper::shellproc() directly. why so?
i do not need the reduced data of the acdbmtext entry. what can i do in this case?
please help!
thanks in advance,
faisal.
attached files (27.9 kb, 5 views)
quote:
originally posted by f_shaukat
first, in the odgiconveyorgeometrydumper::textproc() there are no direction and up vector but only u and v vectors. i used both u and v vectors interchangeable for the direction and up vectors but the result was some times wrong. i have attached an exmaple dwg file on which the above method gives wrong result for at least one text entry.
faisal.
u is direction and v is up vector. you need comment line seteyetooutputtransform(eye2screen) in method exsimpleview::update()(file exgssimpledevice.cpp). in this case you get height and width factor in drawing measurement.
quote:
originally posted by f_shaukat
hi sergey z.
secondly, i have one more question regarding the same attached file. there is an acdbmtext entry in this file. if this file is vectorized then the odgiconveyorgeometrydumper::textproc() method gets control for all of the acdbtext entries but it does not gets control for the acdbmtext entry and the control goes to the odgiconveyorgeometrydumper::shellproc() directly. why so?
i do not need the reduced data of the acdbmtext entry. what can i do in this case?
acdbmtext is complex entity and it is rendered by fragments. so you will get a pieces of mtext in vectorizer. your file contains the simple mtext but it is special case. in case mtext has two line you will get two calls method textproc().
in case you don't need getting shells you may change inisialize odgiconveyorgeometrydumper (use in constractor m_dumplevel(minimal_simplification) ).
best regards,
sergey z.
getting correct text size and width factor
hi sergey z.,
thank you very much for your reply.
i want to restate the second question again. the problem is that i have already set the m_dumplevel to minimal_simplification, but still the control goes to the shell. this seems more of a bug because some times the flow of control is like
acdbmtext
textproc()
shellproc() // when used with maximal simplification
shellproc() // when used with maximal simplification
textproc()
shellproc() // when used with maximal simplification
shellproc() // when used with maximal simplification
end acdbmtext
and some times, even with the minimal simplification, the control is like
acdbmtext
shellproc()
shellproc()
shellproc()
shellproc()
end acdbmtext
note that there are even no textprocs but still the control goes to shell proc.
i am facing this problem in general. for example, i have another file and i did the vectorization on this file twice. first, in the original file. the vectorization does not have any calls to shells. and then i introduced a little change, like i added a layout and now the outcome of vectorization contains shell entities as well. why so?
please reply on this issue because i am having trouble because of this.
thanks again,
faisal.
hi faisal,
it's not a bug. it happens because text's geometry is clipped by a viewport boundary, so it can't be represented by a textproc() primitive after that. you can disable viewport clipping (by commenting out pushclipboundary() and popclipboundary() calls in exsimpleview::update()). note that drawing may contain model clipping on block insertions also.
last edited by dmitry a. novikov; 29th november 2006 at 04:28 amfff">.
getting correct text size and width factor
dear novikov,
thank you very much. my problem is solved by your reply!
best regards,
faisal.
|