AddAttribute Method

Creates an attribute definition at the given location with the specified properties.

See Also | Example

Signature

RetVal = object.AddAttribute(Height, Mode, Prompt, InsertionPoint, Tag, Value)

Object

ModelSpace Collection, PaperSpace Collection, Block
The object or objects this method applies to.

Height

Double; input-only
The text height in the current drawing unit.

Mode

AcAttributeMode enum; input-only
(any combination of constants can be used by adding them together):

acAttributeModeInvisible

acAttributeModeConstant

acAttributeModeVerify

acAttributeModeLockPosition

acAttributeModeMultipleLine

acAttributeModePreset

Prompt

String; input-only
This string appears when a block containing this attribute is inserted. The default for this string is the Tag string. Inputting acAttributeModeConstant for the Mode parameter disables the prompt.

InsertionPoint

Variant (three-element array of doubles); input-only
The 3D WCS coordinates specifying the location for the attribute.

Tag

String; input-only
This non-null string identifies each occurrence of the attribute. Enter any characters except spaces or exclamation points. AutoCAD changes lowercase letters to uppercase.

Value

String; input-only
This non-null string is the default attribute value.

RetVal

Attribute object
The newly created Attribute object.

Remarks

The Mode values are as follows:

acAttributeModeInvisible

Specifies that attribute values won't appear when you insert the block. The ATTDISP command overrides the Invisible mode.

acAttributeModeConstant

Gives attributes a fixed value for block insertions.

acAttributeModeVerify

acAttributeModeLockPosition

Locks the position of the attributes.

acAttributeModeMultipleLine

Allows the attributes to carry-over onto multiple lines. Prompts you to verify that the attribute value is correct when you insert the block.

acAttributeModePreset

Sets the attribute to its default value when you insert a block containing a current attribute. The value cannot be edited in this mode.

An attribute definition is associated to the block for which it is created. Attribute definitions created in model space or paper space are not considered to be attached to any given block.

The AFLAGS system variable stores the mode setting. You can query this value using the GetVariable method, or set it using the SetVariable method.

 

   Comments?