We talked about various types regarding Parameter like ParameterType, DisplayUnitType, and StorageType. Now let’s see how the RevitAddinWizard can help to do the same work. The Parameter Typer can be found from either the Revit Addin Coder sub-menu under the Tools or the following Revit Addin Coder toolbar:
When the button is clicked, the Parameter Typer window will show up:
If we want all the three typers to be created with the default name prefix, the OK button can be just clicked. The following Parameter Typer help methods will be created in the chosen class:
public static Dictionary<StorageType, List<Parameter>> RawTypeParameters_OnStorageType(Element e)
{
Dictionary<StorageType, List<Parameter>> dict =
new Dictionary<StorageType, List<Parameter>>();
foreach (Parameter p in e.Parameters)
{
if (!dict.ContainsKey(p.StorageType))
{
dict.Add(p.StorageType, new List<Parameter>());
}
dict[p.StorageType].Add(p);
}
return dict;
}
public static Dictionary<ParameterType, List<Parameter>> RawTypeParameters_OnParameterType(Element e)
{
Dictionary<ParameterType, List<Parameter>> dict =
new Dictionary<ParameterType, List<Parameter>>();
foreach (Parameter p in e.Parameters)
{
if (!dict.ContainsKey(p.Definition.ParameterType))
{
dict.Add(p.Definition.ParameterType, new List<Parameter>());
}
dict[p.Definition.ParameterType].Add(p);
}
return dict;
}
public static string RawGetDUTString(Parameter p)
{
string unitType = string.Empty;
try { unitType = p.DisplayUnitType.ToString(); }
catch { }
return unitType;
}
public static Dictionary<DisplayUnitType, List<Parameter>> RawTypeParameters_OnDisplayUnitType(Element e)
{
Dictionary<DisplayUnitType, List<Parameter>> dict =
new Dictionary<DisplayUnitType, List<Parameter>>();
foreach (Parameter p in e.Parameters)
{
if (string.IsNullOrEmpty(RawGetDUTString(p)))
continue;
if (!dict.ContainsKey(p.DisplayUnitType))
{
dict.Add(p.DisplayUnitType, new List<Parameter>());
}
dict[p.DisplayUnitType].Add(p);
}
return dict;
}
In terms of how to use the help methods, please refer to previous posts for ideas and code examples.
Parameter Typer of RevitAddinWizard can do all these in no time.
Parameter of Revit API - BuiltInParameter
Parameter Retriever of RevitAddCoder
Parameter of Revit API - Parameter Information
Parameter Infoer of RevitAddCoder
Parameter of Revit API - ParameterType And StorageType
Parameter of Revit API - BuiltInParameterGroup
Parameter Grouper of RevitAddCoder
Parameter Filter of RevitAddCoder
Parameter of Revit API - Read/Write Parameter Values
Recent Comments