ParseFromStableRepresentation Method


Converts a stable String representation of a reference to a Reference object.

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

Syntax

C#
public static Reference ParseFromStableRepresentation(
	Document document,
	string representation
)
Visual Basic
Public Shared Function ParseFromStableRepresentation ( _
	document As Document, _
	representation As String _
) As Reference
Visual C++
public:
static Reference^ ParseFromStableRepresentation(
	Document^ document, 
	String^ representation
)

Parameters

document
Type: Autodesk.Revit.DB Document
The document.
representation
Type: System String
The reference representation.

Remarks

Use ConvertToStableRepresentation(Document) to obtain the representation. The Reference will have only the following information set: You will also be able to pass the reference to Document.GetElement(reference) and Element.GetGeometryObjectFromReference(reference) to obtain the element and geometry object referred to.

Examples

Copy C#
public Reference ParseReference(Document doc, String str)
{
    Reference reference = Reference.ParseFromStableRepresentation(doc, str);
    if (null == reference)
    {
        TaskDialog.Show("ParseReference", "Reference is Null.");
    }
    return reference;
}
Copy VB.NET
Public Function ParseReference(doc As Document, str As [String]) As Reference
    Dim reference__1 As Reference = Reference.ParseFromStableRepresentation(doc, str)
    If reference__1 Is Nothing Then
        TaskDialog.Show("ParseReference", "Reference is Null.")
    End If
    Return reference__1
End Function

Exceptions

Exception Condition
Autodesk.Revit.Exceptions ArgumentNullException One or more arguments was a null reference ( Nothing in Visual Basic) .
Autodesk.Revit.Exceptions ArgumentException Reference representation could not be successfully parsed, or element id obtained from reference representation could not be found in this document.

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 →