Creates an attribute definition at the
given location with the specified properties.
Signature
VBA : RetVal = object.AddAttribute(Height, Mode, Prompt,
InsertionPoint, Tag, Value)
VL : RetVal = (vla-AddAtribute
object Height Mode Prompt InsertionPoint Tag Value)
(vla-addattribute
mspace height mode pr pt1 tag val)
- 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
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
An attribute definition is associated to the block upon which it is
created. Attribute definitions created on model space or paper space are
not considered to be attached to any given block.
The attribute can be created with any or all of the following modes:
- acAttributeModeInvisible:
Specifies that attribute values won't appear when you insert the
block. The ATTDISP system variable overrides the Invisible mode.
- acAttributeModeConstant:
Gives attributes a fixed value for block insertions.
- acAttributeModeVerify:
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 present attribute. The value cannot be edited in this
mode.
The AFLAGS system variable stores the
mode setting. You can query this value using the GetVariable method, or
set it using the SetVariable method.
Example :
;Create an attribute in ModelSpace.
;Ask for all parameters, except mode which is retrieved
;from the system variable AFLAGS, and create the attribute.
;Because this attribute is created in ModelSpace it is not
;attached to a block.
(setq doc (vla-get-activedocument (vlax-get-acad-object)))
(setq mspace (vla-get-modelspace doc))
(setq pt1 (vlax-3d-point (setq pt (getpoint "\nInsertion point: "))))
(setq height (getdist "\nHeight: " pt))
(setq mode (getvar "AFLAGS")
pr (getstring "Prompt: ")
tag (getstring "Tag: ")
val (getstring "Initial value: ")
)
(vla-addattribute mspace height mode pr pt1 tag val)
|
|