bvn-architecture / RevitBatchProcessor

Fully automated batch processing of Revit files with your own Python or Dynamo task scripts!
GNU General Public License v3.0
277 stars 75 forks source link
batch-processing dynamo python revit revit-addins revit-api revit-batch-processing revit-batch-processor revit-files

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.

Revit Batch Processor (RBP)

Fully automated batch processing of Revit files with your own Python or Dynamo task scripts!

Latest version (NEW)

Version 1.10.0 beta release is available, which includes support for Revit 2024. Installer is here

See the Releases page for v1.10.0-beta release notes.

RBP Sample Scripts

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!

FAQ

See the Revit Batch Processor FAQ.

Use cases

This tool doesn't do any of these things, but it allows you to do them:

Screenshot of the UI

Features

Unlimited Power

"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.

Build & Installation Instructions

Installer

Installer for Revit Batch Processor v1.10.0 beta

The Revit Batch Processor (GUI) application will appear in the Start menu after the installation.

Build from Source code

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-2024]. 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.

Requirements

License

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/.

Credits

Daniel Rumery @DanRumery (Original / Primary Author)

Other Contributors (code)

Usage

The two ingredients you will need in order to use the Revit Batch Processor ("RBP") are:

Executing functions in a C# DLL

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)

Command-line Interface

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

Contribute

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

Known Limitations / Issues