AddParameter Method (String, BuiltInParameterGroup, ParameterType, Boolean)


Add a new family parameter with a given name.

Namespace: Autodesk.Revit.DB
Assembly: RevitAPI (in RevitAPI.dll) Version: 22.0.0.0 (22.1.0.0)

Syntax

C#
[ObsoleteAttribute("This property is deprecated in Revit 2022 and may be removed in a future version of Revit. Please use the AddParameter(string, ForgeTypeId, ForgeTypeId, bool) overload instead.")]
public FamilyParameter AddParameter(
	string parameterName,
	BuiltInParameterGroup parameterGroup,
	ParameterType parameterType,
	bool isInstance
)
Visual Basic
<ObsoleteAttribute("This property is deprecated in Revit 2022 and may be removed in a future version of Revit. Please use the AddParameter(string, ForgeTypeId, ForgeTypeId, bool) overload instead.")> _
Public Function AddParameter ( _
	parameterName As String, _
	parameterGroup As BuiltInParameterGroup, _
	parameterType As ParameterType, _
	isInstance As Boolean _
) As FamilyParameter
Visual C++
[ObsoleteAttribute(L"This property is deprecated in Revit 2022 and may be removed in a future version of Revit. Please use the AddParameter(string, ForgeTypeId, ForgeTypeId, bool) overload instead.")]
public:
FamilyParameter^ AddParameter(
	String^ parameterName, 
	BuiltInParameterGroup parameterGroup, 
	ParameterType parameterType, 
	bool isInstance
)

Parameters

parameterName
Type: System String
The name of the new family parameter.
parameterGroup
Type: Autodesk.Revit.DB BuiltInParameterGroup
The group to which the family parameter belongs.
parameterType
Type: Autodesk.Revit.DB ParameterType
The type of new family parameter.
isInstance
Type: System Boolean
Indicates if the new family parameter is instance or type.

Return Value

If creation was successful the new parameter is returned, otherwise an exception with failure information will be thrown.

Remarks

This method can work even without any family type, but it cannot be assigned the value via FamilyManager.Set methods when there is no current type.

Exceptions

Exception Condition
Autodesk.Revit.Exceptions ArgumentNullException Thrown when the input argument-"parameterName"-is a null reference ( Nothing in Visual Basic) .
Autodesk.Revit.Exceptions ArgumentException Thrown when the input argument-"parameterName"-is already in use, or when the input argument -"parameterType" is an invalid type, or the input parameter group cannot be assigned to the new parameter. Also thrown when "parameterType" is FamilyType; to add a parameter of this type use the AddParameter method that accepts a category instead.
Autodesk.Revit.Exceptions InvalidOperationException Thrown when the family parameter creation failed. Or trying to add an instance parameter of image type.

See Also