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


返回   几何尺寸与公差论坛------致力于产品几何量公差标准GD&T (GDT:ASME)|New GPS(ISO)研究/CAD设计/CAM加工/CMM测量 » 仿射空间:CAX软件开发(三)二次开发与程序设计 » CAD二次开发 » AutoCAD二次开发 » DirectDWG
用户名
密码
注册 帮助 会员 日历 银行 搜索 今日新帖 标记论坛为已读


回复
 
主题工具 搜索本主题 显示模式
旧 2009-05-06, 08:17 PM   #1
yang686526
高级会员
 
注册日期: 06-11
帖子: 14579
精华: 1
现金: 224494 标准币
资产: 234494 标准币
yang686526 向着好的方向发展
默认 【转帖】oddbtext to oddbmte

oddbtext to oddbmtext?
oddbtext to oddbmtext?
hi,
i need to export the text underline property. for that there seems to be no support in oddbtext. so i was wondering whether any quick method exists to convert a oddbtext object to oddbmtext object?
thanks,
varun
hi,
the oddbtext entity takes its font properties from the oddbtextstyletablerecord object. in the text style you can set bold or italic but not underlined. the oddbmtext however, can have underlined text in it, but it is generated by formatting characters stored in the text contents, and not taken from the text style.
as i know, there is no direct way to convert from oddbtext to oddbmtext. you can write such conversion by yourself (copying property by property and producing at last a single line oddbmtext), and, if you want the result text to be underlined, you must add the encoding characters for underlining to the text contents.
hope this helps.
best regards
chudomir
thanks chudomir,
had already narrowed down to the fact that i'll have to switch to mtext for underline. just wanted to know if some mapping from simple text to mtext already existed.
varun
quote:
originally posted by varunsnair
i need to export the text underline property. for that there seems to be no support in oddbtext.
underline and overline are supported in text through switches "%%u" and "%%o" accordingly. for example there is text content "%%uabcd%%uefg" where symbols "abcd" are with underline and "efg" without.
mtext also supports this features through switches "\l" and "\o". for example mtext content "{\labcd}efg".
quote:
originally posted by varunsnair
so i was wondering whether any quick method exists to convert a oddbtext object to oddbmtext object?
you need create odmtext entity and set her property. you may use oddbentity method copyfrom() for setting common entity property.
best regards,
sergey z.
hi sergey,
thanks for the tip. it would be great if underline could be handled in simple text only and i don't have to map to mtext.
however i have a few queries:
1. does the %%u support comes from autocad or is this escape sequence an implementation of your oddbtext class only?
2. if i have to actually write %%u as part of the content, how do i escape that sequence when writitng text.
3. how does this work when we read text back (round-tripping)? for example: i write a text having some underlined content. when i read it back in, which one of the following do i get:
(a) oddbmtext with underline.
(b) oddbtext with content having %%u etc. which we are supposed to handle separately.
(c) oddbtext with just normal text content (%%u etc stripped out) and some property of text object or text style object set that we read and map.
currently, in import we are only handling simple text objects and not mtext. hence a mtext with underline is mapped to text + a line.
thanks,
varun
hi varun,
quote:
originally posted by varunsnair
1. does the %%u support comes from autocad or is this escape sequence an implementation of your oddbtext class only?
yes of course. dwgdirect repeats acad behavior.
quote:
originally posted by varunsnair
2. if i have to actually write %%u as part of the content, how do i escape that sequence when writitng text.
you need parse content and delete these switches.
quote:
originally posted by varunsnair
3. how does this work when we read text back (round-tripping)? for example: i write a text having some underlined content. when i read it back in, which one of the following do i get:
(a) oddbmtext with underline.
(b) oddbtext with content having %%u etc. which we are supposed to handle separately.
(c) oddbtext with just normal text content (%%u etc stripped out) and some property of text object or text style object set that we read and map.
the switches like "%%u" are path of string. its switches are taked into account during rendering. text (and mtext too) hasn't property "underline" and there is no other way make underline text. so you will read oddbtext with switches.
best regards,
sergey z.
hi sergey,
regarding point 2, surely there is someway i can had %%u as part of the content.
for instance in the format string of std c function printf(), if i need to print "%d" as literal and not have it be interpreted as a format placeholder for an integer then i prefix is with %. "%d" -> integer, "%%d" -> string "%d".
so if i need to have content such as "abc%%uxyz", how do i escape the "%%u" part so that it is interpreted as content and not as underline begin sequence.
thanks,
varun
hi varun,
quote:
originally posted by varunsnair
so if i need to have content such as "abc%%uxyz", how do i escape the "%%u" part so that it is interpreted as content and not as underline begin sequence.
the string "%%%" is rendered as "%". so you string must be "abc%%%%%%uxyz".
best regards,
sergey z.

