Selection Sets

Discussion in 'AutoCAD' started by David, Feb 9, 2004.

  1. David

    David Guest

    Hi NG;

    I've added XData to some groups.

    I would like to access these groups and to do so
    I thought of Selection Sets and filters.

    varDatGrp(0) = "GROUP"
    varDatGrp(1) = "SbAc"

    ' The DXF Groups
    intDatCode(0) = 0 'Object name
    intDatCode(1) = 1001 Application

    But when I use the SelectAll-method with these
    Filters I got nothing in return. (I think GROUP should be something else)

    I then tried to use this filter:
    varDatGrp(0) = "SbAc"

    ' The DXF Groups
    intDatCode(0) = 1001 Application

    That one didn't return any groups either.

    Is it even possible to use filters on groups?

    TIA David
     
    David, Feb 9, 2004
    #1
  2. David

    SpeedCAD Guest

    Hi David...

    You must make a filter of selection. that I think :D.

    F2(0) = "<OR": F1(0) = -4
    F2(1) = "<AND": F1(1) = -4
    F2(2) = "GROUP": F1(2) = 0
    F2(3) = "1001": F1(3) = "APPNAME"
    F2(4) = "AND>": F1(4) = -4
    F2(5) = "OR>": F1(5) = -4

    Prive it...

    Un saludo de SpeedCAD... :)
    CHILE
    FORO: http://www.hispacad.com/foro
     
    SpeedCAD, Feb 9, 2004
    #2
  3. Not exactly. You don't need conditional parameters (OR/AND), just exact name
    of application in 1001. Things get a bit complicated if you need to filter
    on group 1000 and furher down the XData section.

    Regards,
    Maksim Sestic
     
    Maksim Sestic, Feb 9, 2004
    #3
  4. David

    SpeedCAD Guest

    Hi Maksim Sestic...

    Is not possible filter the code 1000 in VB, only 1001.
     
    SpeedCAD, Feb 9, 2004
    #4
  5. David

    David Guest

    Thanks for your answers.

    But I now found out that I actually need to filter on group code 1000
    and thats a bit harder. At least what I can see.

    This doesn't seem to work:
    varDatGrp(0) = "SbAc"
    varDatGrp(1) = strName

    ' The DXF Groups
    intDatCode(0) = 1001 'Application
    intDatCode(1) = 1000 ' String

    I found som code here
    http://www.vbdesign.net/expresso/archive/topic/3284.html
    This code loops through all the entities with the
    same Application-name and gets rid of entities that
    doesn't match the string-expression.
     
    David, Feb 9, 2004
    #5
  6. This is what Jeff recently suggested on that issue:

    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
     
    Maksim Sestic, Feb 9, 2004
    #6
  7. My mistake, here's the continuation from the Dev. Guide...

    (ssget "X"
    '((0 . "CIRCLE")
    (-4 . "<XOR")
    (-3 ("APP1"))
    (-3 ("APP2"))
    (-4 . "XOR>")
    )
    )
    It means that you can filter on multiple APPs using -3 group code, but it
    says nothing on filtering down the 1000 (or any other XData) list... It's
    rather understandable, for at least two reasons: ACAD is not maintaining
    XData and the result may be a list (within a list) and there is no meaning
    for VBA to handle such situation for given case.
     
    Maksim Sestic, Feb 9, 2004
    #7
  8. David

    SpeedCAD Guest

    Hi...

    Maksim Sestic, this is not equal like AutoLISP, VB is different.

    David, the example is good. But like you see is not possible with code 1000.

    I put an example in a previous POST of something similar, watches

    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, Feb 9, 2004
    #8
  9. Is it even possible to use filters on groups?

    Exactly what do you mean by "GROUPS'?

    E.g., do you mean XDATA groups, or do you mean
    GROUPs as created by the GROUP command?

    In either case, the answer is no. But you can
    select all entities that have XData in one or
    more application IDs and then do additional
    filtering manually.



    Copyright (c)2004 Tony Tanzillo
    Unauthorized reproduction expressly prohibited.
     
    Tony Tanzillo, Feb 9, 2004
    #9
  10. David

    David Guest

    Hi Tony;

    Thanks for your answer

    I like to access groups created by the group command.
    Just like iots possible to filter TEXT, LINE aso I thougth
    it would be possible to do so with Groups.

    But as you say I have to do it manually.

    David
     
    David, Feb 9, 2004
    #10
  11. If you want all the objects in one or more groups,
    why don't you just get them from the Group object?



    Copyright (c)2004 Tony Tanzillo
    Unauthorized reproduction expressly prohibited.
     
    Tony Tanzillo, Feb 9, 2004
    #11
  12. David

    David Guest

    Hi again;

    It seems like the code below wont work for selecting groups.

    intXDataTyp(0) = 0: varXData(0) = "GROUP"

    On Error Resume Next
    ThisDrawing.SelectionSets.Item("SS").Delete

    Set objSS = ThisDrawing.SelectionSets.Add("SS")

    objSS.Select mode:=acSelectionSetAll, _
    FilterType:=intXDataTyp, _
    FilterData:=varXData

    Isn't "GROUP" correct for FilterType. If I change to "INSERT" it works.
    I have 6 groups and 5 blockrefs in my drawing. They are all located in one
    of
    the layout tabs.

    Thanks for taking your time to help me out of this mess.

    TIA David
     
    David, Feb 10, 2004
    #12
  13. An AcadGroup, not having an AcadEntity interface, cannot be placed in
    an
    AcadSelectionSet. I suggest that you iterate the AcadGroups
    collection
    and check for the XData on each member.


    --
    Paul Marshall - Toot-OR

    When a wise man does not understand, he says: "I do not understand."
    The fool and the uncultured are ashamed of their ignorance.
    They remain silent when a question could bring them wisdom.
     
    Paul Marshall, Feb 10, 2004
    #13
  14. David

    David Guest

    Thanks for your reply.

    I found out that I could solve it that way.

    It would just be a little less code if I could filter them.
    And a more nice code. IMO
     
    David, Feb 10, 2004
    #14
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.