This page is my personal diary for exploring the API for Revit and Vasari. This page is as much a resource for me as I hope it will be for others.
Developing custom tools for Revit using the API can be a complicated endeavor. The program is quite complex and the development process is not nearly as straightforward as developing tools for more 'free geometry' modelers such as Rhino. Please see Jeremy Tammik's article titled BIM versus Free Geometry and Product Training for a more detailed explanation of the 'barriers to entry' in Revit API development.
This notebook attempts to remedy a few 'resource deficiencies' in learning and applying the Revit API in the context of a design workflow…
- Design-Related Techniques: Most API examples I have found on the web are related to model management. For designers interested in computation and automation, finding good design-related examples can be a frustrating experience. The examples here show how the Revit API can be used as a design tool specifically within family creation environments such as the conceptual mass.
- Vasari Implementation: Vasari is essentially a stripped down version of Revit with additional conceptual design and analysis capabilities (and it's free!). Vasari also features a version of the Revit API. The examples here will focus on Varsari's capabilities but most will be applicable in the full versions of Revit.
- RevitPythonShell-Based Examples: Not many examples exist for using the RevitPythonShell Add-In. The tool provides many iterative scripting capabilities similar to those found in other popular modeling tools such as Rhino. This makes the API much more accessible to designers and those in need of some quick automation!
My hope is that this will save designers time in being productive with the Revit API and perhaps contribute to the creation of a more serious 'scripting culture' around Revit and BIM tools in general….
This is still work in progress and I am learning new things every day. I am positive a few of you could teach me a thing or two… If you have any comments or suggestions please let me know! moc.liamg|hcra.rellimn#moc.liamg|hcra.rellimn
SharpDevelop is a free, open source integrated development environment (IDE) and is a great alternative to Microsoft Visual Studio environments. Visual Studio projects are also natively supported by SharpDevelop.
While you don't necessarily need an IDE for RevitPythonShell use, SharpDevelop supports IronPython so it is a great environment for testing IronPython code through RevitPythonShell and then continuing the development process for creating .NET plug-ins.
Python is also implemented inside of Dynamo. I have published some paneling and structure classes here: Python Surface Paneling Class
RevitPythonShell is a Revit Add-In created by Daren Thomas. The tool allows developers and designers to write Revit API commands using Iron Python. This allows for a much more fluid, iterative workflow akin to scripting environments in other programs.
Zach Kron has a nice blog post discussing the set-up of RevitPythonShell with Vasari.
The RevitPythonShell is now compatible with Vasari 2.5 and Revit 2012. Get the latest versions here...
|Basic Code Structure||Learn about the basic code set-up for use with RevitPythonShell|
|XYZ and Reference Points||XYZ and point variables are the building blocks for any geometry creation problem.|
|Planes and Sketch Planes||Examples for defining sketch planes for using in creating model curves and other geometry.|
|Model Curve Creation||Examples of how to create new model curves using two methods.|
|Form Creation||Examples for describing different types of forms available in the conceptual environment.|
|Divided Surfaces||Examples for creating divided surfaces and pattern systems available in the conceptual environment.|
|Families and Parameters||Examples of placing families and modifying parameters|
|Adaptive Components||An example for placing an adaptive component|
Object Oriented Programming
|Object Oriented Programming||Learn about structuring code for Object Oriented Programming with RevitPythonShell|
|Custom Form Creation Class||An example of using Object Oriented Programming to create custom 'form creation' methods within a class.|
|Using External Text Files||Learn about methods for reading and writing external text files such as CSV.|
|Using Excel Files||Learn about methods for reading and writing data with Excel files.|
|The Fun Stuff|
|Randomization||Examples for using randomization to make forms and change parameters.|
|Parametric Forms||Examples of creating parametric surfaces and forms.|
LinksInvaluable links on this subject no particular order….
|RevitPythonShell Development||The Google Code page for RevitPythonShell by Daren Thomas|
|The Building Coder||Jeremy Tammik's Autodesk blog which extensively covers the Revit API and its uses.|
|RevitNet||Don Rudder's blog about the Revit API and the Vasari SDK.|
|Buildz||Zach Kron's blog about advanced uses of Revit and Vasari conceptual modeling.|
The code and examples on Nathan's Revit API Notebook pages are free software: you can redistribute them and/or modify them 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.