HELP - Add sequence of number to elements – identical elements must have the same number

Hi everybody

I’m in need of a little help. I have looked on the different topics and can’t find an existing solution, so now I’m a little stuck.

I’m trying to add a sequence of unique numbers to my elements, in this case structural columns.

I need a unique number to every different element and the same number to every element whitch is the same. There by the same material, length, width and depth.

The picture above is what I’m trying at the moment, but I think I need, some more sorting, whit more parameter values.
I’ll tryid that in an earlier solution, but could not make it work either.

So if I’ll could be pointed in the right dirrection, it would be appreciated.

Thanks in advance.

Get a list of all your elements. Get the parameter values of those elements (material, length, width, depth) and transpose them so each sublist is a set of one element’s parameters. Use SortByKey to sort your elements by their list of parameters. Get a list of the unique element parameters and a count of each sublist that matches those parameters. Chop your list of elements by the number of unique sublists. You should now have a list of unique parameter value sets and a list of element sublists sorted by those parameter value sets. Number each element in a set accordingly.

I know this is a little long-winded, but give it a try and see where you get. I can probably get an example drawn up at some point.

EDIT: Pretty close to what I wrote up.


Hi Nick

Thanks a lot for your solution, it works perfectly! :smiley:

Here is my solution. Had to add String from object, because my parameter is a Text-parameter and had to set the lacing to longest on SetParameteByName(TypeOrInstance) - Then it works great!

add sequence of number to elements

Thanks again for the reply!

1 Like