ReplaceParameter Method (FamilyParameter, ExternalDefinition, BuiltInParameterGroup, Boolean)


Replace a family parameter with a shared parameter.

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

Syntax

C#
public FamilyParameter ReplaceParameter(
	FamilyParameter currentParameter,
	ExternalDefinition familyDefinition,
	BuiltInParameterGroup parameterGroup,
	bool isInstance
)
Visual Basic
Public Function ReplaceParameter ( _
	currentParameter As FamilyParameter, _
	familyDefinition As ExternalDefinition, _
	parameterGroup As BuiltInParameterGroup, _
	isInstance As Boolean _
) As FamilyParameter
Visual C++
public:
FamilyParameter^ ReplaceParameter(
	FamilyParameter^ currentParameter, 
	ExternalDefinition^ familyDefinition, 
	BuiltInParameterGroup parameterGroup, 
	bool isInstance
)

Parameters

currentParameter
Type: Autodesk.Revit.DB FamilyParameter
The current family parameter.
familyDefinition
Type: Autodesk.Revit.DB ExternalDefinition
The definition of the loaded shared parameter.
parameterGroup
Type: Autodesk.Revit.DB BuiltInParameterGroup
The group to which the new shared parameter belongs.
isInstance
Type: System Boolean
Indicates if the new parameter is instance or type.

Return Value

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

Remarks

This operation is invalid for Built-in Parameters. The formulas and labels which in reference to this parameter will be updated to the new parameter.

Exceptions

Exception Condition
Autodesk.Revit.Exceptions ArgumentNullException Thrown when the input argument-"familyParameter" or "name"-is a null reference ( Nothing in Visual Basic) .
Autodesk.Revit.Exceptions ArgumentException Thrown when the input argument-"familyParameter"-is invalid, or the input parameter group cannot be assigned to the new parameter, or the input name string contains illegal characters, or duplicated with existing parameter name.
Autodesk.Revit.Exceptions InvalidOperationException Thrown when trying to replace a built-in parameter.
Autodesk.Revit.Exceptions InvalidOperationException Thrown when replacement failed, because the replacement would cause a formula error. Or trying to replace with an instance parameter of image type.

See Also