Ghost elements in drawing...

So I have spreadsheet with a bunch of point data, and i have a .net app that scans microstation dgn using COM API for text nodes and elements that fall into the point range. This does work, but i'm getting what I would call ghost data on top of the real visible text elements. The values are similar to what could've been in that area before, but they are obviously not in the drawing now. I checked all levels, i tried searching for them with find/replace tool, still no luck. But they do come up as valid textelements when i'm scanning the with COM API.

Anyone run into this? It feels like there should be a IsElementAlmostDeleted flag or something along those lines...

Parents
  • Without seeing any code, it's impossible to comment.

     
    Regards, Jon Summers
    LA Solutions

  • Sure, here's a section where I'm scanning for text elements, i hate posting code here because of the formatting mess...

     

    Dim elems As New List(Of TextElem)         Dim elemEnum As ElementEnumerator        Dim scanCriteria As New ElementScanCriteria        scanCriteria.ExcludeAllTypes()        scanCriteria.IncludeType(MsdElementType.msdElementTypeText)        scanCriteria.IncludeType(MsdElementType.msdElementTypeTextNode)        elemEnum = UstnApplication.ActiveModelReference.Scan(scanCriteria)          Do While elemEnum.MoveNext             If elemEnum.Current.IsTextElement Then                Dim telem As TextElement                telem = elemEnum.Current                If telem.Text.Trim <> "" Then                    Dim tl As New TextElem                    tl.MaxPoint = telem.Boundary.High                    tl.MinPoint = telem.Boundary.Low                    tl.Value = telem.Text                    tl.TextObj = telem                    elems.Add(tl)                              End If            End If            If elemEnum.Current.IsTextNodeElement Then                Dim tn As TextNodeElement                tn = elemEnum.Current                Dim tnEnum As ElementEnumerator                tnEnum = tn.GetSubElements                Do While tnEnum.MoveNext                    Dim telem As TextElement                    telem = tnEnum.Current                     If telem.Text.Trim <> "" Then                        Dim tl As New TextElem                        tl.MaxPoint = telem.Boundary.High                        tl.MinPoint = telem.Boundary.Low                        tl.Value = telem.Text                        tl.TextObj = telem                        elems.Add(tl)                    End If                Loop              End If        Loop          For Each tl In elems            For Each p In params                If IsTextWithinRange(tl, p) Then                    If p.Value = "3.65,5.67;4.22,5.985" Then 'drawing does not have anything in this range                        tl.TextObj.IsHighlighted = True                    End If                     If p.ReturnedValue = "" Then                        p.ReturnedValue = tl.Value                    Else                        p.ReturnedValue = p.ReturnedValue & ";" & tl.Value                    End If                    p.ListOfTextElems.Add(tl)                    Exit For                End If            Next        Next 

  • This part is where I catch the ghost entity:

    If p.Value = "3.65,5.67;4.22,5.985" Then 'drawing does not have anything in this range

                   tl.TextObj.IsHighlighted = True

    End If

  • Another interesting thing to point out is that when i selected all elements and copied/pasted into a new drawing, these ghost entities didn't show up.

  • Unknown said:
    I hate posting code here because of the formatting mess

    I agree.  It used to work better, but something changed in the way the editor handles the HTML <pre> element.  I wish they would restore it to the working version.

     
    Regards, Jon Summers
    LA Solutions

  • Unknown said:
    When I selected all elements and copied/pasted into a new drawing, these ghost entities didn't show up

    Is there something unexpected about the original DGN?  Perhaps it contains self-references?

     
    Regards, Jon Summers
    LA Solutions

Reply Children