分离打开项目时无法通过doc.PathName获取到项目路径,
只能在DocumentOpening事件里获取到。
Public class Menu : IExternalApplication
{
public Result OnStartup(UIControlledApplication application)
{
application.ControlledApplication.DocumentOpening += ControlledApplication_DocumentOpening;
return Result.Succeeded;
}
void ControlledApplication_DocumentOpening(object sender, Autodesk.Revit.DB.Events.DocumentOpeningEventArgs e)
{
if(!e.IsCancelled())
{
string pathName = e.PathName;
}
}
}