RevitPythonWrapper has come a long way since it first started in October of 2016.
For those unfamiliar with it, rpw is an IronPython library to help you write concise and pythonic Revit API Code. You can read the full documentation here.
The library started as a way of consolidating a few functions and classes I found myself reusing across several python scripts. Soon after, it began to grow and to take on more responsibilities such as handling all the import code and dealing the application and document handlers. Fast forward 8 months, it has matured into a sizeable code base with a wide variety of API wrappers and other useful tools.
The latest organization seen in 1.0.0 was triggered by a collaboration with Ehsan Iran-Nejad, the mastermind behind pyRevit. Ehsan had shown interest in including rpw in pyRevit. As a way of getting to know the library, he created a fork of it, organized in a slightly different way and added a few new classes. This latest version is the result of merging some of his ideas and discussions we had back into the repository. I took this opportunity to re-write many sections that had become unpleasantly complex or hard to hard to maintain, and also to add a few new modules. Some of the new tools added in this version are explained below.
Note: As of today, rpw is included by default in pyRevit 4.4
When working with Python outside of Revit (CPython) I always use python’s built-in debugger – the pdb. Pdb allows you to set a breakpoint and inspect the stack using an interactive console.
This is done directly on the command line, no IDE required. Unfortunately, I was never able to the pdb to run within the Revit environment. Console solves this problem by launching an interactive REPL shell (Read-Eval-Print-Loop) written from the ground up using a Wpf Textbox. The key is, when Console is launched, it uses python’s inspect library to step back one frame and capture the variables, allowing you to inspect and debug your code interactively. More info here.
Another new addition is FlexForm – a simple class that creates a flexible a wpf window. Combined with a few wpf control wrappers, you can easily create custom multi-input forms on the go with just a few lines.
You can see some examples here.