OpenOptionsSetOpenWorksetsConfiguration Method |
Sets the object used to configure the worksets to open when the model is opened.
Namespace: Autodesk.Revit.DBAssembly: RevitAPI (in RevitAPI.dll) Version: 27.0.4.0 (27.0.4.0)
Syntaxpublic void SetOpenWorksetsConfiguration(
WorksetConfiguration openConfiguration
)
Public Sub SetOpenWorksetsConfiguration (
openConfiguration As WorksetConfiguration
)
public:
void SetOpenWorksetsConfiguration(
WorksetConfiguration^ openConfiguration
)
member SetOpenWorksetsConfiguration :
openConfiguration : WorksetConfiguration -> unit Parameters
- openConfiguration WorksetConfiguration
-
The options. If , all user-created worksets will be opened.
Remarks
These options are ignored for non-workshared models.
ExampleDocument OpenDocumentWithWorksets(Application app, ModelPath projectPath)
{
Document doc = null;
try
{
IList<WorksetPreview> worksets = WorksharingUtils.GetUserWorksetInfo(projectPath);
IList<WorksetId> worksetIds = new List<WorksetId>();
foreach (WorksetPreview worksetPrev in worksets)
{
if (worksetPrev.Name.CompareTo("Workset1") == 0 ||
worksetPrev.Name.CompareTo("Workset2") == 0)
{
worksetIds.Add(worksetPrev.Id);
}
}
OpenOptions openOptions = new OpenOptions();
WorksetConfiguration openConfig = new WorksetConfiguration(WorksetConfigurationOption.CloseAllWorksets);
openConfig.Open(worksetIds);
openOptions.SetOpenWorksetsConfiguration(openConfig);
doc = app.OpenDocumentFile(projectPath, openOptions);
}
catch (Exception e)
{
TaskDialog.Show("Open File Failed", e.Message);
}
return doc;
}
See Also