Is it possible to get all Parameters Names of category without an element

Is it possible to get all Parameters Names of category without an element

jens.slofstra!
Enthusiast Enthusiast
1,653 Views
1 Reply
Message 1 of 2

Is it possible to get all Parameters Names of category without an element

jens.slofstra!
Enthusiast
Enthusiast

Hi everyone,

I am trying to get all the parameter names from the category Sheets of BuiltInCategory.OST_Sheets.

Only problem is that I don't have any sheets in my project.

An easy way out would be to throw an Exception when there are no elements of this category but that is not my intension.

 

Also I have tried TableView.GetAvailabelParameters but this results in a lot op parameters with negative ElementIds.

So from these parameters it is not possible to get the name (to my knowledge).

 

Is there another way to achieve this without an element of this category?

0 Likes
Accepted solutions (1)
1,654 Views
1 Reply
Reply (1)
Message 2 of 2

RPTHOMAS108
Mentor
Mentor
Accepted solution

There are different kinds of parameters aren't there:

 

1) Project bound parameters (shared and non-shared) associated with category (Document.ParameterBindings).

2) Family parameters (shared and non-shared) within family

3) Built-in parameters not associated with category or family e.g. 'Door Number' is the the same as 'Mark'. Two different categories same built-in parameter.

 

Regarding (1) you get the name from the parameter bindings i.e. iterate the bindings and for each ElementBinding see if its Categories collection contains the sheets category then note the Definition.Name which is the key to that binding within the BindingMap.

Regarding (2) since the sheets category is not loadable these types of parameters don't exist for that category. Although you may have a related interest in title blocks.

Regarding (3) there is no access to a built-in parameter without the existence of an element containing that parameter. 

 

The easiest way to see all of the above in one place is probably to create an empty sheet see the parameter names on it and roll-back the transaction. My approach would probably instead be as follows:

 

For a particular Revit version I know the built-in parameters will not change so at the design stage of the add-in I would create a sheet in order to extract the built-in parameter ids associated with it. That then just leaves item (1) above i.e. the shared or non-shared parameters bound in the project which vary by document. I would collect these at run-time from bindings to add to the set of names I've got from the built-in parameter ids (ids for BIP's associated with sheets taken from assembly resource etc.).

 

As previously noted UI names for built-in parameters can be accessed via LabelUtils.GetLabelFor.