Default worksets

Default worksets

Anonymous
Not applicable
971 Views
4 Replies
Message 1 of 5

Default worksets

Anonymous
Not applicable

This has to be an easy fix.

 

 am creating a new project from and existing central file. Everything works as expected except when the user goes to open the file it defaults to the AskUserToSpecify setting. I want to change the default setting to AllEditable but I can't seem to figure out how to set that option.

 

I believe I have to set the SimpleWorksetConfiguration but I'm not sure.

 

Here is the code I'm using

 

///***********************************
/// Open central file template and save it as
/// a new project central file
/// ************************************

Autodesk.Revit.UI.UIDocument newRvtDoc = rvtUiApp.OpenAndActivateDocument(fileToCopy);
Autodesk.Revit.DB.Document newProjCent = rvtUiApp.ActiveUIDocument.Document;

SaveAsOptions options = new SaveAsOptions();

WorksharingSaveAsOptions wsOptions = new WorksharingSaveAsOptions();
wsOptions.SaveAsCentral = true;

options.SetWorksharingOptions(wsOptions);

ModelPath modelPath = ModelPathUtils.ConvertUserVisiblePathToModelPath(newLocation);

newProjCent.SaveAs(newLocation, options);

0 Likes
Accepted solutions (1)
972 Views
4 Replies
Replies (4)
Message 2 of 5

Anonymous
Not applicable

Found it. One simple line of code.

 

///***********************************
/// Open central file template and save it as
/// a new project central file
/// ************************************

Autodesk.Revit.UI.UIDocument newRvtDoc = rvtUiApp.OpenAndActivateDocument(fileToCopy);
Autodesk.Revit.DB.Document newProjCent = rvtUiApp.ActiveUIDocument.Document;

SaveAsOptions options = new SaveAsOptions();

WorksharingSaveAsOptions wsOptions = new WorksharingSaveAsOptions();
SimpleWorksetConfiguration sWS = new SimpleWorksetConfiguration();

sWS = SimpleWorksetConfiguration.LastViewed;

wsOptions.SaveAsCentral = true;
wsOptions.OpenWorksetsDefault = sWS;

options.SetWorksharingOptions(wsOptions);

ModelPath modelPath = ModelPathUtils.ConvertUserVisiblePathToModelPath(newLocation);

newProjCent.SaveAs(newLocation, options);

Message 3 of 5

Mustafa.Salaheldin
Collaborator
Collaborator
Accepted solution

Ok it is really simple, just add the following line:

 

wsOptions.OpenWorksetsDefault = SimpleWorksetConfiguration.AllEditable;

If this reply satisfies your need, please don't forget to mark it as an answer.


¯\_(ツ)_/¯
Let it work like a charm.

Mustafa Salaheldin


EESignature




Digital Integration Manager, DuPod

Facebook | Twitter | LinkedIn

Message 4 of 5

Anonymous
Not applicable

Mustafa,

 

Thanks for the quick response. It's the simple ones that are the most annoying.

0 Likes
Message 5 of 5

BrendonLayCHT
Participant
Participant

what about for non editable as defualt