How to select an element that is in a reference?

I have an element enumerator that holds elements both in a reference and in the current design file.

Set oEnumerator = ActiveModelReference.GetSelectedElements      'Capture the selected elements
ActiveModelReference.UnselectAllElements                   'Unselect all, ready to re-select only certain identified elements

I interrogate each element:

Set oElement = oEnumerator.Current             'Capture the current element in the set

I need to select certain elements - from either of the files. I can select the ones in the current design file with:

ActiveModelReference.SelectElement oElement

But when oElement is in a reference, I can't seem to select it. I have tried:

oElement.ModelReference.AsAttachment.SelectElement oElement

and various other combinations, but they don't work.

Here's the latest permutation of my code (don't laugh):

If oElement.ModelReference.IsAttachment Then
    ActiveModelReference.Attachments(oElement.ModelReference.Name).SelectElement oElement
    ActiveModelReference.SelectElement oElement
End If

Can someone provide the code needed to select an element in a reference that may be nested 0 or more levels deep?



Parents Reply Children
No Data