Add a new family parameter with a given name.

Namespace: Autodesk.Revit.DB
Assembly: RevitAPI (in RevitAPI.dll) Version: 23.0.0.0 (23.1.0.0)

Syntax

C#
public FamilyParameter AddParameter(
	string parameterName,
	ForgeTypeId groupTypeId,
	ForgeTypeId specTypeId,
	bool isInstance
)
Visual Basic
Public Function AddParameter ( _
	parameterName As String, _
	groupTypeId As ForgeTypeId, _
	specTypeId As ForgeTypeId, _
	isInstance As Boolean _
) As FamilyParameter
Visual C++
public:
FamilyParameter^ AddParameter(
	String^ parameterName, 
	ForgeTypeId^ groupTypeId, 
	ForgeTypeId^ specTypeId, 
	bool isInstance
)

Parameters

parameterName
Type: System..::..String
The name of the new family parameter.
groupTypeId
Type: Autodesk.Revit.DB..::..ForgeTypeId
The identifier of the new family parameter's parameter group.
specTypeId
Type: Autodesk.Revit.DB..::..ForgeTypeId
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. To add a parameter of family type use the AddParameter overload that accepts a category instead.

Exceptions

ExceptionCondition
Autodesk.Revit.Exceptions..::..ArgumentNullException Thrown when the input argument-"parameterName"-is nullNothingnullptra 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 -"specTypeId" is an invalid type, or the input parameter group cannot be assigned to the new parameter.
Autodesk.Revit.Exceptions..::..InvalidOperationException Thrown when the family parameter creation failed. Or trying to add an instance parameter of image type.

See Also