How to read all parameters including Omni Class, Assembly Description and others

How to read all parameters including Omni Class, Assembly Description and others

Anonymous
Not applicable
831 Views
2 Replies
Message 1 of 3

How to read all parameters including Omni Class, Assembly Description and others

Anonymous
Not applicable

I'm trying to read all the family parameters by using the following code:

 

Dictionary<string, FamilyParameter> familyparameters = new Dictionary<string, FamilyParameter>(totalParams);

            foreach (FamilyParameter familyParameter in familyManager.Parameters)
            {
                string name = familyParameter.Definition.Name;

                familyparameters.Add(name, familyParameter);
            }

When I run the code, it returns the list of family parameters But it does not read the parameters like Omni Class Number, Assembly Description and all the parameters show in the grey color. See the image below.

 

not fetching parameters.PNG

 

 

Appreciate if someone shares the solution to get these parameters as well. Thank you

0 Likes
Accepted solutions (1)
832 Views
2 Replies
Replies (2)
Message 2 of 3

jeremytammik
Autodesk
Autodesk

Have you explored your model using RevitLookup?

 

You should be able to see it right away.

 

Afai can tell, you code lists family parameters.

 

There are other parameter types as well, e.g., shared, and also parameters can be associated either with the individual instances or the entire types.

 

Cheers,

 

Jeremy



Jeremy Tammik
Developer Technical Services
Autodesk Developer Network, ADN Open
The Building Coder

0 Likes
Message 3 of 3

Anonymous
Not applicable
Accepted solution

Thanks, @jeremytammik, I used the following code, that helped me to read OmniClass and other relevant family parameter data as well.

 

Family familyowner = doc.OwnerFamily;
var parameters = from par in (Enum.GetValues(typeof(BuiltInParameter))  .OfType<BuiltInParameter>()  .Select(param => familyowner.get_Parameter(param))  .Where(param => param != null)  .Where(param => param.AsString() != null)).Distinct().ToList()  select new  {   Name = par.Definition.Name,   Value = par.AsString(),   Def = par.Definition  };

So far, I can read all parameter information. But there's a concern with the familyparameter data that I've posted here. Hope you'll light it up with some explanation. Thank you

 

0 Likes