Thursday, October 25, 2012

Revit API Programming Templates 1

As I have promised I am uploading Revit API programming templates. For this post I am uploading two templates.

First one is an empty template which can be used a s base for any type of Revit API programming. You can use this template and copy your code inside the provided spaces and build your code. This template has all the required preparations for Revit API programming that we have talked about and you do not need to do any preparation. Just copy your code and build it and enjoy the result. 


The second template is RoomDoorWindow-Revit 2013 template (RoomDoorWindow-Revit 2012 template for those who use Revit 2012) that helps you to get parameters of Room, Window, and Door in Revit using API programming and make some calculations and change the value of the parameters.

Since some people had problems with the second template, I have edited this post and put two different versions RoomDoorWindow template for those who use Revit-2013 and Revit-2012. The difference between these two templates is on GET ELEMENT command. In Revit 2012 you need to use doc.get_Element(id) but in Revit 2013 you have to use doc.GetElement(id). So you will have line of code like the following:


Revit 2012  ==>   FamilyInstance doorInstance = doc.get_Element(id) as FamilyInstance;

Revit 2013  ==>  FamilyInstance doorInstance = doc.GetElement(id) as FamilyInstance;

Please put a comment if you have any problem running your code.
 

No comments:

Post a Comment