Set position number after sorting elements and schedule it

Hello everyone. I work for a company that produces light steel frame building solutions.
We are now implementing BIM and getting rid of our old software (CAD WORK) working with Revit. As people that work with steel element or rebar for concrete know, we need to assign a position number to elements that have the same characteristics. In my case I need to assign this number after sorting the profiles by type (C and U) and by length. I’ve thought to rename the paramenter “mark” as some tutorial suggest but I have difficulties in designing the script for sorting and making the list according to my criteria.
Is there anyone that has already experienced the same problem and found a solution?

Thank you in advance!!

Show us what you’ve tried so far and search the forum and you’ll find it easier to provide you with help…

You cannot rename the parameter “Mark” as its a BuiltIn parameter.
Renaming parameters is a bad idea.
Create a new shared parameter instead.

This is the base that I’m starting to modify. I created a shared parameter, according to suggestion, and I would like to attach at the beginning a script to create lists of elements sorted by My 2 criteria. Do you think it is a good idea?

ps this is an old script that I used to tag the ID number of elements in tables.

Element Id 's do sometimes change in workshared models.

Use Element UniqueId instead.

Can you give us an example of the position convention?

If you were, for example, assigning a position according to profile type and length, then you don’t need Dynamo and this can be done in Revit with tags and tables. For example, if your position number looks like is C12-3400.

Otherwise, if the convention correlates to the type and length, you could ‘translate’ the position number by using some sort of lookup table with predefined positions. This assumes you are allowed to have gaps in your position numbers.

If you are using a counting position number…1…2…3… and need to maintain positions throughout the project cycle, then you will have to maintain some kind of database of numbers used, and numbers available. In that case, you would probably have to maintain positions by reading existing positions out of excel, and writing new positions in without deleting the old ones.

Profile and type, however, will essentially generate a unique ‘id’ for you to work with.

From there, you could check if excel contains the element.
If yes, then write out of excel and into Revit.
If no, find the next available position in excel, and write this position into the element and into excel.