block layers to listbox

Discussion in 'AutoCAD' started by Lunt, Aug 12, 2004.

  1. Lunt

    Lunt Guest

    any suggestions on how to select a block and have a list box display the layers the make up the block?
     
    Lunt, Aug 12, 2004
    #1
  2. Lunt

    Joe Sutphin Guest

    Lunt,

    Here's a little something I banged out right quick, hope it's what you need.

    Joe
    --

    Public Sub ListBlockRefLayers()
    Dim iType(0) As Integer
    Dim vData(0) As Variant
    Dim oSS As AcadSelectionSet
    Dim Index As Long
    Dim oBlock As AcadBlock
    Dim oEntity As AcadEntity
    Dim Count As Long

    'use selectionset filter
    iType(0) = 0: vData(0) = "INSERT"

    On Error Resume Next
    'delete any previous selection sets
    ThisDrawing.SelectionSets("Inserts").Delete
    On Error GoTo 0
    'create new selection set
    Set oSS = ThisDrawing.SelectionSets.Add("Inserts")

    UserForm1.Hide
    oSS.SelectOnScreen iType, vData

    If oSS.Count Then
    For Count = 0 To oSS.Count - 1
    Set oBlock = ThisDrawing.Blocks(oSS.Item(Count).Name)

    For Index = 0 To oBlock.Count - 1
    ListBox1.AddItem oBlock.Item(Index).Layer
    Next Index
    Next Count
    End If
    UserForm1.Show
    End Sub


    layers the make up the block?
     
    Joe Sutphin, Aug 13, 2004
    #2
  3. Lunt

    Lunt Guest

    thanks joe...I got it......udaman
     
    Lunt, Aug 13, 2004
    #3
  4. Lunt

    Joe Sutphin Guest

    You're quite welcome, glad I could help.

    Joe
     
    Joe Sutphin, Aug 13, 2004
    #4
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.