I am working on a pyRevit script for bulk upgrade of all files in a specified folder. As the script closes all worksets upon openings a central file, no pop up messages would appear in this case.
However, if the file encountered is not central, many Dialogs appear, blocking the script until the user specifies a value for the specific update. As I noticed all of the dialogs upon opening are usually of type ‘Dialog_Revit_DocWarnDialog’, I tried to specify a default value for all of them, which was 1001. However, sometimes the first button in the dialog is not the one we need to press, so I had to go deeper and specify a different value, depending on the dialog message.
I am trying to avoid using pyRevit classes and functions, but base my scripts on the RevitAPI entirely. In that sense, even though this script works under pyRevit, it doesn’t really use anything from it (actually one single thing - the form to pick up folders).
In that sense, I think it’s a general API question and I found my answer within the API, been just struggling to translate it into Python ( if you ask anything Python related in the API forum, you usually get the answer to go ask in the dynamo forum instead )
Pretty much everything available in pyrevit is actually written quite raw in its libraries if you go digging, but no worries! I’ve learnt a lot about the API by digging through lots of the py files and tools.
Instead of swallowing the error (usually a bad practice - they pop up for a reason after all) you might want to consider checking to see if the file is workshared. If so use the current method you’re working with, and if not use a different method (avoiding the workset issue and others) to process the file.
Start by extracting the basic file info from the document with this method: Extract Method. Then after you have the basic file info object get the worksharing status with this property: IsWorkshared Property.
As an added benefit while you’re working with the basic file info object you can get a bunch of other useful data, such as the file format (Revit release year), if all changes have been saved to the central (ensuring that no one has work locally saved but not synced before you upgrade), and what version the file is (how many times it’s been saved).
Hi, the worksets issue is not a thing, the problem is with messages of this kind:
And they would still appear when following the workflow you are mentioning. Maybe you see in my code that I wanted to try overriding the pop up message result with 1001 in any case. However, this is not ok, as it means for example ‘delete rooms’ in certain cases. That’s why I think the method I need to use is the one mentioned above, in the youtube video.
I just can’t translate it in Python, so I have no choice but to try with the pyRevit method and see if it helps if not, I will have to rewrite the script in C#, I just wanted to avoid having to do that
Those warnings appear related to links either not loading that bound rooms and/or references being lost. Test carefully with error swallowing as i believe it may potentially use deletion options to bypass them sometimes.
yeap, I will definitely check if they are dismissed properly, but I see I might have to recreate it in C#, so that I can properly explore the error messages and the ‘correct’ answer to each. Another example of an error one might get upon opening:
I realised why you were asking that, it’s cause I mentioned they do not appear for central models What I meant was when all worksets are closed upon opening the file, there is basically nothing that could go wrong. For instance, if all dimensions are in a closed workset, there is no way any of them would lose its reference, etc. At least, while testing, I couldn’t find a single workshared model, producing any of these errors with this workflow. But still, it doesn’t depend on the workshared status, but the fact the script is closing all worksets