List of Element parameters not reduced by "UniqueItem"?

Hello,

I remember this used to work, I have found all parameters of a list of elements, then I used the “List.UniqueItems” to find a list of all parameters without duplicated.

Basically I need a list of parameters available to a certain category (doors, walls, etc.).

thank you

Basically Element.Parameters is the list of parameter elements mapped to the element. Each of these associated elements is a unique element, and as such I would expect the list count to remain.

Likely you want to pull the names from the parameters rather than the parameter elements.

Thank you Jacob,

but again, I am pretty sure this used to work as I have shown. I test scripts extensively, and if I left these nodes like in the screen-shot there was a reason.

Is the nodes’ behavior changed in this version of Dynamo?

Also, if I pull the parameter’s names, they are returned as strings, right?

What if I want the actual parameter element, not a string? There is no “type” parameter element, only “instance”?

thank you!

regards

You would likely need to get the parameter definition as that’s the part of the parameter element that is “shared” between elements. As Jacob mentioned, the parameter element (assigned to each instance) is unique.

I can’t think of an instance where this ever worked differently, but will try to put a quick sample together to test tonight (desk is set up and I have a functional power cable after the move and I need a quick test of the new keyboard :slight_smile:)

and what nodes would do that? (I am searching but…)

Thank you

There aren’t any nodes that I’m familiar with that do that. You would have to go through the API. However it’s still unclear what it is you’re wanting to do with the parameters. The name is the easiest way to track what’s specific to the category but you said you don’t want strings.

1 Like

I used to be able to get all parameters available to a category (say all doors).

I would use all instances, because some families might have unique parameters, then obtain the whole list of parameters (80K parameters in my last run).

Obviously, most of these are the same parameters (like Type Mark, etc…), but if I convert them to Strings (name) then I can no longer identify what parameters are text, Y/N, integers, etc.

I wish to stop manipulating an 80K long list of elements as soon as possible in the script, that is why I used to use the Unique.Item node.

But now it is not doing anything and all 80K parameters are passed on to the next group of nodes…

Does it make sense?

Get the name as a string. Use GroupByKey on the parameter list with names as a key. Take the first item from every sublist. Now you’ve one example of each unique parameter and can pull data storage types and such from that.

Or get the Parameters’ IDs. Get unique values, then use IndexOf and GetItemAtIndex on your original parameter list to only get one instance of each parameter with unique parameter IDs.

This worked, yes, good idea.

thank you

Just confirmed that List.UniqueItems fails on Element.Parameters as far back as Dynamo for Revit 2.3.1 for Revit 2020. I don’t have anything older to test with as even that is no longer in the support window (2024 is officially released so support is 2021, 2022, 2023 and 2024).

I recommend using Parameter.Id instead of Parameter.Name as you can have multiple parameters with the same name (ie: Color can be a shared parameter for chairs which takes a text value, and a separate shared parameter called Color can be used for curtain wall panels which takes a material).

1 Like

Jacob, using the ID sometimes generates some weird negative ID numbers, for some of the parameters…
But maybe for managing the parameters is still okay…

will check,

thank you

Many parameters (ie: built in parameters) will have negative IDs, as this is how Revit treats internal data in the file to keep consistent values and functional mapping for upgrades and such.

Okay,
it is time for me to admit defeat and accept the unavoidable public scorn.

Jacob, when I used this in the past I used the parameters name node before the UniqueItem node…

So, actually, it never worked with a list of real parameters, but only with their string names.

Thank you for checking nevertheless, and I hope it is not in your powers to ban me permanently from these forums… :open_mouth:

Regards

No worries - we’ve all been in this situation before. I’ve confused some of my old stuff more often than most. Definitely not on the ban radar - you’re too much fun to ban and add a good bit of knowledge (including what came up in this topic - other people will learn from this over time too!). :slight_smile:

For reference: I hate bans - doing so makes me feel ill. Well except for the spam accounts - I have no qualms using the ban hammer on them like I was Thor wielding Mjölnir, but with less muscles…