thanks sergey,
export is working fine now.
i've got a related question on import: in the textproc(), how is the "raw" parameter computed? for all our test files, the parameter always comes false. we pass this parameter as it is on to oddbtextiterator which strips off the %%c switches and we map the underline using its currproperties() method. so we were wondering what would happen if anytime it came true?
thanks,
varun
hi varum,
i suppose you have test files with text and without any mtext. the textproc() function is used for mtext too. mtext entity supports sequences like "%%..." for degree symbol (%%d), plus-minus (%%p) and diameter(%%c) only. its symbols are processed within mtext and textproc() is called with braw equal true. other sequences like "%%..." are processed as is. in addition to mtext acad text entity supports sequences "%%o", %%u and "%%nnn" where nnn is decimal symbol code. it is processed in oddbtextiterator when parameter braw is false.
best regards,
sergey z.
so if i understood it correctly, it is safe for me to pass the raw parameter as it is to oddbtextiterator regardless of whether the original entity was text or mtext and things would work out fine?
i tried with some mtext and the results looked good to me.
also i noticed that if i underline some portion of mtext it gets broken to simple text and a polyline. but when i write the exact same thing (text having some portion underlined) as simple text, the vectorizer gives me simple text with underline switches embedded.
for maintaining maximum editability post-vectorization, maybe embedding the underline switches in the text would be a good idea for mtext too, instead of breaking it into a line and text.
thanks,
varun
hi varum,
quote:
originally posted by varunsnair
so if i understood it correctly, it is safe for me to pass the raw parameter as it is to oddbtextiterator regardless of whether the original entity was text or mtext and things would work out fine?
yes of course. you understand right.
quote:
originally posted by varunsnair
for maintaining maximum editability post-vectorization, maybe embedding the underline switches in the text would be a good idea for mtext too, instead of breaking it into a line and text.
problem is what acad renders underline(overline) mtext and text some differently.
note: mtext has method explodefragments() (see also oddbmtextfragment). you can get simple text fragments.
best regards,
sergey z.
yang686526离线中   回复时引用此帖
GDT自动化论坛(仅游客可见)
回复


主题工具 搜索本主题
搜索本主题:

高级搜索
显示模式

发帖规则
不可以发表新主题
不可以回复主题
不可以上传附件
不可以编辑您的帖子

vB 代码开启
[IMG]代码开启
HTML代码关闭

相似的主题
主题 主题发起者 论坛 回复 最后发表
【转帖】how to use the function getboundingpoints of oddbmte yang686526 DirectDWG 0 2009-05-06 03:24 PM
【转帖】getting contents from oddbmte yang686526 DirectDWG 0 2009-05-05 11:27 AM
【转帖】could you get spline from oddbtext or oddbmte yang686526 DirectDWG 0 2009-05-04 06:23 PM
【转帖】bugs in documentation of oddbmte yang686526 DirectDWG 0 2009-05-04 05:10 PM


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


于2004年创办,几何尺寸与公差论坛"致力于产品几何量公差标准GD&T | GPS研究/CAD设计/CAM加工/CMM测量"。免责声明:论坛严禁发布色情反动言论及有关违反国家法律法规内容!情节严重者提供其IP,并配合相关部门进行严厉查处,若內容有涉及侵权,请立即联系我们QQ:44671734。注:此论坛须管理员验证方可发帖。
沪ICP备06057009号-2
更多