Autodesk Revit
This guide provides the basic information about our Revit integration.
If this is your first time setting up an integration, we recommend to follow one of the Intermediate tutorials.
System requirements:
- 💻 Windows PC
- 🐍 Python =< 3.10
- A version of Revit (we use 2024 in this guide)
To integrate Revit into a VIKTOR application, you will require some additional software.
Download and install pyRevit
In order to use Revit with Python, you will need to download and install the pyRevit extension for Revit. You can find all the information you need to install pyRevit and connect it to your version of Revit in the pyRevit documentation. After following the steps of the installer, continue to the next section.
Additional information
You may want to consult some additional information about the software we are using, below you can find some useful links:
Setup work environment
Before you can start building your VIKTOR - Revit apps, you will need to complete some steps for the setup.
Step 1: Start a VIKTOR app
You will need to create, install and start an empty app. If you would like a quick reminder on how to do this, you can follow the steps here.
Step 2: Make/Choose a folder for the generic worker
The generic worker will require a folder which will be used to send information to the worker. This directory will also be where the results from the worker will be stored.
Step 3: Configure the generic worker
VIKTOR does not provide a dedicated worker for Revit, the generic worker can be combined with the Revit API and pyRevit hence we will need to set-up this generic worker with python. You can download the generic worker here.
In order to use the generic worker for Revit, you will need to copy the following information into your configuration. The file should look something like this:
executables:
revit:
path: 'C:\YOUR\PATH\TO\python.exe
arguments:
- 'command.py'
- etc
workingDirectoryPath: 'C:\PATH\TO\FOLDER\FROM\STEP\2'
maxParallelProcesses: 1 #must be one, please do not change
Make sure to add the command.py
file, you may also add other arguments such as a model.rvt
if you plan on uploading
models via the app.
Should you not have access to the worker but you do require access to the code that will be executed in Revit, then it
is possible to add another file script.py
to the arguments. This will let you send the instructions to the worker
instead of already having them on the worker. This does however have two drawbacks, debugging is difficult (unless you
have access to the worker logs) and it will cost some memory on your application.
Step 4: Test the worker
Test the worker by starting it as an administrator, the worker should tell you that it is active and you can also check it in your browser. For more information on the worker status, check out software integrations.
Step 5: Add a script.py to the step 2 folder
script.py
will have all the instructions for pyRevit to perform within Revit.
It is also possible to add this to the arguments if you do not have Revit on your machine, this may be desirable if you
want to be able to edit the script later.