Search code examples
c#revit-api

Is there a way to change the workset configuration of a revit file without opening revit?


I am currently trying to close all worksets of a revit model before opening it programmatically using C#. Without a valid API instance I am lost on how to close worksets prior to opening. I have seen other software such as Revit Batch Processor accomplish this: https://github.com/bvn-architecture/RevitBatchProcessor . But after going through their source code, I still can't seem to figure it out.

I have tried opening the file.manually and simulating input to accomplish this, but I want to know if there is a way to do it properly.

EDIT: This is for a local file


Solution

  • Thank you very much for pointing out the very useful- and full-fledged-looking batch processor. I would be surprised if you could close worksets of a Revit model before opening it. What makes you think that the batch processor does so? I searched for OpenDocumentFile and found it in revit_file_util.py with nothing special in it for handling worksets.