该类定义了用于传输Revit文档和相关外部资源的数据。
TransmissionData(Document document)
ICollection<ElementId> GetReferencedElementIds()
ICollection<string> GetAdditionalFiles()
bool IsTransmitted
void IncludeAllLinkedDocuments()
void IncludeLinkedDocument(Document linkedDocument)
void IncludeElements(ICollection<ElementId> elementIds)
void ClearAdditionalFiles()
void AddAdditionalFile(string fileName)
以下示例展示了如何使用TransmissionData类传输Revit文档:
Document doc = commandData.Application.ActiveUIDocument.Document;
TransmissionData transData = new TransmissionData(doc);
// Include all linked documents
transData.IncludeAllLinkedDocuments();
// Include some specific elements
ElementId wallId = new ElementId(BuiltInCategory.OST_Walls);
ICollection<ElementId> walls = new List<ElementId>() { wallId };
transData.IncludeElements(walls);
// Include additional files
transData.AddAdditionalFile("File1.txt");
transData.AddAdditionalFile("File2.txt");
// Transmit the data
transData.IsTransmitted = true;
此示例将传输文档中所有链入的文档、特定的元素,以及两个附加文件。最后,通过将IsTransmitted属性设置为true,将数据传输到外部。