SetFormula Method


Set the formula of a family parameter.

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

Syntax

C#
public void SetFormula(
	FamilyParameter familyParameter,
	string formula
)
Visual Basic
Public Sub SetFormula ( _
	familyParameter As FamilyParameter, _
	formula As String _
)
Visual C++
public:
void SetFormula(
	FamilyParameter^ familyParameter, 
	String^ formula
)

Parameters

familyParameter
Type: Autodesk.Revit.DB FamilyParameter
The family parameter.
formula
Type: System String
The formula string, input a null reference ( Nothing in Visual Basic) to clean the formula of the parameter.

Exceptions

Exception Condition
Autodesk.Revit.Exceptions ArgumentNullException Thrown when the input argument-"familyParameter"-is a null reference ( Nothing in Visual Basic) .
Autodesk.Revit.Exceptions InvalidOperationException Thrown when there is no valid family type, or the parameter cannot be assigned a formula, or the operation make a circular chain of references among the formulas.

See Also

ArchiLabs

Stop fighting Revit automation.

Build repeatable BIM design and documentation workflows with scripts, data, and AI in one place, without wrestling brittle one-off automations.

Try ArchiLabs →