Quantcast
Channel: All Revit API Forum posts
Viewing all articles
Browse latest Browse all 66693

Re: search all elements containing sepecific string i.e. ABC

$
0
0

Hi

I believe the best way is to loop through Builtin Parameter of the element. I have quickly written this code "Not Tested" but will deliver the idea.

all I done  is

 

1- get a list of built in parameter

2- try and catch get each type value from the element.

3- if value equalls the string you need then you found what you want

 

       var bips = Enum.GetValues(typeof(BuiltInParameter));
        foreach (BuiltInParameter item in bips)
            {
                Parameter p = null;
                try
                {

                    p = myelement.get_Parameter(item);     
                    if (string.IsNullOrEmpty(p.AsString())) continue;

                    if(p.AsString() == searchstring) 
{
// do something
break; } } catch (Exception) { // this parameter does not exist for this type of element. } }

but this will take a long time unless you filter the search by a definition Name or something. The wide filter the more time... I hope that guides you to the right path.


Viewing all articles
Browse latest Browse all 66693

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>