How to get element parameter's BuiltInParameter

How to get element parameter's BuiltInParameter

Anonymous
Not applicable
5,194 Views
3 Replies
Message 1 of 4

How to get element parameter's BuiltInParameter

Anonymous
Not applicable

Hi,everyone!How to get element parameter's BuiltInParameter?

such as parameter:Image its BuiltInParameter is All_Model_IMAGE.

 

Image:   ALL_MODEL_IMAGE

subject:  HOST_ID_PARAM

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

Revitalizer
Advisor
Advisor

Hi,

 

if your Parameter's definition is an InternalDefinition, this has a BuiltInParameter property.

 

 

Revitalizer




Rudolf Honke
Software Developer
Mensch und Maschine





0 Likes
Message 3 of 4

Anonymous
Not applicable

thanks for your reply.

is there any revit api to get each BuiltInParameter property?

Thanks!

0 Likes
Message 4 of 4

Revitalizer
Advisor
Advisor
Accepted solution

Hi,

 

you could iterate over the BuiltInParameter enum values.

For each BuiltInParameter, you could check if it is existing on your Element.

 

static List<BuiltInParameter> GetBuiltInParametersByElement(Element element)
{
	List<BuiltInParameter> bips = new List<BuiltInParameter>();
	
	foreach (BuiltInParameter bip in BuiltInParameter.GetValues(typeof(BuiltInParameter))
	{
		Parameter p = element.get_Parameter(bip);
		
		if (p != null)
		{
			bips.Add(bip);
		}
	}
return bips; }

 

Note that even if there are two Elements of the same category, saying two FamilyInstances of BuiltInCategory.OST_Windows,

it may be that one of them has got a given BuiltInParameter while the other one doesn't have.

Also, depending on how a Family has been constructed, a BuiltInParameter may be existing but without having a useful value.

For example, you can have different window families in your project file.

If you check the BuiltInParameter.WINDOW_WIDTH, it may be that this can be found twice, both as an element parameter and as a type parameter.

As an element parameter, it may return a value of 0. That means: the parameter is existing, not null, but does not provide a plausible value.

In this case, the type parameter BuiltInParameter.WINDOW_WIDTH may provide a realistic result.

 

Use RevitLookup to inspect your elements.

It displays the available BuiltInParameters and shows the mapping of the relating localized names.

 

 

Revitalizer




Rudolf Honke
Software Developer
Mensch und Maschine