How to choose an element with a given parameter name?

peerawit.ru
Enthusiast
Enthusiast

How to choose an element with a given parameter name?

peerawit.ru
Enthusiast
Enthusiast

Hi everyone

Suppose i create shared parameter in to project and assign some categories.

I want to input parameter name for get all elements of categories that parameter assigned

Is there an Revit API command to do this?

 

Thank a lot.

Reply
Accepted solutions (1)
366 Views
6 Replies
Replies (6)

Mohamed_Arshad
Advisor
Advisor
Accepted solution

HI @peerawit.ru 

There is no direct Method to do this.
1. Need to Filter all Elements.

2.Using LOOKUP Parameter check each element.

3.Get Categories in the List

4.Control Duplicating Categories.

 

Hope this helps 🙂

Thanks & Regards,
Mohamed Arshad K

peerawit.ru
Enthusiast
Enthusiast

Hi @Mohamed_Arshad 

Now i use same your method but project has a lot of element it so slow. 😥

If you found faster way tell me please.

Thank for your recommend.

0 Likes

Mohamed_Arshad
Advisor
Advisor

Yeah, I think that also. Let me write.

Thanks & Regards,
Mohamed Arshad K
0 Likes

peerawit.ru
Enthusiast
Enthusiast

It warnings that InternalDefinition not have Category property.😥

0 Likes

Mohamed_Arshad
Advisor
Advisor

HI @peerawit.ru 

In the Revit API, parameters themselves do not have categories. Instead, elements have categories, and parameters are associated with specific element instances.

To get the categories of elements that have a specific parameter, you'll need to iterate over the elements, check if the parameter exists for each element, and then retrieve the category of that element.

What I mentioned earlier. Let other experts can look into and tell the answer.

Thanks & Regards,
Mohamed Arshad K

peerawit.ru
Enthusiast
Enthusiast

Thank You for your recommend.