You can use the Attribute object properties and methods to edit the attribute.Some of the properties on an attribute include the following:
Specifies the horizontal and vertical alignment of the attribute
Specifies the direction of attribute text
Specifies the field length of the attribute
Specifies the height of the attribute
Specifies the insertion point of the attribute
Specifies the mode of the attribute
Specifies the prompt string of the attribute
Specifies the rotation of the attribute
Specifies the scale factor of the attribute
Specifies the tag string of the attribute
Some of the methods you can use to edit the attribute include the following:
Creates a polar array
Creates a rectangular array
Copies the attribute
Erases the attribute
Mirrors the attribute
Moves the attribute
Rotates the attribute
Scales the attribute
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