Getting list of instance parameters

Getting list of instance parameters

lukyrys
Explorer Explorer
1,018 Views
3 Replies
Message 1 of 4

Getting list of instance parameters

lukyrys
Explorer
Explorer

Hello,

i am trying to write app for fetching all parameters through all categories, families and types (i need only parameter names, values is not needed).

For rfa family (not builtin) is all ok, for instance parameters i use "fake" dummy creating instance of family in transaction which then rollback.

But problem is for system builtin families (element types - e.g walls, roofs, floors ...)

Is there any way to get all parameters including instance parameters (or at least only instance parameters) for system families? Do I need to create each one first?
I have now this code for getting type parameters for system family

 

 

 

            var systemTypes = new FilteredElementCollector(doc)
            .OfClass(typeof(HostObjAttributes))
            .ToList();

            foreach ( ElementType s in systemTypes)
            {
                foreach (Parameter pp in s.Parameters)
                {
                    Main.logger.log($"\t{pp.Definition.Name}");
                }
            }

 

 

 

0 Likes
Accepted solutions (1)
1,019 Views
3 Replies
Replies (3)
Message 2 of 4

RPTHOMAS108
Mentor
Mentor

Unfortunately it would not even be as simple as creating a type. The parameters associated with the instance are sometimes dependant on what other parameters are set and geometric configuration.

 

For example if the start of a beam is connected to column it will have the parameter

STRUCTURAL_BEAM_START_ATTACHMENT_TYPE

If it is connected to a wall it will not.

 

Then depending on the value of this parameter it will have or not have the following parameters also:

STRUCTURAL_BEAM_START_ATTACHMENT_DISTANCE
STRUCTURAL_BEAM_START_ATTACHMENT_REFCOLUMN_END

 

It seems to be an impossible task exploring all these permutation even if we knew them all to start with.

 

 

0 Likes
Message 3 of 4

lukyrys
Explorer
Explorer
Absence of these parameters would not matter, mainly i need basic builtin instance parameters associated with the specific elementtype/family
0 Likes
Message 4 of 4

RPTHOMAS108
Mentor
Mentor
Accepted solution

How do you define a basic built-in parameter, I don't know what you mean by that?

 

As far as I can tell there is no way of associating instance built-in parameters with the categories they serve. A parameter may also be associated with multiple categories (such as 'comments' and 'Mark' (which is also known as door number in door instances)).

 

Your approach of creating instances and extracting parameters is likely the only way of getting this information. Not sure every type of element can be created with the API however.

 

Note also:

ParameterFilterUtilities.IsParameterApplicable

This may be of use for checking against elements but will not only be for instances i.e. when you use ElementParameterFilter it checks instance then type of that instance. So this utility method associated with that workflow probably doesn't distinguish between instance and type either.

 

0 Likes