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

几何尺寸与公差论坛------致力于产品几何量公差标准GD&T (GDT:ASME)|New GPS(ISO)研究/CAD设计/CAM加工/CMM测量 (http://www.dimcax.com/hust/index.php)
-   DirectDWG (http://www.dimcax.com/hust/forumdisplay.php?f=89)
-   -   【转帖】oddbattribute.adjustalignment90 not working correctly (http://www.dimcax.com/hust/showthread.php?t=17473)

yang686526 2009-05-06 07:23 PM

【转帖】oddbattribute.adjustalignment90 not working correctly
 
oddbattribute.adjustalignment() not working correctly
oddbattribute.adjustalignment() not working correctly
direct v.1.08, acad format 2004
i am updating attribute values in dwg files with code similar to the following;
//get an attribute obj pointer
oddbattributeptr attptr = attiterator->objectid().safeopenobject();
//need to modify, dont throw exception
attptr->upgradeopen();
//replace the value
attptr->settextstring( mynewvaluestring );
//recalc insertion data
attptr->adjustalignment();
what then happens is, for instance, middle/centered text aligns a slight amount to the right, the longer the string, the more the misalignment.
since these attributes are in title blocks, they end up bleeding over the right edge of the box boundries.
thanks in advance
bill stamp, synergis
adjustalignment() needs access to the font file to recalculate text position correctly. probably the required font file is inaccesible and default metrics are used.
oddbhostappservices::findfile() is responsible for locating the correct font file. it's default implementation uses environment variable acad as a list of search paths.
you can override its behavior in your oddbhostapp inheritor.
sergey slezkin
thanks much - that did the trick.


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