OpenOptions.SetOpenWorksetsConfiguration
Method
Description:
Sets the object used to configure the worksets to open when the model is opened.
Sets the object used to configure the worksets to open when the model is opened.
Remarks:
These options are ignored for non-workshared models.
These options are ignored for non-workshared models.
Examples
Document OpenDocumentWithWorksets(Application app, ModelPath projectPath)
{
Document doc = null;
try
{
// Get info on all the user worksets in the project prior to opening
IList<WorksetPreview> worksets = WorksharingUtils.GetUserWorksetInfo(projectPath);
IList<WorksetId> worksetIds = new List<WorksetId>();
// Find two predetermined worksets
foreach (WorksetPreview worksetPrev in worksets)
{
if (worksetPrev.Name.CompareTo("Workset1") == 0 ||
worksetPrev.Name.CompareTo("Workset2") == 0)
{
worksetIds.Add(worksetPrev.Id);
}
}
OpenOptions openOptions = new OpenOptions();
// Setup config to close all worksets by default
WorksetConfiguration openConfig = new WorksetConfiguration(WorksetConfigurationOption.CloseAllWorksets);
// Set list of worksets for opening
openConfig.Open(worksetIds);
openOptions.SetOpenWorksetsConfiguration(openConfig);
doc = app.OpenDocumentFile(projectPath, openOptions);
}
catch (Exception e)
{
TaskDialog.Show("Open File Failed", e.Message);
}
return doc;
}
Parameters
Parameter | Type | Description |
---|---|---|
openConfiguration | WorksetConfiguration | The options. If <span class="keyword"><span data-languagespecifictext="cpp=nullptr|vb=Nothing|nu=null" id="LSTD776518B_1"></span></span>, all user-created worksets will be opened. |
Return Value