Number parts of Duct System by order of selection

I created a simple script attempting to place a number (by order of selection) in a set parameter for the elements selected. In this case I am renumbering a run of duct which includes multiple catagories; duct, duct fittings, & duct accessories.
Using the Springs.SelectElements(ordered) I am able to get a list of elements but when I use the Element.SetParameterValueByName node I get an error that says:

“Warning: Element.SetParameterByName operation failed.
The best overloaded method match for ‘Revit.Elements.InternalUtilities.ElementUtils.SetParameterValue(Autodesk.Revit.DB.Parameter, double)’ has some invalid arguments”

I first tried to use the node from Rhythm called Isolated Pick Model Elements(ordered), this would work except I am only able to select elements from one category. I need to have everything in the run of duct (duct, fittings, & accessories) numbered in order.

See screenshot of my dyn.

Apply Item Number to duct.dyn (14.0 KB)

I got rid of the String.Insert node and now it works. I would like to improve this by having the elements that I select “highlight” or change color somehow & also by having the numbering sequence automatically start at the next available number. (Basically don’t want anything to have the same item number). What I gathered from a previous post was that the coloring portion probably isn’t an option for me unless I can figure out how to make python scripts. Is this the case?

It Should still be an option, it will just consist of a number of nodes to make up for the lack of python, what is being done to color in most other posts are that python is basically used for the sorting and determining which color should go where if they are not allowed to be next to each other :slight_smile:

Ok, I figured out how to make the elements change color. My issue now is that with the nodes I am using, the parameters are not changed & the elements are not colored until after I hit ESC when I am done selecting elements. My hope is that while I am selecting elements, I can get the element to change color as soon as I click on it so that I don’t click on the element twice.

That part I do not think will be possible. Dynamo can’t color your elements until they are selected, and they aren’t actually “selected” until you finish the command.

im doing a similar project. mind sharing your final dynamo script for the order of selection for duct system? much appreciate