Changing position of AttributeDefinition

Changing position of AttributeDefinition

Ertqwa
Advocate Advocate
1,253 Views
4 Replies
Message 1 of 5

Changing position of AttributeDefinition

Ertqwa
Advocate
Advocate

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.

0 Likes
Accepted solutions (1)
1,254 Views
4 Replies
Replies (4)
Message 2 of 5

michael_vanhoose
Advocate
Advocate

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.

Message 3 of 5

Anonymous
Not applicable
Accepted solution

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

 

Message 4 of 5

Ertqwa
Advocate
Advocate

Hi,

 

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

 

Thank you for the response.

Message 5 of 5

Ertqwa
Advocate
Advocate

Hi,

 

Yes changing AlignmentPoint does the trick.

 

Thanks!