高级会员
注册日期: 06-11
帖子: 14579
精华: 1
现金: 224494 标准币
资产: 234494 标准币
|
【转帖】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.
|