Edit Attribute Definitions
 
 
 

You can use the Attribute object properties and methods to edit the attribute.Some of the properties on an attribute include the following:

Alignment

Specifies the horizontal and vertical alignment of the attribute

Backward

Specifies the direction of attribute text

FieldLength

Specifies the field length of the attribute

Height

Specifies the height of the attribute

InsertionPoint

Specifies the insertion point of the attribute

Mode

Specifies the mode of the attribute

PromptString

Specifies the prompt string of the attribute

Rotation

Specifies the rotation of the attribute

ScaleFactor

Specifies the scale factor of the attribute

TagString

Specifies the tag string of the attribute

Some of the methods you can use to edit the attribute include the following:

ArrayPolar

Creates a polar array

ArrayRectangular

Creates a rectangular array

Copy

Copies the attribute

Erase

Erases the attribute

Mirror

Mirrors the attribute

Move

Moves the attribute

Rotate

Rotates the attribute

ScaleEntity

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