Sets the parameter to a new real number value.
Namespace:
Autodesk.Revit.DB
Assembly:
RevitAPI
(in RevitAPI.dll) Version: 21.0.0.0 (21.1.1.109)
Syntax
C# |
---|
|
Visual Basic |
---|
|
Visual C++ |
---|
|
Parameters
- value
-
Type:
System
Double
The new double value to which the parameter is to be set.
Return Value
The Set method will return True if the parameter was successfully set to the new value, otherwise false.Remarks
You should only use this method if the StorageType property reports the type of the
parameter as a Double.
Examples
Copy
C#
public bool SetParameter(Parameter parameter, double value)
{
bool result = false;
//if the parameter is readonly, you can�t change the value of it
if (null != parameter && !parameter.IsReadOnly)
{
StorageType parameterType = parameter.StorageType;
if (StorageType.Double != parameterType)
{
throw new Exception("The storagetypes of value and parameter are different!");
}
//If successful, the result is true
result = parameter.Set(value);
}
return result;
}
Copy
VB.NET
Public Function SetParameter(parameter As Parameter, value As Double) As Boolean
Dim result As Boolean = False
'if the parameter is readonly, you can�t change the value of it
If parameter IsNot Nothing AndAlso Not parameter.IsReadOnly Then
Dim parameterType As StorageType = parameter.StorageType
If StorageType.[Double] <> parameterType Then
Throw New Exception("The storagetypes of value and parameter are different!")
End If
'If successful, the result is true
result = parameter.[Set](value)
End If
Return result
End Function
Exceptions
Exception | Condition |
---|---|
Autodesk.Revit.Exceptions InvalidOperationException | The parameter is read-only. |
Autodesk.Revit.Exceptions ArgumentException | Value must be a finite number. |