Presentation is loading. Please wait.

Presentation is loading. Please wait.

TM Getting Started with the Revit API Kristian Parsons Westfield Design & Construction.

Similar presentations


Presentation on theme: "TM Getting Started with the Revit API Kristian Parsons Westfield Design & Construction."— Presentation transcript:

1 TM Getting Started with the Revit API Kristian Parsons Westfield Design & Construction

2 Revit Technology Conference 2010 About the Speaker Currently software developer for Westfield Design. Customising Autodesk products for seven years. Customising Revit for over two years. Started out by teaching myself simple LISP routines. Self taught VBA, VB.NET and C#.

3 Revit Technology Conference 2010 Class Outline This class will cover the following topics: Glossary and Definitions Microsoft Visual C# Express Environment List of Add-Ons Examples: "Hello World" program "Text Case" program "Text Align" program Adding tools to the Ribbon

4 Revit Technology Conference 2010 Glossary and Definitions The following terms will be used in this class: Variable - An object that stores a value of a given type. Type - A storage format that can contain a specific range of values. Statement - A single instruction in the program. Function - A set of statements that perform a task. Class - A collection of related variables and functions. API - Application Programming Interface, an interface provided by Autodesk that allows custom software to interact with Revit. IDE - Integrated Development Environment, combines coding tools with debugging and compilation tools (such as Visual Studio). SDK - Software Development Kit, a set of tools, samples and documentation to assist with using the API.

5 Revit Technology Conference 2010 Microsoft Visual C# Express Environment Why C#? C# is one of the most commonly used programming languages. The majority of SDK samples are in C#. The majority of online examples are in C#. Visual C# Express Components: Toolbox Solution Explorer Properties Main Document Window

6 Revit Technology Conference 2010 Microsoft Visual C# Express Environment

7 Revit Technology Conference 2010 List of Add-Ons Annotation Tools: Text Case - changes the case of text objects to; Upper, Lower, Sentence or Title Case. Text Align - aligns selected text objects with another text object. Text Box - draws a bounding box around selected text objects. Find & Replace - standard find and replace tool. DWG Export - uses built in DWG Export, but applies company standard filenames and settings. Usage Log - writes all saves to a centralised database. Room Height Updater - calculates room height based on associated floor and ceiling objects and writes this value to a shared parameter. Family Browser - modeless dialog for searching and loading families.

8 Revit Technology Conference 2010 “Hello World” Example Basic steps: 1.Select "New Project..." from the "File" menu. 2.Select "Class Library" as the project type. 3.Add a reference to the "RevitAPI.dll" (set "Copy Local" to false). 4.Add a reference to "System.Windows.Forms". 5.Implement interface "IExternalCommand" (use intellisense). 6.Add a pop-up message saying "Hello World". 7.Return "Cancelled" since we do not edit the Revit model. 8.Update the "Revit.ini" file to include our add-on. 9.Debug the program.

9 Revit Technology Conference 2010 “Text Case” Example Basic steps: 1.Select "New Project..." from the "File" menu. 2.Select "Class Library" as the project type. 3.Add a reference to the "RevitAPI.dll" (set "Copy Local" to false). 4.Implement interface "IExternalCommand" (use intellisense). 5.Check if the user has already selected some textNote objects. a.If not, use a filter to select all textNote objects in the project. 6.Loop through all selected textNote objects changing the case to upper case. 7.Tell Revit that we changed something in the database. 8.Update the "Revit.ini" file to include our add-on. 9.Debug the program.

10 Revit Technology Conference 2010 “Align Text” Example Basic steps: 1.Select "New Project..." from the "File" menu. 2.Select "Class Library" as the project type. 3.Add a reference to the "RevitAPI.dll" (set "Copy Local" to false). 4.Implement interface "IExternalCommand" (use intellisense). 5.Make sure that the user has selected some textNote objects a.If not, throw an error. 6.Ask the user to select a single textNote object to align the others to. 7.Loop through the selected textNote objects changing their position to align with the selected one. 8.Tell Revit we have changed something in the database. 9.Update the "Revit.ini" file to include our add-on. 10.Debug the program.

11 Revit Technology Conference 2010 “Add Tools to Ribbon” Example Basic steps: 1.Select "New Project..." from the "File" menu. 2.Select "Class Library" as the project type. 3.Add a reference to the "RevitAPI.dll" (set "Copy Local" to false). 4.Implement interface "IExternalApplication" (use intellisense). 5.Add a new Ribbon panel. 6.Add two new buttons to the new panel using our text tools. 7.Update the "Revit.ini" file to include our add-on (and remove precvious entries). 8.Debug the program.

12 Revit Technology Conference 2010 Resources Online Blogs: Jeremy Tammik (http://thebuildingcoder.typepad.com/) Rod Howarth (http://blog.rodhowarth.com) Matt Mason (http://cadappdev.blogspot.com/) Discussion Groups: Autodesk (http://discussion.autodesk.com/forums/forum.jspa?forumID=160) AUGI (http://forums.augi.com/forumdisplay.php?f=218) ADN (not free) (http://adn.autodesk.com/) Offline SDK Samples RevitAPI.chm API Developers Guide

13 Revit Technology Conference 2010 Kristian Parsons Westfield Design & Construction Questions


Download ppt "TM Getting Started with the Revit API Kristian Parsons Westfield Design & Construction."

Similar presentations


Ads by Google