Select Elements (across multiple categories) by User Created Parameter Value


#1

I am interested in updating a parameter value to multiple elements in Revit that span multiple categories.

I am currently using a python script I found posted by MARTIN BIJSTERBOSCH (http://dynamobim.org/wp-content/uploads/forum-assets/m-bijsterboschabt-eu/04/01/script-2.txt) that selects all model elements, however it selects Views, Fill Pattern Types, etc.

Ultimately, I would like to be able to select the elements that have this (non-built in) parameter defined so that only these elements will be modified and obtained from the model.


#2

Is your parameter a project parameter or a family parameter?
If it’s a project parameter you could use Document.ProjectParameters from Clockwork to filter for your parameter and its associated categories. Then select All Elements of Category and filter those elements again to get only the elements that have that specific parameter.


#3

Thanks @Nick_Boyts!
That worked perfectly and reduced run time by 90%!
Greatly appreciated!


#4

Hi! Can you upload an image of these instructions please @Nick_Boyts @danadefilippi ? I’m new in Dynamo.
Thanks!


#5

Please show an attempt at your solution before asking others to just give you the answer.


#6

Hi @Nick_Boyts ! Thank you for the quick reply!
I asked for the image of the instructions that you gave in the comments above.

Here is my attempt:
I’m trying updating a project parameter value to multiple elements in Revit too. I’m having trouble to filter the parameter and its associated categories. Is giving the error:

Notice: Element. SetParameterByNameTypeOrInstance operation failed.
The call is ambiguous between the following methods or properties: ‘Revit.Elements.ElementWrapper.Wrap (Autodesk.Revit.DB.CurtainSystem, bool)’ and 'Revit.Elements.ElementWrapper.Wrap (Autodesk.Revit.DB.FamilyInstance, bool ) ’

Thanks !!!


#7

You’re skipping the part where you filter for your parameter. Right now you’re using all the categories from all your project parameters. Use a boolean mask with your parameter name to get just the categories for that parameter.


#8

Great!
I filtered the categories and it worked but the error still continues …

Aviso: Element. Falha na operação SetParameterByNameTypeOrInstance.
A chamada é ambígua entre os seguintes métodos ou propriedades: ‘Revit.Elements.ElementWrapper.Wrap(Autodesk.Revit.DB.CurtainSystem, bool)’ e ‘Revit.Elements.ElementWrapper.Wrap(Autodesk.Revit.DB.FamilyInstance, bool)’

Thank you very much for your attention @Nick_Boyts !


#9

The project parameter in question is a type parameter, I did the routine in this other way but also gave an error:

Aviso: Element. Falha na operação SetParameterByNameTypeOrInstance.
The parameter is read-only.


#10

If it’s a type parameter you would have to get the family types per category like you did. :+1:
But the error says the parameter is Read-Only (at least for certain types). There’s nothing you can do about that. Are you able to change the value within Revit? Is it being set by a formula for certain familes?


#11

Too bad, I also saw that some elements are not filled in this way.
This is a shared parameter that I created. Depois adicionei como project parameter selecting all categories. It has no formulas and I can fill in Revit…


#12

Can you upload a stripped down test model we can look at?


#13

Sure @Nick_Boyts ! Stripped down test model is this? I can’t upload other files because I’m a new user.


#14


#15

Can you share it to dropbox or google drive?
And do you really need the parameter assigned to every category?


#16

Yes I can @Nick_Boyts ! Can it be through Google Drive? Can you give me your e-mail address? It would need to be applied to all categories …