Revit Task Dialog in Python

Revit Task Dialogs are invaluable for displaying messages and collecting finite user input. To make them easier to use in Python code, I have added a TaskDialog wrapper class to RevitPythonWrapper.

The first step I went through, was to read through code samples that use the class – Spiderinnet had great comprehensive examples: TaskDialog of Revit API – 1: A Comprehensive TaskDialog Example. Although they were all all in C#, once one gets used to reading C# it’s very easy to convert it to Python.

Next, I wrote code a some code from scratch to try to get a detailed understanding of how the TaskDialog and related API classes work (TaskDialog, TaskDialogResult,   TaskDialogCommandLinkId, etc). The result was the snippet below – a minimal yet comprehensive code sample that demonstrates all features of the TaskDialog Class.  [The code below has also been added to revitapidocs.com/code/.]

And lastly, I refactored the snippet to convert it into a reusable Class, and to take…

Read more