Filtering XData Problem

Discussion in 'AutoCAD' started by Chris Picklesimer, Aug 26, 2003.

  1. I am trying to filter entities that have attached XData and am running into
    a problem. Basically, I have created a relationship between a "base" entity
    and an assembly of entities. Each entity in the assembly contains the
    handle of the base object in the form of attached XData. The complete
    information attached to the assembly entities is as follows: 1.)
    Application name: "BPLATECHILD" 2.) Handle of "base" object, and 3.) a
    string tag: "OUTLINE".

    The problem is when I try to get all assembly entities using the FilterTest
    Sub below. When I use the first sub, SearchAllTest, I am able to highlight
    all associated assembly entities and get the correct count. The FilterTest
    sub only gives me some of the assembly entities. I thought both methods
    would me the same count. What am I missing?

    btw, The reason I am using filters is because I thought it would be faster
    and more efficient than have to sort through all entities in my dwg file.
    Is that right?

    Thanks for any help.

    Chris

    '==========================================================
    Public Sub SearchAllTest()
    Dim xDT As Variant
    Dim xDV As Variant
    Dim i As Integer
    Dim Pt As Variant
    Dim obj As AcadEntity
    Dim ent As AcadEntity
    Dim intCount As Integer

    intCount = 0
    ThisDrawing.Utility.GetEntity obj, Pt, "Select Base Object: "
    For Each ent In ThisDrawing.ModelSpace
    ent.GetXData "BPLATECHILD", xDT, xDV
    If Not IsArrayEmpty(xDT) Then
    If xDV(1) = obj.Handle And xDV(2) = "OUTLINE" Then
    ent.Highlight True
    intCount = intCount + 1
    End If
    End If
    Next ent

    MsgBox intCount
    End Sub

    '==================================================


    Public Sub FilterTest()
    Dim objss As AcadSelectionSet
    Dim strName As String
    Dim EntGrp(2) As Integer
    Dim EntData(2) As Variant
    Dim pt1(2) As Double
    Dim pt2(2) As Double
    Dim i As Integer
    Dim Pt As Variant
    Dim obj As AcadEntity

    ThisDrawing.Utility.GetEntity obj, Pt, "Select Base Object: "
    strName = "Temp"

    On Error Resume Next
    Set objss = ThisDrawing.SelectionSets.Add(strName)
    If objss Is Nothing Then
    Set objss = ThisDrawing.SelectionSets(strName)
    objss.Clear
    End If

    pt1(0) = 0: pt1(1) = 0: pt1(2) = 0
    pt2(0) = 0: pt2(1) = 0: pt2(2) = 0

    EntGrp(0) = 1001
    EntData(0) = "BPLATECHILD"

    EntGrp(1) = 1005
    EntData(1) = obj.Handle

    EntGrp(2) = 1000
    EntData(2) = "OUTLINE"

    objss.Select acSelectionSetAll, pt1, pt2, EntGrp, EntData
    objss.Highlight True
    MsgBox objss.count

    End Sub

    '==========================================================
     
    Chris Picklesimer, Aug 26, 2003
    #1
  2. You can only filter on the 1001 group code (the APPNAME). Merge the two
    approaches: filter for entities with your APPNAME then iterate the set
    and process only those which meet your additional citeria.
     
    Frank Oquendo, Aug 26, 2003
    #2
  3. Thanks for the response. It appears though that I am able to filter for some entities(dimensions and AEC_Walls to name a few) but not Text, Lines or Circles. Is the filtering that I am attempting limited to only certain entities?



    Thanks again.



    Chris





    "Frank Oquendo" <> wrote in message news:...

    > Chris Picklesimer wrote:
    >
    > > btw, The reason I am using filters is because I thought it would be
    > > faster and more efficient than have to sort through all entities in
    > > my dwg file. Is that right?
    >
    > You can only filter on the 1001 group code (the APPNAME). Merge the two
    > approaches: filter for entities with your APPNAME then iterate the set
    > and process only those which meet your additional citeria.
    >
    > --
    > There are 10 kinds of people. Those who understand binary and those who
    > don't.
    >
    > http://code.acadx.com
    >
    >
     
    Chris Picklesimer, Aug 26, 2003
    #3
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.