Created
December 6, 2025 16:42
-
-
Save aldoyh/be35b7a10b6c7300c0fa5a829144f995 to your computer and use it in GitHub Desktop.
From Revvit 25' to 23'
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Run this in Revit 2023 | |
| import os | |
| from Autodesk.Revit.DB import * | |
| # CONFIGURATION | |
| # ------------------ | |
| source_ifc_folder = r"C:\Intermediate_IFC" # Folder with IFCs from Step 1 | |
| final_output_folder = r"C:\Revit_2023_Converted" # Folder for final files | |
| # ------------------ | |
| app = __revit__.Application | |
| # Get all IFC files | |
| files = [f for f in os.listdir(source_ifc_folder) if f.endswith(".ifc")] | |
| print("Starting Batch Conversion for {} files...".format(len(files))) | |
| for f in files: | |
| source_path = os.path.join(source_ifc_folder, f) | |
| print("Converting: " + f) | |
| # Open IFC (Revit automatically converts IFC to RVT upon opening) | |
| # This requires the 'Open' command, not 'Link' for a direct save | |
| try: | |
| # Open the IFC file directly | |
| doc = app.OpenIFCDocument(source_path) | |
| # Define Save Options | |
| save_options = SaveAsOptions() | |
| save_options.OverwriteExistingFile = True | |
| # Save as Revit 2023 Project | |
| new_filename = f.replace(".ifc", "_2023.rvt") | |
| save_path = os.path.join(final_output_folder, new_filename) | |
| doc.SaveAs(save_path, save_options) | |
| print("Saved: " + new_filename) | |
| # Close | |
| doc.Close(False) | |
| except Exception as e: | |
| print("Failed to convert {}: {}".format(f, e)) | |
| print("Batch Process Complete.") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment