PDA

View Full Version : AutoCad Layers, Groups & Entities



TinkernTom
02-15-2008, 02:03 PM
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.

Tommy
02-16-2008, 03:17 PM
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.

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

TinkernTom
02-16-2008, 05:07 PM
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!