Change the ActiveUIDocument
質問
Is there a way through the Revit API to change which document is the current ActiveUIDocument
(ExternalCommandData.Application.ActiveUIDocument
)? I want to print multiple views from multiple project files using the API but I need to be able to change the current ActiveUIDocument first.
解決
With the Revit 2012 API there is a new method OpenAndActivateDocument
on the UIApplication
object. As the method name says it will open and activate the document that you specify with a file path. I tested this and it worked for printing multiple files.
public void Plot(ExternalCommandData commandData, string[] files)
{
UIApplication uiApplication = commandData.Application;
foreach (string file in files)
{
Document document = uiApplication.OpenAndActivateDocument(file);
//Do action on active document
}
}
所属していません StackOverflow