Fully automated batch processing of Revit files with your own Python or Dynamo task scripts!
ATTENTION: Due to other commitments the original author of Revit Batch Processor (@DanRumery) is unable to support RBP for the future. For questions please seek help from the community such as the Dynamo and Revit API forums.
Fully automated batch processing of Revit files with your own Python or Dynamo task scripts!
Installer for Revit Batch Processor v1.9.0 beta
Version 1.9.0 beta release is available, which adds support for Revit 2023.
See the Releases page for more information.
Click here for some sample RBP python scripts maintained by Jan Christel (@jchristel)
Many thanks to Jan for authoring and making these RBP sample scripts public!
See the Revit Batch Processor FAQ.
This tool doesn't do any of these things, but it allows you to do them:
"With great power come great responsibility" -- Spiderman
This tool enables you to do things with Revit files on a very large scale. Because of this ability, Python or Dynamo scripts that make modifications to Revit files (esp. workshared files) should be developed with the utmost care! You will need to be confident in your ability to write Python or Dynamo scripts that won't ruin your files en-masse. The Revit Batch Processor's 'Detach from Central' option should be used both while testing and for scripts that do not explicitly depend on working with a live workshared Central file.
Installer for Revit Batch Processor v1.9.0 beta
The Revit Batch Processor (GUI) application will appear in the Start menu after the installation.
Open the solution file RevitBatchProcessor.sln in Visual Studio 2017 or later and run Build Solution (F6).
Revit addins will be automatically deployed to the Addins folder for each available Revit version [2015-2023]. e.g. %APPDATA%\Autodesk\Revit\Addins\2019
The BatchRvtGUI project is the GUI that drives the underlying engine (the BatchRvt project). Once built, run BatchRvtGUI.exe to start the Revit Batch Processor GUI.
When rebuilding, please make sure all Revit applications are closed before attempting the rebuild.
This project is licensed under the terms of The GNU General Public License v3.0
Copyright (c) 2021 Daniel Rumery, BVN
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.
Daniel Rumery @DanRumery (Original / Primary Author)
The two ingredients you will need in order to use the Revit Batch Processor ("RBP") are:
An Excel (.xlsx) file or Text (.txt) file that contains a list of Revit file paths. Each file path must be fully qualified (no partial paths).
For an Excel file this means the first column of each row contains a file path.
For a Text file this means each line contains a file path.
For example:
P:\15\ProjectABC\MainModel.rvt
P:\16\ProjectXYZ\ModelA.rvt
P:\16\ProjectXYZ\ModelB.rvt
P:\16\ProjectXYZ\ConsultantModel.rvt
NOTE: you can generate this list in .txt format using the New List button in the GUI. It will prompt you for a folder to scan for Revit files. Optionally you can specify the type of Revit files to scan for and also whether to include subfolders in the scan.
New in version 1.6+
There is limited support for processing files in BIM360. For BIM360-hosted files, use the following format instead:
<Revit version> <Project Guid> <Model Guid>
Note: these three components must be separated by space(s) (not tabs!).
For example:
2020 75b6464c-ba0f-4529-b049-0de9e473c2d6 0d54b8cc-3837-4df2-8c8e-0a94f4828868
2020 c0dc2fda-fd34-42fe-8bb7-bd9f43841dbf d9f011d6-d52c-4c9f-9d7b-eb8388bd3ed0
RBP is not able to detect the Revit version of cloud models hence why the Revit version is specified explicitly.
A Dynamo (.dyn) or Python (.py) task script. This script will be executed once for each file in the list.
For Dynamo scripts, any workspace (.dyn) file should work as a task script without modification. (Indeed, if you find a script that works in Dynamo but not in RBP, submit an Issue to the RBP github page!)
For Python scripts (*.py) they should contain at minimum the following code:
'''Output "Hello Revit world!" to the console / log.'''
# This section is common to all Python task scripts.
import clr
import System
clr.AddReference("RevitAPI")
clr.AddReference("RevitAPIUI")
from Autodesk.Revit.DB import *
import revit_script_util
from revit_script_util import Output
sessionId = revit_script_util.GetSessionId()
uiapp = revit_script_util.GetUIApplication()
doc = revit_script_util.GetScriptDocument()
revitFilePath = revit_script_util.GetRevitFilePath()
# The code above is boilerplate, everything below is all yours.
# You can use almost any part of the Revit API here!
Output()
Output("Hello Revit world!")
Using a python task script it's quite easy to load and execute code in a C# DLL. When RBP runs the python task script, it adds the task script's folder path to the search paths so that if your DLL is in the same folder as your python task script you should be able to execute your functions as follows:
# For example assume your DLL is called MyUtilities.dll and you have a static function called SomeClass.DoSomeWork() in namespace MyNameSpace:
# Assume this python script exists in the same folder as MyUtilities.dll.
clr.AddReference("MyUtilities")
from MyNameSpace import SomeClass
# Invoke your static function, passing in any parameters you need.
SomeClass.DoSomeWork(doc)
Revit Batch Processor can be run from the command-line (bypassing the GUI). First configure and export the required processing settings from the GUI application. Once this is done you can simply run the command line utility BatchRvt.exe passing the exported settings file path as an argument:
%LOCALAPPDATA%\RevitBatchProcessor\BatchRvt.exe --settings_file "BatchRvt.Settings.json"
Optionally you can also specify the location for the log file:
%LOCALAPPDATA%\RevitBatchProcessor\BatchRvt.exe --log_folder "C:\MyBatchTasks\Logs" --settings_file "C:\MyBatchTasks\BatchRvt.Settings.json"
Alternatively, RBP can be run in batch processing mode without a settings file, using some basic arguments:
%LOCALAPPDATA%\RevitBatchProcessor\BatchRvt.exe --task_script MyDynamoWorkspace.dyn --file_list RevitFileList.xlsx --revit_version 2018
NOTE: this mode will operate in Detach mode when processing Central files. The --revit_version argument is optional here---if it is omitted then RBP will use the version of Revit that each Revit file was saved in.
To see help on all available command-line options use --help
:
%LOCALAPPDATA%\RevitBatchProcessor\BatchRvt.exe --help
Help:
Usage (using a settings file):
BatchRvt.exe --settings_file <SETTINGS FILE PATH> [--log_folder <LOG FOLDER PATH>]
Example:
BatchRvt.exe --settings_file BatchRvt.Settings.json --log_folder .
Usage (without a settings file):
BatchRvt.exe --file_list <REVIT FILE LIST PATH> --task_script <TASK SCRIPT FILE PATH>
(NOTE: this mode operates in batch mode only; by default operates in detach mode for central files.)
Additional command-line options:
--revit_version <REVIT VERSION>
--log_folder <LOG FOLDER PATH>
--detach | --create_new_local
--worksets <open_all | close_all>
--audit
--help
Examples:
BatchRvt.exe --task_script MyDynamoWorkspace.dyn --file_list RevitFileList.xlsx
BatchRvt.exe --task_script MyDynamoWorkspace.dyn --file_list RevitFileList.xlsx --detach --audit
BatchRvt.exe --task_script MyTask.py --file_list RevitFileList.txt --create_new_local --worksets open_all
BatchRvt.exe --task_script MyTask.py --file_list RevitFileList.xlsx --revit_version 2019 --detach --worksets close_all
Feedback and suggestions for improvement are more than welcome! Please track and submit bugs via the Github Issues page. If you're feeling particularly adventurous you may even submit your own code via a Github pull request.
https://github.com/bvn-architecture/RevitBatchProcessor