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

alignment and position in oddbtext
alignment and position in oddbtext
which is the difference and the relation between alignment point (method alignmentpoint()) and position point (method position()) in the oddbtext class?

position is always (left,baseline) point of the text. alignment point depends on vertical and horizontal alignment. for example if text alignment is (right,top) than alignment point is right top corner of the text.
while creating text entity if alignment is left, baselige you need to specify position point. if alignment is (top,center) you specify top center as alignment point. position will be calculated by dd based on heiht, font, text string.
if alignment is fit or aligned you have to specify both points.
sergey slezkin
quote:
originally posted by sergey slezkin
position is always (left,baseline) point of the text. alignment point depends on vertical and horizontal alignment. for example if text alignment is (right,top) than alignment point is right top corner of the text.
while creating text entity if alignment is left, baselige you need to specify position point. if alignment is (top,center) you specify top center as alignment point. position will be calculated by dd based on heiht, font, text string.
if alignment is fit or aligned you have to specify both points.
i am having a similar problem with alignment and positioning. i have a top,center justified piece of text for which i am specifying the alignment point only and not the position. however, the position that dd is calculating does not seem to be correct.
a simple test is to use dd to read an autocad file with one piece of justified text, capturing the text string, height, font, justification etc. and then writing a new database using those values. the result is not the same when both files are viewed inside autocad. the alignment of the text is the same for both files, but the position of the text in the second file is not the same.
i understand that the adjustalignment() function is called automatically on oddbtext object closure, however, it seems that this very thing is causing the position to be calculated incorrectly.
i can send more info if required, but this should be reasonably easy to reproduce.
thanks in advance,
ryan
i should note that i am using version 1.11 build 1 of dwg direct.
to calculate position correctly dd needs access to the font. if the font is not available default one is used and position may differ from the right one because of different font metrics.
sergey slezkin
quote:
originally posted by sergey slezkin
to calculate position correctly dd needs access to the font. if the font is not available default one is used and position may differ from the right one because of different font metrics.
the font being used is specified as 'standard' and the filename is 'txt.shx' for both the source and destination. i would expect the same position out if the fonts are the same.
i am using vs .net 2003 and the vc2003mt statically linked libraries.
regards,
ryan
if txt.shx present on computer and is available to autocad it does not mean that dd is able to find it.
dd calls oddbhostapp::findfile() to get the full path to .shx file.
this function is expected to be overridden in oddbhostapp inheritor to take care about fonts location.
sergey slezkin
quote:
originally posted by sergey slezkin
if txt.shx present on computer and is available to autocad it does not mean that dd is able to find it.
dd calls oddbhostapp::findfile() to get the full path to .shx file.
this function is expected to be overridden in oddbhostapp inheritor to take care about fonts location.
ok, i have overwritten the findfile() method and set the acad environment variable to teh autocad fonts directory and things are working now. it would be nice if there was some way a user could have that work done for them without having to be told to set an environment variable at all.
for example,a reliable registry key for locating the autocad installation directory. then we could derive the fonts directory and get the correct file path.
any suggestions on how to get the autocad install directory?
regards,
ryan
odamfcapp sample contains codamfcappapp::findfile() attempting to locate acad folders based on registry information.
but this is not general solution - your application using dd will work correctly only on computers with installed autocad.
we intentionaly put this code not into dd but into the sample to avoid the situation when application works on developer's computer and does not work on his customer's one.
sergey slezkin
thanks for all your help.
regards,
ryan
is it possible to avoid automatic call the adjustalignment() function? i set right values for the position and alignmentpoint but dd overwrites the position point.
quote:
originally posted by oleg k
is it possible to avoid automatic call the adjustalignment() function? i set right values for the position and alignmentpoint but dd overwrites the position point.
yes, it's possible. after all properties/coordinates are set to the text entity call
ptext->recordgraphicsmodified(false);
this will prevent position recalculation.
sergey slezkin
thank you, now autocad shows texts correctly.
as far as i understand, if autocad will not find the same font then a text position may be a little wrong. is there the way do not use the 'position' point at all, in order autocad use only the 'alignmentpoint' and calculate the 'position' point automatically when load a drawing.
autocad always use position to draw the text loaded from dwg. it recalculates the position based on alignment point only if text is modified.
autocad always recalculates text position loading dxf file.
if text has fit or align justification both position and alignment points are used. this can help to make a text which is displayed "correctly" with different fonts.
sergey slezkin
yang686526离线中   回复时引用此帖
GDT自动化论坛(仅游客可见)
回复


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

高级搜索
显示模式

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

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

相似的主题
主题 主题发起者 论坛 回复 最后发表
【转帖】position tolerance of the opening which is in distance from yang686526 American standards 0 2009-04-29 09:20 PM
【转帖】asme - where to star yang686526 American standards 0 2009-04-29 07:28 PM
【转帖】drawingview position yang686526 SolidWorks二次开发 0 2009-04-13 10:35 AM


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


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