Selection Set - How do I select Block Reference Objects?

Discussion in 'AutoCAD' started by Mel, Mar 24, 2005.

  1. Mel

    Mel Guest

    I have used selection sets before, like the example below to select all of
    the light-weight polylines on the Bottom layer. Does anyone know how to
    select just Block Reference objects? I tried to just replace LWPOLYLINE
    with BLOCK REFERENCE, BLOCK, BLOCKREF, etc, but it didn't work.

    '------------Start of Example------------
    Dim CurSet As AcadSelectionSet
    Dim SelCode(0 To 1) As Integer
    Dim SelValue(0 To 1) As Variant

    SelCode(0) = 8
    SelValue(0) = "Bottom" 'look on Bottom layer
    SelCode(1) = 0
    SelValue(1) = "LWPOLYLINE" 'find lightweight polylines only

    CurSet.Select acSelectionSetAll, , , SelCode, SelValue
    '------------End of Example------------

    Any help would be greatly appreciated.
     
    Mel, Mar 24, 2005
    #1
  2. Mel

    Jeff Mishler Guest

    A block reference is an "INSERT".......
     
    Jeff Mishler, Mar 24, 2005
    #2
  3. Mel

    Mel Guest

    I am currently using a For Next loop to evaluate the block reference names
    in the selection set. So...if I know the name of the block reference is
    there a way I can filter that too?
     
    Mel, Mar 24, 2005
    #3
  4. Mel

    Jeff Mishler Guest

    Sure, incresase the size of the arrays and add a 2 to the SelCode(2) and the
    block name to SelValue(2)
     
    Jeff Mishler, Mar 24, 2005
    #4
  5. Mel

    Mel Guest

    Thanks again. I thought I'd post what I ended up with if anyone's
    interested:

    '------------Start of Example------------
    Dim CurSet As AcadSelectionSet
    Dim SelCode(0 To 2) As Integer
    Dim SelValue(0 To 2) As Variant

    Set CurSet = ThisDrawing.SelectionSets.Add("CutSelSet")

    SelCode(0) = 8
    SelCode(1) = 0
    SelCode(2) = 2
    SelValue(0) = "Drill" 'Look on Drill layer
    SelValue(1) = "INSERT" 'only select block references
    SelValue(2) = "SYMG*" 'only block names beginning with symg
    CurSet.Select acSelectionSetAll, , , SelCode, SelValue
    '------------End of Example------------
     
    Mel, Mar 24, 2005
    #5
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.