RVTDocs.com
Namespace: Autodesk.Revit.DB

TransmissionData

Class
Description:
A class representing information on all external file references in a document.
Remarks:

TransmissionData stores information on both the previous state and requested state of an external file reference. This means that it stores the load state and path of the reference from the most recent time this TransmissionData's document was opened. It also stores load state and path information for what Revit should do the next time the document is opened.

As such, TransmissionData can be used to perform operations on external file references without having to open the entire associated Revit document. The methods ReadTransmissionData and WriteTransmissionData can be used to obtain information about external references, or to change that information. For example, calling WriteTransmissionData with a TransmissionData object which has had all references set to LinkedFileStatus.Unloaded would cause no references to be loaded upon next opening the document.

TransmissionData cannot add or remove references to external files. If, on file open, Revit discovers information in the TransmissionData which does not correspond to an existing external file reference, the information will be ignored on file load.

The TransmissionData for a document does not contain information about references which come from external servers. TransmissionData only contains references to local files or Revit links on Revit Server. TransmissionData cannot be used to change a reference from a local file reference to an external server reference.

Note that TransmissionData objects must be set to "transmitted" for the requested reference data to be meaningful. Revit ignores the TransmissionData for non-transmitted files. Marking a file as transmitted has other effects - workshared files are opened as detached from the central model, and creation of new local files is prohibited, until the file is in its final location and the file has been marked as no longer transmitted.

Inheritance Hierarchy:
System.Object
  Autodesk.Revit.DB.TransmissionData
Syntax
public class TransmissionData : IDisposable
Examples
void UnloadRevitLinks(ModelPath location)
///  This method will set all Revit links to be unloaded the next time the document at the given location is opened. 
///  The TransmissionData for a given document only contains top-level Revit links, not nested links.
///  However, nested links will be unloaded if their parent links are unloaded, so this function only needs to look at the document's immediate links. 
{
   // access transmission data in the given Revit file
   TransmissionData transData = TransmissionData.ReadTransmissionData(location);

   if (transData != null)
   {
      // collect all (immediate) external references in the model
      ICollection<ElementId> externalReferences = transData.GetAllExternalFileReferenceIds();

      // find every reference that is a link
      foreach (ElementId refId in externalReferences)
      {
         ExternalFileReference extRef = transData.GetLastSavedReferenceData(refId);

         if (extRef.ExternalFileReferenceType == ExternalFileReferenceType.RevitLink)
         {
            // we do not want to change neither the path nor the path-type
            // we only want the links to be unloaded (shouldLoad = false)
            transData.SetDesiredReferenceData(refId, extRef.GetPath(), extRef.PathType, false);
         }
      }

      // make sure the IsTransmitted property is set 
      transData.IsTransmitted = true;

      // modified transmission data must be saved back to the model
      TransmissionData.WriteTransmissionData(location, transData);
   }
   else
   {
      Autodesk.Revit.UI.TaskDialog.Show("Unload Links", "The document does not have any transmission data");
   }
}
TransmissionData Class Members:
Name Description Inherited From
TransmissionData Constructs a TransmissionData from another TransmissionData
Name Description Inherited From
IsTransmitted Determines whether this file has been transmitted or not.
IsValidObject Specifies whether the .NET object represents a valid Revit entity.
UserData A string which users can store notes in.
Version The format version for TransmissionData
Name Description Inherited From
Dispose Releases all resources used by the TransmissionData
DocumentIsNotTransmitted Determines whether the document at a given file location is not transmitted.
Equals Determines whether the specified object is equal to the current object. (Inherited from Object ) Object
GetAllExternalFileReferenceIds Gets the ids of all ExternalFileReferences.
GetDesiredReferenceData Gets the ExternalFileReference representing path and load status information to be used the next time this TransmissionData's document is loaded.
GetHashCode Serves as the default hash function. (Inherited from Object ) Object
GetLastSavedReferenceData Gets the ExternalFileReference representing path and load status information concerning the most recent time this TransmissionData's document was opened.
GetType Gets the Type of the current instance. (Inherited from Object ) Object
IsDocumentTransmitted Determines whether the document at a given file location is transmitted.
ReadTransmissionData Reads the TransmissionData associated with the file at the given location.
SetDesiredReferenceData Sets the ExternalFileReference information which Revit should use the next time it opens the document which this TransmissionData belongs to.
ToString Returns a string that represents the current object. (Inherited from Object ) Object
WriteTransmissionData Writes the given TransmissionData into the Revit file at the given location.