RegisterResult Method


Registers result and assigns it a unique result index

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

Syntax

C#
public int RegisterResult(
	AnalysisResultSchema resultSchema
)
Visual Basic
Public Function RegisterResult ( _
	resultSchema As AnalysisResultSchema _
) As Integer
Visual C++
public:
int RegisterResult(
	AnalysisResultSchema^ resultSchema
)

Parameters

resultSchema
Type: Autodesk.Revit.DB.Analysis AnalysisResultSchema
Result schema to be registered

Return Value

Unique index assigned to the result

Examples

Copy C#
// register a new result schema only if one with the same name does not already exist
IList<int> registeredResults = new List<int>();
AnalysisResultSchema resultSchema = new AnalysisResultSchema("Reactions", "Reaction Forces at Column Base");
registeredResults = spatialFieldManager.GetRegisteredResults();
int resultIndex = 999;
foreach (int myInt in registeredResults)
{
    if (spatialFieldManager.GetResultSchema(myInt).Name == "Reactions")
    {
        resultIndex = myInt;
        break;
    }
}
if (resultIndex == 999) // there are existing registered results, but none are named "Reactions"
    resultIndex = spatialFieldManager.RegisterResult(resultSchema);
Copy VB.NET
' register a new result schema only if one with the same name does not already exist
Dim registeredResults As IList(Of Integer) = New List(Of Integer)()
Dim resultSchema As New AnalysisResultSchema("Reactions", "Reaction Forces at Column Base")
registeredResults = spatialFieldManager.GetRegisteredResults()
Dim resultIndex As Integer = 999
For Each myInt As Integer In registeredResults
    If spatialFieldManager.GetResultSchema(myInt).Name = "Reactions" Then
        resultIndex = myInt
        Exit For
    End If
Next
If resultIndex = 999 Then
    ' there are existing registered results, but none are named "Reactions"
    resultIndex = spatialFieldManager.RegisterResult(resultSchema)
End If

Exceptions

Exception Condition
Autodesk.Revit.Exceptions ArgumentException name of resultSchema is not unique in view
Autodesk.Revit.Exceptions ArgumentNullException A non-optional argument was NULL

See Also