Revit Architecture Forum
Welcome to Autodesk’s Revit Architecture Forums. Share your knowledge, ask questions, and explore popular Revit Architecture topics.
abbrechen
Suchergebnisse werden angezeigt für 
Anzeigen  nur  | Stattdessen suchen nach 
Meintest du: 

How to Change active document in OnIdling event.

0 ANTWORTEN 0
Antworten
Nachricht 1 von 1
archana.sapkal
98 Aufrufe, 0 Antworten

How to Change active document in OnIdling event.

public Result OnStartup(UIControlledApplication application)
{

_cachedUiCtrApp.Idling += OnIdling;
}

private void OnIdling(object sender, IdlingEventArgs e)
{
_cachedUiCtrApp.Idling -= OnIdling;
UIApplication uiApp = sender as UIApplication;
try
{
var filename = siemensRevitFIleListLogFilePath;
if (System.IO.File.Exists(filename))
{
string logContent = System.IO.File.ReadAllText(filename);
System.IO.File.WriteAllText(filename, string.Empty);

string[] logLines = logContent.Split(new[] { "\r\n" }, StringSplitOptions.RemoveEmptyEntries);
ProcessDocuments(uiApp, logLines);
}
}
catch (Exception ex)
{
LogException(ex, "Error in OnIdling method");
}
}

private void ProcessDocuments(UIApplication uiApp, string[] filePaths)
{
foreach (var filePath in filePaths)
{
Document previousDoc = null;
try
{
UIDocument uiDocument = uiApp.OpenAndActivateDocument(filePath);
Document currentDoc = uiApp.ActiveUIDocument.Document;

if (currentDoc != null && currentDoc.IsValidObject)
{
RunExportProcess(currentDoc);
}
previousDoc = currentDoc;
}
catch (Exception ex)
{
MessageBox.Show(ex + "");
LogException(ex, $"Error processing file {filePath}");
}
}
}

0 ANTWORTEN 0

Sie finden nicht, was Sie suchen? Fragen Sie die Community oder teilen Sie Ihr Wissen mit anderen.

In Foren veröffentlichen  

Autodesk Design & Make Report