Hello,
I have collected the Link WorksetIds I want to close and put this into the following code.
objWorksetConfiguration.Close(ListOfWorksetID) objRevitLinkType.LoadFrom(objModelPath, objWorksetConfiguration)
The Link is the same, when I run the command the link is reloaded however the Link worksets are not closed.
Any ideas?
Kind Regards
David
Solved! Go to Solution.
Solved by Rockit_for_Revit. Go to Solution.
Solved by zhong_wu. Go to Solution.
Open worksets is working successfully.
objWorksetConfiguration.Open(lstOfWorksetIDsToOpen)
However still cannot get .close to work.
Kind Regards
David
Hi David, Interesting, I tried with one of our sample revit file(added some worksets), and open the file by the code as follow, the WorksetConfiguration.Close() method works as good as I expected. I can't reproduce the issue as you mentioned so far, maybe you can share with me the reproduce sample code and the revit files, I would be happy to check more.
public Autodesk.Revit.UI.Result Execute(ExternalCommandData commandData, ref string message, Autodesk.Revit.DB.ElementSet elements) { // Get the application and document from external command data. UIApplication app = commandData.Application; // the list of worksets that will be closed List<WorksetId> wsIds = new List<WorksetId>(); wsIds.Add(new WorksetId(0)); wsIds.Add(new WorksetId(163)); wsIds.Add(new WorksetId(343)); wsIds.Add(new WorksetId(344)); WorksetConfiguration wsConf = new WorksetConfiguration(WorksetConfigurationOption.OpenAllWorksets); wsConf.Close(wsIds); // open the file from BIM360 Docs ModelPath modelPath = ModelPathUtils.ConvertCloudGUIDsToCloudPath(new Guid("55a82cfc-680d-XXXX-bcf7-2f11837062a5"), new Guid("0e57bf28-XXXX-443c-9d10-aee9ef0d37f4")); OpenOptions oo = new OpenOptions(); oo.SetOpenWorksetsConfiguration(wsConf); app.OpenAndActivateDocument(modelPath, oo, false); return Autodesk.Revit.UI.Result.Succeeded; }
Thank you,
If you want to modify the Worksets you must begin with WorksetConfigurationOption.CloseAllWorksets or WorksetConfigurationOption.OpenAllWorksets. This was where I was going wrong.
WorksetConfiguration = New WorksetConfiguration(WorksetConfigurationOption.CloseAllWorksets)
Kind Regards
David
Can't find what you're looking for? Ask the community or share your knowledge.