Cannot find an element's group name using VBA
Hi,
I´m new to AutoCAD VBA and I am having trouble getting the name of an element's group.
I tried the code below (partial), but it didn't work.
ElseIf MyObject.ObjectName = "AcDbHatch" Then
Dim objGroup As AcadGroup
Dim strGroupList As String
Set objGroup = MyObject.groups.Item
strGroupList = objGroup.Name
MsgBox strGroupList, vbOKOnly, "List of Groups"
Endif
Thanks in Advance,
Bernardo from Brazil
Re: Cannot find an element's group name using VBA
VBA doesn't have an api to tell what group an entity belongs to. You would need to use C# to look at it's persistent reactor or use lisp to examine its dxf codes. Norman mentioned on the Autodesk forum the only way. get the ThisDocument.Groups collection, iterate each group's Items collection looking for the ObjectID of the entity in question.