Generating different Identity data for the same family in Revit

Hey guys!
I just recently started learning about Dynamo and I have a bugging issue in Revit which I continue to do manually but I want to automatize it.

I need to name all of these foundation piles in Revit to have a name that starts with “P” and then continuous to numbers from 1 to n, I choose it to be in Identity Data - Comment section (as shown in photo).

Can you suggest any shortcut for this via Dynamo?

Thanks in advance!

This is how I would do it:

Numerated Family Type Parameter by ZYX Position.dyn (56.9 KB)

p.s. I suggest you swap values between mark and comments, because using comments as mark could be confusing…

1 Like

Agreed it’s not straightforward to sort by multiple criteria
Alternative using python

Code

OUT = sorted(enumerate(IN[0]), key=lambda pt: (round(pt[1].X, 3), round(pt[1].Y, 3)))

If you just need the indices

OUT = [
    i[0]
    for i in sorted(
        enumerate(IN[0]), key=lambda pt: (round(pt[1].X, 3), round(pt[1].Y, 3))
    )
]
1 Like

Nice!

I used that lambda function:

Now I’m just curious how can we round the Z value even more? For example, I would like Z_rounded(128)=100, or Z_rounded(178)=200…

round(n, -2) will round to the nearest 100

1 Like

great, ty

Wow, thanks a lot guys!