In this post, let’s see how Parameter Retriever of RevitAddinWizardcan help find the right BuiltInParameter value in no time and create the parameter retrieving help method accordingly in a class of the current Revit addin project.
Parameter Retriever can be found from both the menu and the toolbar of the Revit Addin Coder:
If the Parameter Retriever is launched it will look like this at first:
All values of the BuiltInParameter enumerator will be found and listed out in the top ListBox. As we know, there are thousands of such values and it is really hard to find the right parameter most of times.
The Parameter Retriever provides three keywords to help filter the huge amount of enumerator values. For example, if we’d like to find the window width parameter as we talked previously, we can specify the WINDOW as the first keyword and click the Update button:
At this moment, the list becomes shorter and every item contains the WINDOW keyword. However, the list is still long enough and it will take time to check one by one to see which may be the one of interest. No worry. We can specify another keyword, WIDTH here, and click the Update button again:
Now it’s good that only three are left and it is very easy to find the right one now, WINDOW_WIDTH. If the element type (FamilySymbol) is highlighted, the method name is given, and a class is chosen, the following code will be created into the class as a help method:
public static Parameter GetWindowWidthFromFamilySymbol(FamilySymbol e)
{
return e.get_Parameter(BuiltInParameter.WINDOW_WIDTH);
}
If necessary, the third keyword can be specified as well to narrow down the list further. In this particular case, it does not make sense, but for many others it really does.
Let’s take another case for example. If we’d like to find the BuiltInParameter value having something to do with room cooling load calculations, we can input ROOM, AREA, and LOAD as the keywords (order is irrelevant):
Since we are not sure which element type may carry this piece of information, we use the generic Element type as the argument type. Now the method will be added into the ExtCmd class like the following:
public static Parameter GetRoomCoolingLoadPerArea(Element e)
{
return e.get_Parameter(BuiltInParameter.ROOM_CALCULATED_COOLING_LOAD_PER_AREA_PARAM);
}
Parameter Retrieve of RevitAddinWizardcan help us find a BuiltInParameter enumerator value of interest and create the help method in no time. However, programmers still have to take the responsibility to figure out which type of Element may carry the parameter and in what situations. It needs quite some testing and inquiries sometimes but at least the BuiltInParameter seeking and the Parameter retrieving is not a big deal anymore. |