Refer to an attribute by its tagname

Refer to an attribute by its tagname

mdhutchinson
Advisor Advisor
338 Views
6 Replies
Message 1 of 7

Refer to an attribute by its tagname

mdhutchinson
Advisor
Advisor
Can't you refer to an attribute by its tagname... or do I need to use the following instead?

Dim varAttributes As Variant
Dim incAtt As Integer

varAttributes = blkMrk.GetAttributes
For incAtt = LBound(varAttributes) To UBound(varAttributes)
If varAttributes(incAtt).TagString = "CNT#" Then
varAttributes(incAtt).TextString = CStr(CntlNum)
End If
Next
0 Likes
339 Views
6 Replies
Replies (6)
Message 2 of 7

Anonymous
Not applicable
???? "TagName" = TagString ????

wrote in message news:5427563@discussion.autodesk.com...
Can't you refer to an attribute by its tagname... or do I need to use the
following instead?

Dim varAttributes As Variant
Dim incAtt As Integer

varAttributes = blkMrk.GetAttributes
For incAtt = LBound(varAttributes) To UBound(varAttributes)
If varAttributes(incAtt).TagString = "CNT#" Then
varAttributes(incAtt).TextString = CStr(CntlNum)
End If
Next
0 Likes
Message 3 of 7

mdhutchinson
Advisor
Advisor
Yes... sorry meant to say:

Can't you refer to an attribute by its TagString ...
0 Likes
Message 4 of 7

Anonymous
Not applicable
OK. Yep, that's how I'd do it, but if I were to be using more than 1
attribute I'd use a Select Case in lieu of the If.


wrote in message news:5427617@discussion.autodesk.com...
Yes... sorry meant to say:

Can't you refer to an attribute by its TagString ...
0 Likes
Message 5 of 7

mdhutchinson
Advisor
Advisor
yes... I just answered my question... because it is possible to have duplicate tags in a block...
looping to get the tag and then to change the TextString is the only way... I guess.
0 Likes
Message 6 of 7

Anonymous
Not applicable
Hutch,

I'd advise getting away from duplicate tags in the same block. Some of the
OOTB tools to work on attributes don't handle that situation real well.

--
R. Robert Bell


wrote in message news:5427623@discussion.autodesk.com...
yes... I just answered my question... because it is possible to have
duplicate tags in a block...
looping to get the tag and then to change the TextString is the only way...
I guess.
0 Likes
Message 7 of 7

mdhutchinson
Advisor
Advisor
agreed... duplicate tags are not a good idea at all..
I am really quite suprised that AutoCAD doesn't prevent it.
0 Likes