LinkedElement selection returns 2 references

LinkedElement selection returns 2 references

giovannibrogiolo6744
Contributor Contributor
702 Views
7 Replies
Message 1 of 8

LinkedElement selection returns 2 references

giovannibrogiolo6744
Contributor
Contributor

Hi all,

Why when I select an element in a linked files using a selection box I get 2 references with the same Id (instead of 1)?

linkSelection.png

linkSelection01.png

 

I am trying to copy/paste elements from a linked file. The command works fine even if the elements are counted twice (i.e. only 1 element is copied into the active project).

 

Thank you

0 Likes
Accepted solutions (1)
703 Views
7 Replies
Replies (7)
Message 2 of 8

caroline.gitonga
Autodesk
Autodesk

Hi @giovannibrogiolo6744 ,

The overload PickObjects Method (ObjectType, String) returns a collection of references selected by the user (multiple selection) which in this case we are using selection box.

A single reference object provides some of these properties:
ElementId -in this case this ElementId refererences the id of the RevitLinkInstance from which selection was done.
LinkedElementId - is id of the top-level element in the linked document that is referred to by this reference.

From my understanding, your selection box selected 2 elements from the same RevitLinkInstance (instance of linked doc).
Therefore, ElementId will be the same for both references and their LinkedElementId should be different.

I hope this explains well. Thanks

Carol Gitonga, Developer Advocacy and Support, ADN Open
0 Likes
Message 3 of 8

caroline.gitonga
Autodesk
Autodesk
Accepted solution

Hi @giovannibrogiolo6744 ,

I apologize for the above response I posted earlier, I realized it did not address your exact issue. I reproduced the exact issue you are having and submitted it to the engineering team. Will keep you posted with the feedback. Thanks

Carol Gitonga, Developer Advocacy and Support, ADN Open
0 Likes
Message 4 of 8

giovannibrogiolo6744
Contributor
Contributor

Thank you Carol.

Are there any updates on this? 

 

Thank you

0 Likes
Message 5 of 8

caroline.gitonga
Autodesk
Autodesk

Hi @giovannibrogiolo6744 ,

Thank you for following this up. I have not  received any update yet but I have resubmitted it to the Dev team  for attention.

 

If I may ask, could there be any specific reason you wish to use the select box instead of PickObjects function to do multiple selection?

 

 

Carol Gitonga, Developer Advocacy and Support, ADN Open
0 Likes
Message 6 of 8

giovannibrogiolo6744
Contributor
Contributor

I'd like to use the select box because I have more than 10 elements to copy from a linked model and clicking them one by one is a bit tedious.

I have sorted this out by skipping duplicated Ids but I was just curious why this happens and if it's intended.

 

 

Thank you

0 Likes
Message 7 of 8

john.miller.DPS
Explorer
Explorer

I am seeing the same behavior. I too am curious why this is happening and if there is any update form the development team? 

 

@giovannibrogiolo6744  - out of curiosity, what method did you use to skip over the duplicated IDs?   

Message 8 of 8

onBIM-Consulting
Enthusiast
Enthusiast

I went through the same problem these days. I solved it for now using the LINQ method Distinct( ). Code below:

 

Snag_ee81173.png

 

and here my implementation of comparer

Snag_ee939c7.png

 

0 Likes