Reading tags

I have a line element drawn in my design file.  It has a tag whose value is "tel-1-1-001".  The line also has a note that points to the line.  If the line is altered by the user, ie, the start or end point are manually moved, the note will no longer point to the line, so it needs to be moved to the line.  I'm trying to write some code that will:

1) find the line

2) get its tag value

3) find the note with that corresponding text

4) reposition the note so that it points to the line once again.

I'm having no problems with (or do not anticipate having any problems with) steps 1, 3, or 4.  Step 2 has got me stumped though.  I've followed the code found here at la-solutions.  In the code below thisFileModel has been declared as a ModelReference

Dim oScan As ElementEnumerator
Set oScan = thisFileModel.Scan
Do While oScan.MoveNext
    If (oScan.Current.IsGraphical) Then
         Dim oHost As Element
        If (oScan.Current.HasAnyTags) Then
            Set oHost = thisFile.GetElementByID(DLongFromLong(DLongToLong(oScan.Current.ID)))
            Dim oTags() As TagElement
            Dim nTags As Integer
            Dim j As Integer
            Dim vtValue As Variant
            oTags = oHost.GetTags()
            For j = LBound(oTags) To UBound(oTags)
                vtValue = oTags(j).Value
                MsgBox ("Tag[" & CStr(j) & "] = " & CStr(vtValue))
            Next j
        End If
    End If
Loop

 This, however,results in a message box that shows, "Tag[0] = ".  It doesn't show the value of the tag and I don't know why.  Can anyone help?

Parents Reply Children
No Data