Reference.ConvertToStableRepresentation
Method
Description:
Converts the reference to a stable String representation.
Converts the reference to a stable String representation.
Remarks:
The stable representation can be used to preserve and restore the reference later in the same Revit session or even in a different session where the same document is present. Use ParseFromStableRepresentation(Document, String) to restore the reference. The representation is based on the internal Revit structure and is not intended to be parsed expect by ParseFromStableRepresentation(Document, String).
The stable representation can be used to preserve and restore the reference later in the same Revit session or even in a different session where the same document is present. Use ParseFromStableRepresentation(Document, String) to restore the reference. The representation is based on the internal Revit structure and is not intended to be parsed expect by ParseFromStableRepresentation(Document, String).
Examples
public string SerializeReference(Document doc, Reference reference)
{
String ids = String.Empty;
ids = reference.ConvertToStableRepresentation(doc);
TaskDialog.Show("SerializeReference", "Representation:\n" + ids);
return ids;
}
Exceptions
Exception | Condition |
---|---|
ArgumentNullException | document was. |
InvalidObjectException | Reference contained element ids not found in this document. |