Changing an Attribute value with If statement

Changing an Attribute value with If statement

Anonymous
Not applicable
407 Views
1 Reply
Message 1 of 2

Changing an Attribute value with If statement

Anonymous
Not applicable
I'm trying to do a search and replace of an attribute value. I have template drawings with multiple occurances of the same attribute "TAG1". I'm trying to write an If statement that will update the value of the attribute based on it's current value. What I'm not sure how to do is how to get VB to read the value. I'm far from a VB expert so any help would be appreciated.

Here's what I'm trying to do in english.

If the value of TAG1 is = to CR1 Then. Not sure how to do this.

Replace with a value from a cell in Excel. I've got this part down.

Thanks in advance.

Mark
0 Likes
408 Views
1 Reply
Reply (1)
Message 2 of 2

Anonymous
Not applicable
maybe this helps you getting started

{code}

Dim a, b, n
For Each b In ThisDrawing.ModelSpace
If TypeOf b Is AcadBlockReference Then
a = b.GetAttributes
For n = 0 To UBound(a)
If a(n).TagString = "TAG1" Then
If a(n).TextString = "VALUE" Then
a(n).TextString = "NEW_VALUE"
End If
End If
Next n
End If
Next b


{code}
0 Likes