Installation¶
pyRevit¶
RevitPythonWrapper now ships with pyRevit. Just import rpw:
>>> from rpw import revit, db, ui
RevitPythonShell¶
Revit Python Wrapper works well with the RevitPythonShell
- Clone the RevitPythonWrapper Repository
- Add the the repository directory to RevitPythonShell’s search path
Tip
Add rpw to RevitPythonShell’s Search Path to have it pre-loaded every you start it.


Dynamo¶
RevitPythonWrapper is distributed through Dynamo’s Package Manager ships with everything you need, but you can also download it your self and import it as you would with any other Python modules.
The package includes a Node that helps you find the location of the RPW library (see image below).
Once you have the location, just add it to your sys.path
, and you should be able to import the library.
You can always manually add the library path; the node is only included for convenience.
For more details and question about this please see this post.
Note
Be sure the checkout the RPW_GetStarted.dyn
file that is installed with the Package
for practical examples.
The file will typically be saved in:
.../Dynamo/1.X/packages/RevitPythonWrapper/extra/RPW_GetStarted.dyn
Python Code Sample
>>> # USe RPW_GetFilePath to find Rpw's path and plugged it into IN[0]
>>> # or append path manually
>>> import sys
>>> rpw_path = IN[0] # IN[0] is a path to rpw.zip or the parent folder where rpw is located
>>> sys.path.append(rpw_path)
>>> from rpw import db, ui
>>> walls = db.Collector(of_class='Wall').elements
>>> ui.forms.Alert('Found {} walls'.format(len(walls)))


Note
Images below might be outdated