Revit API WorksetConfiguration

Revit API WorksetConfiguration

Anonymous
Not applicable
1,179 Views
3 Replies
Message 1 of 4

Revit API WorksetConfiguration

Anonymous
Not applicable

I'm trying to read and display all the 3D views from multiple documents (hundred of them), the way I'm doing it right now is the following:

 

1 - I Open the document using the function app__.OpenDocumentFile(model_path, oo)

2 - Read the 3D views 

 

The problem with this is it takes so long to open the document, so I thought to close all the worksets before opening the document. What I found weird for me is the function Close of the class WorksetConfiguration requires a list of elementids, which doesn't make sense because this is still an option the open the document

 

Hence, I have 2 questins: 

1 - Is there any way to open a document and read all the 3D views faster.

2 - And is there any way to close all the worksets before I open a document

 

here my OpenOptions class

 

With oo
.DetachFromCentralOption = DetachFromCentralOption.DetachAndPreserveWorksets
.SetOpenWorksetsConfiguration(wsc)
.AllowOpeningLocalByWrongUser = True
End With

 

Thank you 🙂

0 Likes
Accepted solutions (1)
1,180 Views
3 Replies
Replies (3)
Message 2 of 4

Troy_Gates
Advocate
Advocate
Accepted solution

Before you open a document you can create a WorksetConfiguration with all worksets closed like so:

 

OpenOptions openOptions = new OpenOptions();

WorksetConfiguration worksetOption = new WorksetConfiguration(WorksetConfigurationOption.CloseAllWorksets); openOptions.SetOpenWorksetsConfiguration(worksetOption);

app__.OpenDocumentFile(model_path, openOptions);
0 Likes
Message 3 of 4

RPTHOMAS108
Mentor
Mentor

If you close all the worksets will there be anything in the 3D views left to view?

 

To answer the question about WorksetIDs there is an example of this in the RevitAPI.chm. Basically you use the WorkSharingUtils.GetWorksetInfo(..) to build a list of id's you'd like to open and then use those id's in the options.

 

You may also want to review the TransmissionData class which I believe will allow you to unload links prior to opening full document.

 

 

 

 

0 Likes
Message 4 of 4

Anonymous
Not applicable

Thanks a lot , this is what I need 🙂

0 Likes