几何尺寸与公差论坛------致力于产品几何量公差标准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-07, 06:19 PM   #1
yang686526
高级会员
 
注册日期: 06-11
帖子: 14579
精华: 1
现金: 224494 标准币
资产: 234494 标准币
yang686526 向着好的方向发展
默认 【转帖】vectorization And Text Alignmen

vectorization and text alignment
vectorization and text alignment
environment:
windows xp pro
visual studio .net 2003
dwgdirect 1.12.04.00
i've got an application based on odvectorizeex and i'm overriding exgssimpledeviceolylineproc(...) so that i use the vertexlist passed in to draw all the lines in my viewer. on the whole it works well. the problem i have is that with text entities, it seems to ignore the alignment. so if the text is centred, it draws all the text properly, just in the wrong place.
any ideas?
hi jonathan,
here is the context of autocad-help:
code:
remarks
text aligned to acalignmentleft uses the insertionpoint property to position the text.
text aligned to acalignmentaligned, or acalignmentfit uses both the insertionpoint and textalignmentpoint properties to position the text.
text aligned to any other position uses the textalignmentpoint property to position the text.
so you must check always the alignment to put/get the right point of the text/attribute.
__________
ralph
so you mean that once i've got the points of the text, that i need to adjust them myself depending on the alignment?
why doesn't dwgdirect automatically adjust the points and give me the corrected points to draw?
hi jonathan,
i have no good knowledge about the opendwgviewer, but if i modifyed textobject in autocad, special the textposition, i must get some properties of the textobjects to put the right position. one of these properties is the alignment.
it's very nice to have mirrored textobjects, because it's also possible to put a negative scalefactor also to set a textgenerationflag like actextflagbackward.
i mean, it's not easy to modifyed textobjects.
hope it helps.
________
ralph
the reason of wrong text position can be different.
does it happen while rendering loaded dwg or dxf file? or newly created file?
are you able to reproduce the situation in one of our samples (odamfcapp for example) or while exporting to dwf or svg?
sergey slezkin
ok, i've managed to reproduce the problem in odamfcapp.
i've attached a file called align.dxf which has some text that should be centred. im my application and also in odamfcapp the v is displayed off to the left rather than under the centre of the aaaaaaa bit.
i downloaded the bravo free dwg viewer and that displays it correctly, ie. centred.
by the way, i had to zip the file to upload it. why won't the forum let me upload .dxf files?
thanks for help on this.
attached files (9.8 kb, 16 views)

hi jonathan,
i've saved your ac1009=r12 in r2004/2005. i haven't checked your dxf-file for correct syntax. i think, it's better to work with actually-formats, because you get much better functions.
please test attachment with your application.
_________
ralph
attached files (44.2 kb, 7 views)

text stores 2 points: position and alignment point.
position is text's left/base_line point. alignment point has different meaning depending on alignment type.
if alignment is fit both values are used.
if alignment is left/base_line - only position is used.
in other cases alignment point is used to calculate position point (and position is recalculated if text string or height or other properties are modified).
when text is rendered position is always used as a point to start text drawing from.
if alignment is center for example and position and alignment points do not match text will be shown displaced. this will happen in autocad too if dwg file is loaded.
while loading dxf autocad does not trust position value for centered text and recalculates it according to alignment point and type of alignment.
dwgdirect does not recalculate the position while loading dxf. to recalculate position correctly right font must be used. autocad always have its fonts available. dd-based applications may have no access to autocad fonts.
so we decided that we better show text displaced in incorrect dxf files (where position and alignment points do not match) than demage correct files by recalculating text position without right font available.
sergey slezkin
ok, thanks guys, that helps.
vectorization and text alignment
ralph,
you posted align.dwg to this thread a week or so ago.
could you possibly post it as a dxf file?
i am continuing with this problem where jonathan left off.
thanks very much.
david
hi david,
here are your dxf-files (saved by autocad2005 -> ascii/16decimal) in
ac1018
ac1015
ac1009
__________
ralph
attached files (14.7 kb, 5 views)

hi,
here some informations about textspecifications from dxfdoc.
________
ralph
attached files (37.1 kb, 33 views)

i have been looking at co-ordinates, in the align.zip that jonathan posted a couple of days ago, and have viewed the file with our application, a free viewer, and turbocad version 7 (ages old i know). also looked at the align.dwg that ralph posted. both files do not contain a '7' code, and so use the default 'standard' text style (font).
our application reads ralph's file perfectly.
jonathan's file views correctly in the freeview and turbocad, but our application gets it wrong. as sergey points out, dwgdirect does not recalculate the start point, and i observe that the start point of the text is correct. however, the end point is not.
as the text in jonathan's file only contains the letters 'a' and 'v', and these letters look different in our application compared to freeview and turbocad, i conclude that the problem is that the characterwidth of the letters 'a' and 'v' in the dwgdirect built-in font are different to the characterwidth of the letters in the autocad standard font. all the letters used by ralph's sample have correct characterwidths, so it works.
i am just off to make a sample file with every letter of the alphabet, to see if any other letters are different.
i would add that the 'a' in the dd builtin font looks much better than the one in the autocad standard font, but it would help if the characterwidth was the same
david
hi,
here is a quicky for a mirrored insert with attributereferences and different textgenerationflags.
the job is to transform all attributereferences to the same position/alignment like the examples in the rectang.
the example has only acalignmentleft.
have fun
__________
ralph
attached files (39.9 kb, 7 views)

david,
standard text style which is used if group code 7 is absent may have different fonts. usually by default it's txt.shx or simplex.shx
dd built-in font is similar to simlex.
the only purpose of having built-in font is to see the text somehow if where are no fonts available. the only way of dispaying text properly is to have correct fonts.
sergey slezkin
yang686526离线中   回复时引用此帖
GDT自动化论坛(仅游客可见)
 


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

高级搜索
显示模式

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

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

相似的主题
主题 主题发起者 论坛 回复 最后发表
【转帖】he Dimension Text Scale In Block yang686526 DirectDWG 0 2009-05-07 04:56 PM
【转帖】ext Alignmen yang686526 DirectDWG 0 2009-05-07 04:41 PM
【转帖】oddbtext to oddbmte yang686526 DirectDWG 0 2009-05-06 08:17 PM
【转帖】custom properties for multiple part configurations yang686526 SolidWorks二次开发 0 2009-04-13 10:08 AM
【转帖】linked sketch text now possible1 9sort of0 yang686526 SolidWorks二次开发 0 2009-04-12 09:34 PM


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


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