bvn-architecture / RevitBatchProcessor

Fully automated batch processing of Revit files with your own Python or Dynamo task scripts!
GNU General Public License v3.0
288 stars 76 forks source link

Unhandled Failure on Document Opening #96

Open thumDer opened 2 years ago

thumDer commented 2 years ago

We've found an error / failure which is not handled as the most of them on opening, and it breaks the whole process. The preferred resolution would be to delete the elements.

Here are the details about the failure:


23. 09. 2022 20:50:02 :     - Processing Revit document warnings / failures (1):
23. 09. 2022 20:50:02 :     - 
23. 09. 2022 20:50:02 :     -   DocumentCorruption - Some families have become unusable. Reload the families, or delete them from the model. - (GUID: 12266a1d-dc76-4477-8520-4a2f6474eec7)
23. 09. 2022 20:50:03 :     - 
23. 09. 2022 20:50:03 :     - ERROR: Model is corrupt: The model could not be opened: Some data in file an unnamed file needs to be recovered. In the Open dialog, select the Audit option. Then open and re-save the model. (CArchiveException 105)
23. 09. 2022 20:50:03 :     - 
23. 09. 2022 20:50:03 :     - Exception: [Exception] The model could not be opened: Some data in file an unnamed file needs to be recovered. In the Open dialog, select the Audit option. Then open and re-save the model. (CArchiveException 105)
23. 09. 2022 20:50:03 :     - .NET exception: [CorruptModelException] The model could not be opened: Some data in file an unnamed file needs to be recovered. In the Open dialog, select the Audit option. Then open and re-save the model. (CArchiveException 105)
23. 09. 2022 20:50:03 :     - 
23. 09. 2022 20:50:03 :     - Further exception information:
23. 09. 2022 20:50:03 :     - 
23. 09. 2022 20:50:03 :     -   OpenDetachAndPreserveWorksets$101: 136: [171-171] 'C:\Users\zsolt.olah\AppData\Local\RevitBatchProcessor\Scripts\revit_file_util.py'
23. 09. 2022 20:50:03 :     -   WithOpenedDetachedDocument$100: 236: [236-236] 'C:\Users\zsolt.olah\AppData\Local\RevitBatchProcessor\Scripts\revit_script_util.py'
23. 09. 2022 20:50:03 :     -   revitAction$98: 55: [308-317] 'C:\Users\zsolt.olah\AppData\Local\RevitBatchProcessor\Scripts\revit_script_util.py'
23. 09. 2022 20:50:03 :     -   WithDocumentOpeningErrorReporting$97: 61: [370-370] 'C:\Users\zsolt.olah\AppData\Local\RevitBatchProcessor\Scripts\revit_script_util.py'
23. 09. 2022 20:50:03 :     -   action$96: 37: [363-363] 'C:\Users\zsolt.olah\AppData\Local\RevitBatchProcessor\Scripts\revit_script_util.py'
23. 09. 2022 20:50:03 :     -   WithDialogBoxShowingHandler$95: 103: [88-88] 'C:\Users\zsolt.olah\AppData\Local\RevitBatchProcessor\Scripts\revit_dialog_util.py'
23. 09. 2022 20:50:03 :     -   action$94: 38: [384-384] 'C:\Users\zsolt.olah\AppData\Local\RevitBatchProcessor\Scripts\revit_script_util.py'
23. 09. 2022 20:50:03 :     -   WithFailuresProcessingHandler$92: 118: [172-172] 'C:\Users\zsolt.olah\AppData\Local\RevitBatchProcessor\Scripts\revit_failure_handling.py'
23. 09. 2022 20:50:03 :     -   action$91: 49: [386-386] 'C:\Users\zsolt.olah\AppData\Local\RevitBatchProcessor\Scripts\revit_script_util.py'
23. 09. 2022 20:50:03 :     -   WithExceptionLogging$90: 66: [165-165] 'C:\Users\zsolt.olah\AppData\Local\RevitBatchProcessor\Scripts\revit_script_util.py'
23. 09. 2022 20:50:03 :     -   WithAutomatedErrorHandling$89: 66: [388-388] 'C:\Users\zsolt.olah\AppData\Local\RevitBatchProcessor\Scripts\revit_script_util.py'
23. 09. 2022 20:50:03 :     -   WithErrorReportingAndHandling$88: 66: [365-365] 'C:\Users\zsolt.olah\AppData\Local\RevitBatchProcessor\Scripts\revit_script_util.py'
23. 09. 2022 20:50:03 :     -   RunDetachedDocumentAction$87: 114: [319-319] 'C:\Users\zsolt.olah\AppData\Local\RevitBatchProcessor\Scripts\revit_script_util.py'
23. 09. 2022 20:50:03 :     -   RunBatchTaskScript$63: 1906: [273-282] 'C:\Users\zsolt.olah\AppData\Local\RevitBatchProcessor\Scripts\revit_script_host.py'
23. 09. 2022 20:50:03 :     -   <lambda$3>$62: 30: [384-384] 'C:\Users\zsolt.olah\AppData\Local\RevitBatchProcessor\Scripts\revit_script_host.py'
23. 09. 2022 20:50:03 :     -   WithErrorHandling$25: 89: [49-49] 'C:\Users\zsolt.olah\AppData\Local\RevitBatchProcessor\Scripts\script_host_error.py'
23. 09. 2022 20:50:03 :     -   DoRevitSessionProcessing$46: 316: [383-388] 'C:\Users\zsolt.olah\AppData\Local\RevitBatchProcessor\Scripts\revit_script_host.py'
23. 09. 2022 20:50:03 :     -   <lambda$4>$45: 36: [419-425] 'C:\Users\zsolt.olah\AppData\Local\RevitBatchProcessor\Scripts\revit_script_host.py'
23. 09. 2022 20:50:03 :     -   WithErrorHandling$25: 89: [49-49] 'C:\Users\zsolt.olah\AppData\Local\RevitBatchProcessor\Scripts\script_host_error.py'
23. 09. 2022 20:50:03 :     -   outputStreamWriterAction$42: 66: [418-429] 'C:\Users\zsolt.olah\AppData\Local\RevitBatchProcessor\Scripts\revit_script_host.py'
23. 09. 2022 20:50:03 :     -   UsingStream$39: 61: [84-84] 'C:\Users\zsolt.olah\AppData\Local\RevitBatchProcessor\Scripts\stream_io_util.py'
23. 09. 2022 20:50:03 :     -   outputStreamAction$40: 73: [432-432] 'C:\Users\zsolt.olah\AppData\Local\RevitBatchProcessor\Scripts\revit_script_host.py'
23. 09. 2022 20:50:03 :     -   UsingStream$39: 61: [84-84] 'C:\Users\zsolt.olah\AppData\Local\RevitBatchProcessor\Scripts\stream_io_util.py'
23. 09. 2022 20:50:03 :     -   Main$26: 205: [435-435] 'C:\Users\zsolt.olah\AppData\Local\RevitBatchProcessor\Scripts\revit_script_host.py'
23. 09. 2022 20:50:03 :     -   WithErrorHandling$25: 89: [49-49] 'C:\Users\zsolt.olah\AppData\Local\RevitBatchProcessor\Scripts\script_host_error.py'
23. 09. 2022 20:50:03 :     -   <unnamed>: 451: [447-451] 'C:\Users\zsolt.olah\AppData\Local\RevitBatchProcessor\Scripts\revit_script_host.py'
23. 09. 2022 20:50:03 :     - 
23. 09. 2022 20:50:03 :     - Operation aborted.
23. 09. 2022 20:50:03 :     - 
23. 09. 2022 20:50:03 :     - ERROR: An error occurred while processing the file!
23. 09. 2022 20:50:03 :     - 
23. 09. 2022 20:50:04 :     - Exception: [Exception] The model could not be opened: Some data in file an unnamed file needs to be recovered. In the Open dialog, select the Audit option. Then open and re-save the model. (CArchiveException 105)
23. 09. 2022 20:50:04 :     - .NET exception: [CorruptModelException] The model could not be opened: Some data in file an unnamed file needs to be recovered. In the Open dialog, select the Audit option. Then open and re-save the model. (CArchiveException 105)
23. 09. 2022 20:50:04 :     - 
23. 09. 2022 20:50:04 :     - Further exception information:
23. 09. 2022 20:50:04 :     - 
23. 09. 2022 20:50:04 :     -   OpenDetachAndPreserveWorksets$101: 136: [171-171] 'C:\Users\zsolt.olah\AppData\Local\RevitBatchProcessor\Scripts\revit_file_util.py'
23. 09. 2022 20:50:04 :     -   WithOpenedDetachedDocument$100: 236: [236-236] 'C:\Users\zsolt.olah\AppData\Local\RevitBatchProcessor\Scripts\revit_script_util.py'
23. 09. 2022 20:50:04 :     -   revitAction$98: 55: [308-317] 'C:\Users\zsolt.olah\AppData\Local\RevitBatchProcessor\Scripts\revit_script_util.py'
23. 09. 2022 20:50:04 :     -   WithDocumentOpeningErrorReporting$97: 61: [370-370] 'C:\Users\zsolt.olah\AppData\Local\RevitBatchProcessor\Scripts\revit_script_util.py'
23. 09. 2022 20:50:04 :     -   action$96: 37: [363-363] 'C:\Users\zsolt.olah\AppData\Local\RevitBatchProcessor\Scripts\revit_script_util.py'
23. 09. 2022 20:50:04 :     -   WithDialogBoxShowingHandler$95: 103: [88-88] 'C:\Users\zsolt.olah\AppData\Local\RevitBatchProcessor\Scripts\revit_dialog_util.py'
23. 09. 2022 20:50:04 :     -   action$94: 38: [384-384] 'C:\Users\zsolt.olah\AppData\Local\RevitBatchProcessor\Scripts\revit_script_util.py'
23. 09. 2022 20:50:04 :     -   WithFailuresProcessingHandler$92: 118: [172-172] 'C:\Users\zsolt.olah\AppData\Local\RevitBatchProcessor\Scripts\revit_failure_handling.py'
23. 09. 2022 20:50:04 :     -   action$91: 49: [386-386] 'C:\Users\zsolt.olah\AppData\Local\RevitBatchProcessor\Scripts\revit_script_util.py'
23. 09. 2022 20:50:04 :     -   WithExceptionLogging$90: 66: [165-165] 'C:\Users\zsolt.olah\AppData\Local\RevitBatchProcessor\Scripts\revit_script_util.py'
23. 09. 2022 20:50:04 :     -   WithAutomatedErrorHandling$89: 66: [388-388] 'C:\Users\zsolt.olah\AppData\Local\RevitBatchProcessor\Scripts\revit_script_util.py'
23. 09. 2022 20:50:04 :     -   WithErrorReportingAndHandling$88: 66: [365-365] 'C:\Users\zsolt.olah\AppData\Local\RevitBatchProcessor\Scripts\revit_script_util.py'
23. 09. 2022 20:50:04 :     -   RunDetachedDocumentAction$87: 114: [319-319] 'C:\Users\zsolt.olah\AppData\Local\RevitBatchProcessor\Scripts\revit_script_util.py'
23. 09. 2022 20:50:04 :     -   RunBatchTaskScript$63: 1906: [273-282] 'C:\Users\zsolt.olah\AppData\Local\RevitBatchProcessor\Scripts\revit_script_host.py'
23. 09. 2022 20:50:04 :     -   <lambda$3>$62: 30: [384-384] 'C:\Users\zsolt.olah\AppData\Local\RevitBatchProcessor\Scripts\revit_script_host.py'
23. 09. 2022 20:50:04 :     -   WithErrorHandling$25: 89: [49-49] 'C:\Users\zsolt.olah\AppData\Local\RevitBatchProcessor\Scripts\script_host_error.py'
23. 09. 2022 20:50:04 :     -   DoRevitSessionProcessing$46: 316: [383-388] 'C:\Users\zsolt.olah\AppData\Local\RevitBatchProcessor\Scripts\revit_script_host.py'
23. 09. 2022 20:50:04 :     -   <lambda$4>$45: 36: [419-425] 'C:\Users\zsolt.olah\AppData\Local\RevitBatchProcessor\Scripts\revit_script_host.py'
23. 09. 2022 20:50:04 :     -   WithErrorHandling$25: 89: [49-49] 'C:\Users\zsolt.olah\AppData\Local\RevitBatchProcessor\Scripts\script_host_error.py'
23. 09. 2022 20:50:04 :     -   outputStreamWriterAction$42: 66: [418-429] 'C:\Users\zsolt.olah\AppData\Local\RevitBatchProcessor\Scripts\revit_script_host.py'
23. 09. 2022 20:50:04 :     -   UsingStream$39: 61: [84-84] 'C:\Users\zsolt.olah\AppData\Local\RevitBatchProcessor\Scripts\stream_io_util.py'
23. 09. 2022 20:50:04 :     -   outputStreamAction$40: 73: [432-432] 'C:\Users\zsolt.olah\AppData\Local\RevitBatchProcessor\Scripts\revit_script_host.py'
23. 09. 2022 20:50:04 :     -   UsingStream$39: 61: [84-84] 'C:\Users\zsolt.olah\AppData\Local\RevitBatchProcessor\Scripts\stream_io_util.py'
23. 09. 2022 20:50:04 :     -   Main$26: 205: [435-435] 'C:\Users\zsolt.olah\AppData\Local\RevitBatchProcessor\Scripts\revit_script_host.py'
23. 09. 2022 20:50:04 :     -   WithErrorHandling$25: 89: [49-49] 'C:\Users\zsolt.olah\AppData\Local\RevitBatchProcessor\Scripts\script_host_error.py'
23. 09. 2022 20:50:04 :     -   <unnamed>: 451: [447-451] 'C:\Users\zsolt.olah\AppData\Local\RevitBatchProcessor\Scripts\revit_script_host.py'
23. 09. 2022 20:50:13 : 
23. 09. 2022 20:50:13 : Revit process (PID: 38660) has exited!
24. ```
thumDer commented 2 years ago

It seems similar to #35 but it is still a bit different. I think the main issue here is that app.OpenDocumentFile() throws a CorruptModelException which is not really an exception in this case, because actually it can be handled through a dialogbox if opening the file manually (elements can be deleted). RBP handles all such exceptions in the same way, but this specific case

Some families have become unusable. Reload the families, or delete them from the model. - (GUID: 12266a1d-dc76-4477-8520-4a2f6474eec7)

could be handled differently, but I don't know if it is possible. It might be an API restriction I believe...

petersmithfromengland commented 1 year ago

Hi @thumDer

I did a quick google on this and found the below thread which outlines from the Autodesk dev team that this is a Revit problem, rather than a RBP problem

https://forums.autodesk.com/t5/revit-api-forum/opendocumentfile-corruptmodelexception/td-p/8278426

Does the below suggested fix work for you?

image

This would be in the addin manifest for RBP in the Revit version you are trying this task in, e.g. BatchRvtAddin2022

Let me know how you go

Cheers, Pete

thumDer commented 1 year ago

Will try, and get back to you, thanks!

thumDer commented 1 year ago

We've tried changing the VendorId for RBP to ADSK and also to our inhouse addin's VendorId but unfortunately it didn't solve the problem. I'm afraid there is nothing we can do about it at the moment :/