Ummmm.... I think Kean may be a tad confused.
If you are setting the attribute's textstring, you don't
have to call AdjustAlignment() because that happens when
the textString of database-resident text is changed anyway.
AdjustAlignment() was mainly provided to update the
alignment of text that hasn't been added to a database
yet (like for example, when dragging newly-created text
using a jig).
That's why it takes a Database parameter. If the text
you're changing is already in a database, you don't have
to call AdjustAlignment(), you only need to change the
WorkingDatabase before/after modifying the textString.
{code}
// This is the basic procedure you must use
// to update text in outboard databases:
Database oldDb = HostApplicationServices.WorkingDatabase;
HostApplicationServices.WorkingDatabase = text.Database;
try
{
text.TextString = newVal;
// you can modify as many text objects as needed
// here, while the database they're from is the current
// working database.
}
finally
{
// This *must* be done or AutoCAD will crash:
HostApplicationServices.WorkingDatabase = oldDb;
}
{code}
--
http://www.caddzone.com
AcadXTabs: MDI Document Tabs for AutoCAD
Supporting AutoCAD 2000 through 2010
http://www.acadxtabs.com
Email: string.Format("{0}@{1}.com", "tonyt", "caddzone");
wrote in message news:6327321@discussion.autodesk.com...
I am updating a block reference by changing the attribute values. However, the
text alignments of the updated block reference is screwed up after the update. I
am able to fix it by using the ATTSYNC command at the command line.
How can I ensure that the text alignments of the attribute values are properly
maintained after they are changed programmatically? Any advice is highly
appreciated!
Gagan