Get dialogue box with list of Element IDs

After I have filtered down to a list of elements which I want in a list, how can I create a list of their Element IDs which will show up in a dialogue box from which I can then copy and paste? I want to have a semi-colon as a separator between each Element ID as well to make it easy to paste into Revit’s “Select by ID” dialogue box. If this could be done with only a limited amount of Python and API usage I would appreciate it since I am just starting to learn how to use these. Thanks for any help!

Assuming you already have something like DataShapes or another package for presenting a dialog box, you just need to concatenate your list of elements (as Ids). You can use Element.Id and String.Join as a simple ootb node solution. If you want to do it all in python then you can loop through each element in your list and add to a running output. Start with an empty string like output = "". Then loop through your elements; for each element in the list combine output = output + ";" + element.Id to add to the list of Ids.

I do have DataShapes but have hardly used it. Is the MultipleInputForm++ a good node to use for this, or is there a better node in this package for a dialogue box to produce text values? I may try the Python method you explained, though that will take me a while since I don’t know how specifically how to make the loop you mention (outside of the two portions you detailed already).

Yes. It has a dialog box option. I believe Rhythm or Springs also has a (simpler) dialog box node, but it would probably be good to get comfortable with DataShapes. It’s very useful when it comes to custom inputs.

1 Like

I’ll give it a shot with Data Shapes. One more part of this task I don’t know how to do: how do I retrieve the Element IDs themselves as strings? I see them in my list of objects with the green highlighted links; would it be simplest to convert these elements to strings then remove the number of characters from the front which aren’t the Element IDs? Or would you suggest another approach?

Dynamo has an Element.Id node that will return the element Id. The API uses a similar method, element.Id, for most objects.

1 Like

That’ll make it easy. Thank you very much!