Consulting

Results 1 to 3 of 3

Thread: AutoCad Layers, Groups & Entities

  1. #1

    AutoCad Layers, Groups & Entities

    Sorry to post this twice, but I mistakenly put it in the Non-English Forum

    With the help of this Forum I have been able to obtain the Layers in a Drawing, The Groups in a Drawing, and the Entities in a Drawing. And, I have been able to associate Layers with the Entities, but I have not been able to associate Groups with the Entities.

    I need to create a report that shows the Entities in a Group, the Groups in a Layer, and the Layers in a Drawing. If I could associate the Groups with the Entities, than I could peice the whole thing together.

    Any assistance will be greatly appreciated.

  2. #2
    Moderator VBAX Master Tommy's Avatar
    Joined
    May 2004
    Location
    Houston, TX
    Posts
    1,184
    Location
    I worked on something like this at the autocad users group. The problem you will have is a Group is idependant of layers, in other words the group can have entities in different layers, the actual group is not on a layer, it consit of entities, a selection set of sorts. I can get you (ok show you) how to get the groups, the entities in the group and all the properties that pertain to this entity.

    [VBA]Sub Groupies()
    Dim Grp As AcadGroup, mI As Long, mEnt As AcadEntity
    For Each Grp In ThisDrawing.Groups
    MsgBox Grp.Name
    For mI = 0 To Grp.Count - 1
    Set mEnt = Grp(mI)
    MsgBox mEnt.Layer
    MsgBox Grp(mI).ObjectName
    Next
    Next
    End Sub[/VBA]

  3. #3

    AutoCad Layers, Groups & Entities

    Hi Tommy,

    This looks like the ticket. I'll try it out next week. I'm pretty sure that all of the entities of a group are on the same layer. Let's hope so at least.

    Thanks for the help!

Posting Permissions

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