add close doc function
This commit is contained in:
@@ -47,6 +47,23 @@ namespace xUnitRevitUtils
|
||||
UiContext.Send(x => doc = Uiapp.OpenAndActivateDocument(filePath).Document, null);
|
||||
Assert.NotNull(doc);
|
||||
return doc;
|
||||
}
|
||||
/// <summary>
|
||||
/// Closes the provided Revit document
|
||||
/// </summary>
|
||||
/// <param name="doc">Revit document to be closed</param>
|
||||
/// <param name="saveChanges">If true, saves changes to document before closing</param>
|
||||
/// <returns>
|
||||
/// Bool indicating whether or not the document was successfully closed
|
||||
/// </returns>
|
||||
public static bool CloseDoc(Document doc, bool saveChanges = false)
|
||||
{
|
||||
if (doc == null)
|
||||
return false;
|
||||
|
||||
var result = false;
|
||||
UiContext.Send(x => result = doc.Close(saveChanges), null);
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
Reference in New Issue
Block a user