You can use the Attribute object properties and methods to edit the attribute.Some of the properties on an attribute include the following:
- Alignment
- Backward
- FieldLength
- Height
- InsertionPoint
- Mode
- PromptString
- Rotation
- ScaleFactor
- TagString
Some of the methods you can use to edit the attribute include the following:
Redefine an attribute definition
This example creates a block and then adds an attribute to the block. The block is then inserted into the drawing. The attribute text is then updated to be displayed backward.
Sub Ch10_RedefiningAnAttribute()
' Define the block
Dim blockObj As AcadBlock
Dim insertionPnt(0 To 2) As Double
insertionPnt(0) = 0
insertionPnt(1) = 0
insertionPnt(2) = 0
Set blockObj = ThisDrawing.Blocks.Add _
(insertionPnt, "BlockWithAttribute")
' Add an attribute to the block
Dim attributeObj As AcadAttribute
Dim height As Double
Dim mode As Long
Dim prompt As String
Dim insertionPoint(0 To 2) As Double
Dim tag As String
Dim value As String
height = 1
mode = acAttributeModeVerify
prompt = "New Prompt"
insertionPoint(0) = 5
insertionPoint(1) = 5
insertionPoint(2) = 0
tag = "New Tag"
value = "New Value"
Set attributeObj = blockObj.AddAttribute(height, mode, _
prompt, insertionPoint, tag, value)
' Insert the block, creating a block reference
' and an attribute reference
Dim blockRefObj As AcadBlockReference
insertionPnt(0) = 2
insertionPnt(1) = 2
insertionPnt(2) = 0
Set blockRefObj = ThisDrawing.ModelSpace.InsertBlock _
(insertionPnt, "BlockWithAttribute", 1#, 1#, 1#, 0)
' Redefine the attribute text to display backwards.
attributeObj.Backward = True
attributeObj.Update
End Sub