Results 1 to 3 of 3

Thread: VBA - List of objects in a drawing

  1. #1
    Member
    Join Date
    2018-07
    Posts
    2
    Login to Give a bone
    0

    Default VBA - List of objects in a drawing

    Hello,

    I have a huge file with numerous objects I need to work on.

    I would like to have the list of all objects and as much information I can get (layer, bounding box, object type etc.)

    I would like to generate this list in VBA.

    Any ideas?


    Thank you

  2. #2
    Administrator Ed Jobe's Avatar
    Join Date
    2000-11
    Location
    Turlock, CA
    Posts
    6,397
    Login to Give a bone
    0

    Default Re: VBA - List of objects in a drawing

    Autodesk has Managed Debug on GitHub that you could use. It allows you to explore the database. It doesn't give you a list of everything though.
    C:> ED WORKING....

  3. #3
    Member
    Join Date
    2017-01
    Posts
    8
    Login to Give a bone
    0

    Default Re: VBA - List of objects in a drawing

    Sub Change_All_existing_To_Layer()

    Dim ssAll As AcadSelectionSet
    Dim mEntity As AcadEntity, oBlkRef As AcadEntity
    Dim blkAtt As String
    Dim ssets As AcadSelectionSets

    'clear selection set
    Set ssets = ThisDrawing.SelectionSets
    On Error Resume Next
    Set ssAll = ssets.Item("AU2013_SS")
    If Err.Number <> 0 Then
    Set ssAll = ssets.Add("AU2013_SS")
    Else
    ssAll.Clear
    End If
    'selects all entries in drawing
    Set ssAll = ThisDrawing.SelectionSets.Add("AllEntities")
    ssAll.Select acSelectionSetAll

    For Each mEntity In ssAll 'loops thru entry list
    If TypeOf mEntity Is AcadBlockReference Then 'picks blocks
    Set oBlkRef = mEntity
    If oBlkRef.HasAttributes Then 'picks blocks with attributes
    blkAtt = Get_Attribute(oBlkRef, "BLKSET.FURNISH")
    If blkAtt = "\W0.7500;E" Then 'picks "existing" devices
    mEntity.layer = "STAGE.NOTES.SD"
    End If
    End If
    End If
    Next
    ssAll.Clear 'cleans the selection set
    ssAll.Delete
    Set ssAll = Nothing
    ThisDrawing.Regen acActiveViewport 'regenerates the drawing
    End Sub

    this can pick all entities in modelspace
    then filters blocks with attributes
    and changes the layers of those with "E" on the "BLKSET.FURNISH" attribute

    the speciffic part you might be interested in is:

    Set ssAll = ThisDrawing.SelectionSets.Add("AllEntities")
    ssAll.Select acSelectionSetAll

Similar Threads

  1. 2015: "Appears in Drawing List" parameter added to a drawing index schedule
    By ron.randell in forum Revit Architecture - General
    Replies: 2
    Last Post: 2015-06-25, 09:01 PM
  2. Improve Drawing List to customize drawing order, discipline, etc
    By Wish List System in forum Revit Architecture - Wish List
    Replies: 4
    Last Post: 2012-09-25, 05:02 PM
  3. Change Objects Layer by List
    By freedomonek in forum AutoLISP
    Replies: 10
    Last Post: 2009-02-05, 01:17 PM
  4. Is there an easy way to get a list of all objects on a form?
    By cgerhardt in forum VBA/COM Interop
    Replies: 2
    Last Post: 2006-10-10, 12:07 PM
  5. Replies: 2
    Last Post: 2006-05-02, 04:41 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •