.NET

Reply
Valued Contributor
Ertqwa
Posts: 99
Registered: ‎10-03-2011
Message 1 of 5 (297 Views)
Accepted Solution

Changing position of AttributeDefinition

297 Views, 4 Replies
12-18-2012 01:16 AM

Hello Forum,

 

I am trying to change the position of an AttributeDefinition in a block, but it nothing is changed:

 

foreach (ObjectId oidAttribute in btrBlock)
{
    adOrg = taTransaction.GetObject(oidAttribute, OpenMode.ForRead) as AttributeDefinition;
    if (adOrg != null)
    {
            adOrg.UpgradeOpen();
            adOrg.Position = new Point3d(0, 0, 0);
            // Break;
            break;
    }
    adOrg = null;
}
...
Commit();

 What is wrong? How do I change the position?

 

Thank you.

Hi,

 

Attribute definition and reference are derived classes of DBText, which has two parameters to define its location (Position and AlignmentPoint). The alignment of the text may need to be updated after changing its content, which relates to middle/right horizontal/vertical alignment and font style. To update the text alignment, you need to manually set AlignmentPoint property or call attributeDefinition.AdjustAlignment(HostApplicationServices.WorkingDatabase)

 

-Khoa

 

Valued Contributor
michael.vanhoose
Posts: 71
Registered: ‎09-26-2007
Message 2 of 5 (287 Views)

Re: Changing position of AttributeDefinition

12-18-2012 03:54 AM in reply to: Ertqwa

Don't forget to go back thru the blockreferenceid's and update all the block references with the new difinition.

 

After you change the difinition insert a new block.  you will see the new position.  But, the old block references do not have that position.

Mentor
khoa.ho
Posts: 224
Registered: ‎09-15-2011
Message 3 of 5 (278 Views)

Re: Changing position of AttributeDefinition

12-18-2012 06:42 AM in reply to: Ertqwa

Hi,

 

Attribute definition and reference are derived classes of DBText, which has two parameters to define its location (Position and AlignmentPoint). The alignment of the text may need to be updated after changing its content, which relates to middle/right horizontal/vertical alignment and font style. To update the text alignment, you need to manually set AlignmentPoint property or call attributeDefinition.AdjustAlignment(HostApplicationServices.WorkingDatabase)

 

-Khoa

 

Valued Contributor
Ertqwa
Posts: 99
Registered: ‎10-03-2011
Message 4 of 5 (243 Views)

Re: Changing position of AttributeDefinition

12-22-2012 06:01 AM in reply to: michael.vanhoose

Hi,

 

True, but my problem was that I had to change AlignmentPoint.

 

Thank you for the response.

Valued Contributor
Ertqwa
Posts: 99
Registered: ‎10-03-2011
Message 5 of 5 (242 Views)

Re: Changing position of AttributeDefinition

12-22-2012 06:02 AM in reply to: khoa.ho

Hi,

 

Yes changing AlignmentPoint does the trick.

 

Thanks!

Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Announcements
Are You Going To Be @ AU 2014? Feel free to drop by our AU topic post and share your plans, plug a class that you're teaching, or simply check out who else from the community might be in attendance. Ohh and don't forgot to stop by the Autodesk Help | Learn | Collaborate booths in the Exhibit Hall and meet our community team if you get a chance!