Attrubute text alignment problem after update

Attrubute text alignment problem after update

Anonymous
Not applicable
701 Views
3 Replies
Message 1 of 4

Attrubute text alignment problem after update

Anonymous
Not applicable
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
0 Likes
702 Views
3 Replies
Replies (3)
Message 2 of 4

Anonymous
Not applicable
gagangajabaharia wrote:

> 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.

Kean addressed this ...

http://through-the-interface.typepad.com/through_the_interface/2007/07/updating-a-sp-1.html

... see Update 2 about 1/2 way down!

Good Luck, Terry
0 Likes
Message 3 of 4

Anonymous
Not applicable
Thanks 🙂
0 Likes
Message 4 of 4

Anonymous
Not applicable
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
0 Likes