Get Type Parameter Value in a User-Created Family

Like it says, I’m just trying to get the parameter value for a family that is a Type Parameter. So far I haven’t had any success using the current components, and I haven’t been able to port over the code from the Dynamo scripts I have to do the same thing. These are Type (shared) parameters in a family I created. They seem to be pretty difficult to get a hold of.

This is what I use in a code block in Dynamo to get the Type parameter:

Tparam = Parameter.Value(Parameter.ParameterByName(FamilyType.ByName(Element.Name(in_fam)), param_name));

Does this work for you?

@kike Yes, that does work, however, it is quite slow. Below, for reference, is with 237 family instances.

I used this to grab those type parameters in a Py button (after the boilerplate RiR code):

 doc = Revit.ActiveDBDocument
 
 output = []
 
 def get_typeparameter(element, param_name):
     et = element.Document.GetElement(element.GetTypeId())
     eparam = et.LookupParameter(param_name)
     return eparam.AsDouble()
 
 for i in family:
     output.append(get_typeparameter(i, name))

a = output

@dev.jer
The method for collecting elements in Revit, depends heavily on the use case. I’m not sure if the dimension data collected here is to generate a report or filter the doors by size. If the goal is to collect this data to further filter down the elements, it is better to use DB.ElementFilters for this puspose.

This video can help explaing how :point_right: https://www.youtube.com/watch?v=WU_D2qNnuGg&t=2593s

Hi @dev.jer, I think this topic is related to this other.

I would recommend you using Element.Decompose in case you don’t need to specify algorithmically the parameter name you want to get.

Hi @kike, Ok I will use that. I think the part that I was missing/misunderstanding is that I can also decompose the Type (like you showed earlier in this thread) to get access to the Type parameters. If I use decompose in that way, then it is quite fast. Thank you and @eirannejad for all your help!

1 Like