Set Mark of an element by Text Note nearby

Hi,

i have a Revit-model with many elements created in Revit.
My challenge is that the elements has to use marks specified by the client.

I have a dwg-file with all the marks that i imported into revit and exploded it.
Then i’m able to select the nearest Text Note of the element and set it as the Mark-paramter.

So far it works very fine for me.
My problem is that i have lots of elements and currently i have to select each single element and run the script.
Is there a possibilty to run this script for all elements of a type in one time?

Thanks for your ideas and help.

Yes, but…

Are all of the elements needing tagged closest to their correct mark note? Would it be easier just to box elements in Revit and manually set the Mark?

There are up to thousand elements where the parameter “Mark” has to be set.
The paramater is given by the client in the dwg-file.

It’s possible to set the parameter manually for each element but i think it would be much easier to set the parameter by Dynamo.
I managed to set the parameter Mark for a single element but i with this workflow i have to select each element after the another and run the script. I hope that it’s possible to select all elements and run the script only one time but i don’t know how.

you could use categories:

That’s possible.
But it gives the same result as my solution (if i select every elements at once).

Only the parameter of the first element in the selction is filled. The parameters of the remaining elements are empty.

Sounds like a lacing issue. Can you show your graph using all elements of category with previews turned on?

Thanks for your hint. It was a lacing problem. I replaced the List.AllIndicesOf node with a IndexOf node and changed the lacing to longest.

Now it works perfect for me.