You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We needed to be able to open models from our Revit server with xUnitRevit and couldn't find a solution in the existing repo.
This is now the only way to open a model:
/// <summary>
/// Opens and activates a document if not open already
/// </summary>
/// <param name="filePath">Path to the file to open</param>
public static Document OpenDoc(string filePath)
{
Assert.NotNull(Uiapp);
Document doc = null;
//OpenAndActivateDocument only works if run from the current context
UiContext.Send(x => doc = Uiapp.OpenAndActivateDocument(filePath).Document, null);
Assert.NotNull(doc);
return doc;
}
So we added the OpenDoc() function with the correct parameters for cloud/server models from the Revit API to the xru class in the xUnitRevitUtils:
/// <summary>
/// Opens and activates a document from server or cloud
/// </summary>
/// <param name="filePath">Path to the file to open</param>
/// <param name="openOpts">Opening Options for Cloud Models</param>
/// <param name="detach">Boolean to determine if file should be detached from central</param>
public static Document OpenDoc(string filePath, OpenOptions openOpts, Boolean detach)
{
Assert.NotNull(Uiapp);
Document doc = null;
//OpenAndActivateDocument only works if run from the current context
UiContext.Send(x => doc = Uiapp.OpenAndActivateDocument(ModelPathUtils.ConvertUserVisiblePathToModelPath(filePath), openOpts, detach).Document, null);
Assert.NotNull(doc);
return doc;
}
Do more people feel the need for this feature? If so, we would prepare a PR for it.
The text was updated successfully, but these errors were encountered:
We needed to be able to open models from our Revit server with xUnitRevit and couldn't find a solution in the existing repo.
This is now the only way to open a model:
So we added the
OpenDoc()
function with the correct parameters for cloud/server models from the Revit API to the xru class in the xUnitRevitUtils:Do more people feel the need for this feature? If so, we would prepare a PR for it.
The text was updated successfully, but these errors were encountered: