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

Attribute alignment never updates

4 REPLIES 4
Reply
Message 1 of 5
bsee1
405 Views, 4 Replies

Attribute alignment never updates

In Autocad I'm programmatically settign the alignment of an attribute to MiddleCenter.  Looking at the attribute I can see that the alignment is set properly.  However, the alignment does visually update itself.  

 

I'm able to manually update the allignment if I open the Enhanced Attribute Editor and make any change.  If any property is updated, the attribute "realizes" it needs to update the alignment.

 

How can I make AutoCAD automatically update the alignment?  Here is a current snippet of my code.  In this particular instance "result" will contain 004 as a string:

 

attribute.TextString = result 

attribute.Alignment = AcAlignment.acAlignmentMiddleCenter
attribute.Update()

*****************************
Win7 x64 - 16gb ram
i7 3610qm
FirePro M4000

Inventor 2013
ETO 6.1
4 REPLIES 4
Message 2 of 5
Hallex
in reply to: bsee1

After setting an alignment try this way:
attref.AdjustAlignment(db)
attref.RecordGraphicsModified(true)
bref.RecordGraphicsModified(true)
where 'bref' is block reference, 'db' is Database
_____________________________________
C6309D9E0751D165D0934D0621DFF27919
Message 3 of 5
bsee1
in reply to: Hallex

Which attribute object has the RecordGraphicsModified function?  Currently I'm using the Autodesk.AutoCAD.Interop.Common.AcadAttributeReference object, but it doesn't seem to contain the function RecordGraphicsModified().

*****************************
Win7 x64 - 16gb ram
i7 3610qm
FirePro M4000

Inventor 2013
ETO 6.1
Message 4 of 5
hgasty1001
in reply to: bsee1

Hi,

 

There is no RecordGraphicsModified in Interop. As for the problem, may be a call to Attsync do the trick.

 

Gaston Nunez

Message 5 of 5
bsee1
in reply to: hgasty1001

Found a solution for interop.  I had programmatically just opened another sheet in the background, retrieved info, then closed it before adding text to this attribute.  That seems to have caused my issue.  By setting the current sheet to active again the text was inserted with the proper alignment.

*****************************
Win7 x64 - 16gb ram
i7 3610qm
FirePro M4000

Inventor 2013
ETO 6.1

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