Autodesk.Revit.DB.Events.CreateRelatedFileProgressChangedEventArgs是Revit API中的一个事件参数类,它提供了在创建一个相关文件时的进度信息。
System.EventArgs -> Autodesk.Revit.DB.Events.CreateRelatedFileProgressChangedEventArgs
以下代码演示如何使用CreateRelatedFileProgressChangedEventArgs:
public void CreateLinkedFile()
{
string fullPath = @"C:\Temp\Linked.rvt";
// Create new Revit document
Autodesk.Revit.DB.Document doc = new Autodesk.Revit.DB.Document(
Autodesk.Revit.DB.DocumentType.Project);
// Create options for creating linked file
Autodesk.Revit.DB.ModelPath path = new Autodesk.Revit.DB.ModelPath(fullPath);
Autodesk.Revit.DB.Creation.DocumentCreationOptions options =
new Autodesk.Revit.DB.Creation.DocumentCreationOptions();
options.FilePath = fullPath;
// Subscribe to progress event
doc.CreateLinkedFileProgressChanged +=
new EventHandler<Autodesk.Revit.DB.Events.CreateRelatedFileProgressChangedEventArgs>(
CreateLinkedFileProgress);
// Create linked file
doc.CreateWithDocumentAndOptions(path, options);
}
public void CreateLinkedFileProgress(
object sender,
Autodesk.Revit.DB.Events.CreateRelatedFileProgressChangedEventArgs e)
{
// Print progress message
Console.WriteLine("{0}%: {1}", e.ProgressPercent, e.Message);
}