.NET
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Attrubute text alignment problem after update

3 REPLIES 3
Reply
Message 1 of 4
Anonymous
492 Views, 3 Replies

Attrubute text alignment problem after update

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
3 REPLIES 3
Message 2 of 4
Anonymous
in reply to: Anonymous

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
Message 3 of 4
Anonymous
in reply to: Anonymous

Thanks 🙂
Message 4 of 4
Anonymous
in reply to: Anonymous

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

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk DevCon in Munich May 28-29th


Autodesk Design & Make Report

”Boost