Add sequential number to Assembly components using Shared parameter

I am trying to run a simple script to plus sequential numbers in to revit components via a shared parameter. I wish the number to be the same for each family type within a single assembly/ selection however i wish it to be different in each assembly / selection. I have it working so that it adds the numbers to the parameter as per the revit selection, what i can not do is make it the same in the same type of family.

You are not grouping the assembly but assigning a number to each value in the sequence you selected them.
Group by Name then create the sequence based on the number of groups then set laving to longest and you should be good to go

really appreciate the help however i do not know what i need to do.

Currently in this test project i have 3 assembly’s made in each assembly there is lots of the same family, each instance in an assembly i wish to have the same number so when i do an MTO i can group them and i can tag the view.

Then in another assembly i might have the same family as another assembly but it will have a different number to the other assembly but the same number again for multiple instances within that family

Can you show me @Daniel_Hurtubise

Can you share your test file?

@Daniel_Hurtubise I have stripped the revit file down to bare minimum, and added my dynamo file to the link.

I was trying to make it work just using duct fittings but it will be pipe fittings accessory’s and pipes that i will be using it for.

Thank you very much for trying to help me!