First of all, you should use GetAttachedEntities3, which has been available since 2008 and will be more reliable.
The swEnts, if it is not empty, will be an array of entities, so you will need to loop through the array.
Here is some pseudo that I haven't tested:
Dim i As Integer
Dim thisEnt as Entity
swEnts = swAnnotation.GetAttachedEntities
vAttEntTypeArr = swAnnotation.GetAttachedEntityTypes2
If swEnts IsNot Nothing Then 'This is .Net code. If you are using VBA then you need to write If IsEmpty(swEnts)=False Then
For i = 0 To UBound(swEnts)
Debug.Print "Type of attached entity(" & i + 1 & ") as defined in swSelectType_e = " & vAttEntTypeArr(i)
Set thisEnt = swEnts(i)
Thank you for your response.
If I select the "10-32" callout and run the code, the swEnts array only has one element. Now if I select that single element in the array with the code:
Set swEdge = swEnt vFace = swEdge.GetTwoAdjacentFaces2() Set swFace = vFace(0) swFace.GetFeature.Select2 False, 0
it selects all four holes at once.
I would like to have access to each of the four individual holes.
There's quite a lot to say here:
1. The annotation is really only attached to 1 entity
2. That entity in this case is an Edge - hopefully you checked the entity type before setting seEdge = swEnt?
3. The edge belongs to 2 faces and you just process the first one, rather than checking to see if it is planar or cylindrical. You might need to use the second face.
4. You have successfully retrieved a cylindrical (by chance!), but then step back and select the feature which defines all 4 holes
5. But that's OK, because you can now call GetFaces on the feature to retrieve the list of 4 faces that you wanted in the first place. Again, it might return the planar face that the holes are drilled into, so loop through all of them and only select the cylindrical ones.
Hope that helps.
Thank you for the suggestion. That got me going in the right direction. I'll post the code when I get it finished and cleaned up.