Filtering SSet for XData problem

Discussion in 'AutoCAD' started by Maksim Sestic, Jan 31, 2004.

  1. Here's what I can't figure out - how do I filter SSet for, say, partial
    string "*John*" if I have an XData structure like this:

    Type: 1001 Data: "MYAPP"
    Type: 1002 Data: "{"
    Type: 1000 Data: "John"
    Type: 1000 Data: "Wayne"
    Type: 1002 Data: "}"

    I tried with SelSet filters:

    DataType(0) = 1001: DataString(0) = "MYAPP"
    DataType(1) = 1000: DataString(1) = "*John*"

    but it doesn't work. Many thanks for any tip regarding the problem.

    Maksim Sestic
     
    Maksim Sestic, Jan 31, 2004
    #1
  2. Maksim Sestic

    SpeedCAD Guest

    Hi...

    Try this...

    Private Sub SelXdata()
    Dim tipoXdatoOut As Variant
    Dim valorXtipoOut As Variant
    Dim objEntidad As AcadEntity
    Dim sSeleccion As AcadSelectionSet
    Dim cSeleccion As AcadSelectionSets
    Dim vCodigo As Variant
    Dim vEntidad As Variant
    Dim codigo(0) As Integer
    Dim entidad(0) As Variant

    AppActivate autocadApp.Caption
    Set cSeleccion = autocadApp.ActiveDocument.SelectionSets

    For Each sSeleccion In cSeleccion
    If sSeleccion.Name = "SS" Then
    sSeleccion.Delete
    Exit For
    End If
    Next
    Set sSeleccion = cSeleccion.Add("SS")
    codigo(0) = 1001
    entidad(0) = "MYAPP"
    vCodigo = codigo
    vEntidad = entidad
    sSeleccion.Select acSelectionSetAll, , , vCodigo, vEntidad
    For Each objEntidad In sSeleccion
    objEntidad.GetXData "MYAPP", tipoXdatoOut, valorXtipoOut
    If valorXtipoOut(1) = "John" Then
    objEntidad.Color = acBlue
    objEntidad.Highlight True
    End If
    Next objEntidad
    End Sub

    Un saludo de SpeedCAD... :)
    CHILE
    FORO: http://www.hispacad.com/foro
     
    SpeedCAD, Jan 31, 2004
    #2
  3. Thanks SpeedCAD, but this is the approach I've already implemented. I was
    rather wandering if it's possible to implement filtering on both
    1001="MYAPP" and 1000="*John*" simultaneously. Autodesk documentation says
    that codes 1000+ are "not maintained by AutoCAD"... whatever this means, but
    still can't figure out why I just can't filter on DXF code 1001...

    Regards,
    Maksim Sestic
     
    Maksim Sestic, Jan 31, 2004
    #3
  4. Maksim Sestic

    Jeff Mishler Guest

    Straight from the developer's guide....
    The ssget function recognizes all group codes except entity names
    (group -1), handles (group 5), and xdata codes (groups greater than 1000).
    If an invalid group code is used in a filter-list, it is ignored by ssget.
    To search for objects with xdata, use the -3 code as described in Filtering
    for Extended Data

    HTH,
    Jeff
     
    Jeff Mishler, Jan 31, 2004
    #4
  5. Maksim Sestic

    SpeedCAD Guest

    Hi Maksim Sestic...

    That it not possible, only you can filter with code 1001 (App name). But the example that I write for you works fine.

    Un saludo de SpeedCAD... :)
    CHILE
    FORO: http://www.hispacad.com/foro
     
    SpeedCAD, Jan 31, 2004
    #5
  6. Maksim Sestic

    FrankZander Guest

    What I would like to see is code that returns a secondary selection set
    AFTER the initial Xdata selection set is processed. Doable?
     
    FrankZander, Jan 31, 2004
    #6
  7. Wow, -3? I'll have to look through docs more carefully...

    Thanks,
    Maksim Sestic
     
    Maksim Sestic, Feb 1, 2004
    #7
  8. Doable, but hardly in only one pass... First selection set you get
    immediatelly after filtering, and second one you create by filtering again
    the first selset. Something in a form of function like:

    Function SecondFilter(FirstSelectionSet as AcadSelectionSet, SecondSetType
    as Variant, SecondSetData as Variant) as AcadSelectionSet
     
    Maksim Sestic, Feb 1, 2004
    #8
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.