Upgrade Revit file to a newest version with Revit API

Hello All,

When I try to programmatically (with Revit API) upgrade Revit file from 2023 to 2024 or 2025, Revit freezes.

Is it even allowed to upgrade programmatically? What could be the reason? What are the best practices?

doc_temp = app.OpenDocumentFile(template_path)
doc_temp.SaveAs(save_path)
doc_temp.Close()

Below is the reply I got in Revit API forum.

We already have JIRA tickets submitted to the engineering team for analysis of this issue (REVIT-236376 and REVIT-237190).

Please refer to the documentation for the Revit 2023.1.8 Update. Under Issues Resolved > User Interface, you will find the note: “Fixed an issue where the Revit UI became unresponsive in some cases on Windows 11.”

For Revit 2024 and 2025, our engineering team is actively working to address this issue. However, I cannot guarantee that the fix will be included in the next release. Therefore, I recommend that you avoid making any business-critical decisions based on this issue until official confirmation is provided by Autodesk.

If the fix is released for Revit 2024 or 2025, it will be documented in the official Release Notes for those versions.

I hope this helps.

none of the three method above changed in yeaaaaaaars

No doubt and thank you for the reply.

I’m not sure if I should recommend this, but Autodesk recently acquired UNIFY to do Content Catalog If you have a subscription or have some weight in the company you could push them to go for that part. The good thing is all items uploaded on content catalog auto-updates to its appropriate Revit version
ACC (Autodesk construction cloud) can also update your model in the background

but yes your method of opening model and re-saving it also works. but it mean sacrificing a computer to run the updates for a couple days

I had a similar issue with a script to upgrade multiple files.
You could try giving the UISaveAsOptions parameter.
But I think what fixed it is the part in the finally block, below.

for of in old_files:

    try:
        doc = revit.open_doc(of)
        doc_old_title = doc.Title
        if option_replace_text: # if user option chosen to do text character replacements
            doc_new_title = doc_old_title.replace(txt_search, txt_replace)
        else:
            doc_new_title = doc_old_title
        
        doc_new_title = "{}{}".format(prefix, doc_new_title) # Add prefix
        
        print("{}".format(doc_new_title))
        
        new_path_full = new_path_loc+"\\"+str(doc_new_title)+"."+filetype
        doc.SaveAs(new_path_full, ui_save_opt)
    finally:
        doc.Close(False) # Close

        # Clean-ups are to try to correct hanging when processing several files
        doc.Dispose()
        del doc
        gc.collect() # Garbage collection
1 Like

Bonjour,

Le problème est la fenêtre de mise à niveau de modèle lors de la mise à niveau d’un ancien fichier revit…

j’ai passer des heures à essayer résoudre ce problème. Mais sans succès.

Impossible de capturer cette fenêtre pour la désactiver lors de l’ouverture d’un fichier Revit voir…

Après la fenêtre ou après le chargement du fichier avec (UIApp.Application.OpenDocumentFile), l’Api est incapable de reprendre le contrôle sur une fenêtre Modal ou non Modale, c’est fustrant….

Avec WinForms Forms.Application.DoEvents() agit à peut près correctement, seulement dans certaines circonstances.

Avec WPF Forms.Application.DoEvents() ou Dispatcher, c’est quasiment sans effet.

C’est vraiment, mais vraiment frustrant !!!.

Toujours pas de nouvelles des tickets JIRA soumis à l’équipe d’ingénierie pour analyse de ce problème.

Meilleures salutations Ă  tous le monde MIBBIM SA, Alain Genoud