Autodesk Revit API
How-To and Examples
Jason Grant Harry Mattison
Payette Autodesk
Michael Coviello Jim Kochman
TRO Jung|Brannen KR+H Cabinet Makers
Jason Grant
BIM Specialist at Payette in Boston, MA.
Responsible for all aspects of BIM Implementation:
Training
Day to Day Support
Planning
User Group
Standards
Anything they throw at me!
Blogger – [Link]
Michael Coviello
BIM Specialist with TRO Jung|Brannen in Boston, MA
Responsible for :
Support with BIM standards
Project Setup
Training
Day to day support of Revit/CAD
Network deployments
Quick Survey
What is the Revit API?
Avatech Solutions - [Link] CADWERX - [Link]
Avatech’s Utilities for Revit is probably one of the first API examples RevPac 1.0 is a set of productivity tools with the initial focus on user
many Revit users have seen. These utilities include room renumber, grid interface enhancements.
select, change case, door mark update, Revit City content browser,
space update, earth connection and room phase copy.
CDV Systems, Inc. - [Link]
CDV Systems put together CodeBook V9 that links a project program
Revit Tools - [Link] and equipment requirements into Revit which is extremely beneficial for
Dr. Angela German created the following tools: to/from room tags, door healthcare projects.
swing, count elements, manage cad within Revit, update sheet
properties, dwg export, excel export, room/area import, renumber
elements and room parameters to doors. Emc2 Architects -
[Link]/revit_tools.html
Tools 4 Revit - [Link] Emc2 Architects created Keynote Manager which allows your keynotes
to be edited through an interface instead of through the text file.
Tools for Revit has many tools for the structural side of Revit
(Architecture and Structural) as well as a sort & mark tool for elements
and a tool that creates legends from different elements. If framing is Trelligence - [Link]
something that you use frequently, these tools would definitely help
Trelligence created Affinity for Revit which brings additional control and
increase productivity.
abilities to architectural programming in the early phases of a project and
the ability to analyze changes to the program in later phases of the
Ideate Explorer - [Link] project.
Ideate Explorer provides an easy way to search, quantify and select the
elements within your model or view. BIM jet - [Link]
BIM jet is a plug-in tool which allows for the transfer of BIM information
into Microsoft Project.
Revit TV - [Link]
Revit TV has two utilities: Drawing Manager which allows you to update
sheet information, various exports, drawing issues/revisions and Zach Kron - [Link]
parameter mapping. Shared Parameter Manager, currently in beta, Zach (Autodesk Employee) on his blog shared API created by Harry (API
allows you to update, manage and rename shared parameters. Guru at Autodesk) for use in conceptual massing where there is a direct
relationship between an object and the panels. Zach also built a batch
rendering utility which utilizes the Revit journaling and VB scripts.
StrucSoft Solutions - [Link]
Wall panelize tool for wood and light gauge metal construction that
recognizes openings and generates stud arrangements within walls.
AVATECH UTILITIES
“LIVE DEMO”
Software Development Kit (SDK)
Getting Started with the Revit [Link]
Revit 2010 API Developer [Link]
Revit API Class [Link]
[Link]
Ribbon design [Link]
Autodesk Icon [Link]
Add-In Manager
Install the Software Development Kit (SDK)
PROGRAMMING
LANGUAGE
C# [Link]
PROGRAMMING REQUIREMENTS
Created in a language compatible with Microsoft .NET
framework 3.5.
[Link] (Visual Basic) or C# language (Visual C#).
The decision between these languages is mostly a personal
preference. Most of the samples from the SDK are in C#.
If you have someone you work with, a friend or a colleague that may
be able to help you with a particular programming language, I would
select that one.
PROGRAMMING SOFTWARE
[Link]/exPress
[Link]/exPress
[Link] – Select #develop (SharpDevelop) VSTA within Revit
[Link]/visualstudio/en-us/[Link]
REVIT MANAGED DEBUG
( RvtMgdDbg )
“LIVE DEMO”
Start API work
and go from
STRUGGLE
to
SUCCESS
PLAN
your project
WHAT TYPE OF
COMMAND
PROGRAM?
APPLICATION
Predictability and Efficiency
BENEFICIAL
Not just to you –
but to the project team
Courtesy of Phil Read - HNTB
Predictability and Efficiency
BENEFICIAL
EFFICIENT
Implementation and changes
are fast and predictable
Courtesy of Phil Read - HNTB
Predictability and Efficiency
BENEFICIAL
EFFICIENT
ELEGANT
Understood by the team and
any last minutes new members
Courtesy of Phil Read - HNTB
Predictability and Efficiency
BENEFICIAL
EFFICIENT
ELEGANT
REPETITIVE
Can be used on
many projects
Courtesy of Phil Read - HNTB
Predictability and Efficiency
BENEFICIAL
EFFICIENT
ELEGANT
REPETITIVE
Courtesy of Phil Read - HNTB
REVIT INI FILE EDIT
“LIVE DEMO”
External Commands
ECCount=(#Total Commands)
This line should equal the total number of commands
ECClassName(# sequentially listed 1,2,3…)=[Link]
This is used to provide the name of your command object that supports the IExternalCommand interface.
ECAssembly(# sequentially listed 1,2,3…)= C:\(Tool Location)\[Link]
This is the location of the compiled .dll for use by Revit to run the command. The name of the .dll will match
the name of your project which is the AssemblyName as shown above in the ECClassName. The location can
be anywhere (local or network) as long as Revit can reconcile the location. Performance and access speed
should be considered when deciding on a location.
ECName(# sequentially listed 1,2,3…)= “ProjectName”
This name is what appears in the Revit Add-In Panel, External Tools menu.
ECDescription(# sequentially listed 1,2,3…)= “Extended Project Tool Name”
This description is displayed in the status bar when you mouse over the menu item.
External Applications
EACount=(#Total Commands)
This line should equal the total number of commands
EAClassName(# sequentially listed 1,2,3…)=[Link]
This is used to provide the name of your command object that supports the IExternalCommand
interface.
EAAssembly(# sequentially listed 1,2,3…)= C:\(Tool Location)\[Link]
This is the location of the compiled .dll for use by Revit to run the command. The name of the .dll
will match the name of your project which is the AssemblyName as shown above in the
ECClassName. The location can be anywhere (local or network) as long as Revit can reconcile the
location. Performance and access speed should be considered when deciding on a location.
EXAMPLES
What have we done?
Example 1 – Family Naming Convention
Purpose: Control family names when multiple people are
generating content.
Organization by CSI Major Division
DIVISION 01 GENERAL REQUIREMENTS/GENERAL DATA
DIVISION 02 SITE CONSTRUCTION
DIVISION 03 CONCRETE
DIVISION 04 MASONRY
DIVISION 05 METALS
DIVISION 06 WOOD AND PLASTICS
DIVISION 07 THERMAL AND MOISTURE PROTECTION
DIVISION 08 DOORS AND WINDOWS
DIVISION 09 FINISHES
DIVISION 10 SPECIALTIES
DIVISION 11 EQUIPMENT
DIVISION 12 FURNISHINGS
DIVISION 13 SPECIAL CONSTRUCTION
DIVISION 14 CONVEYING SYSTEMS
DIVISION 15 MECHANICAL
DIVISION 16 ELECTRICAL
Example 2 – STC & OpenSavePage
Purpose: Synchronize with Central cancels unless view is on Open/Save Page.
Example 2 – STC & OpenSavePage
This example utilizes C#
using System;
using [Link];
using [Link];
using [Link];
using [Link];
using [Link];
using [Link];
namespace [Link]
Example 2 – STC & OpenSavePage
{
public class OpenSaveCheck : IExternalApplication
public [Link]
OnShutdown(ControlledApplication application)
{
return [Link];
}
Example 2 – STC & OpenSavePage
public [Link] OnStartup(ControlledApplication application)
{
try
{
// Registering Events
[Link] += new EventHandler
<[Link]>
(app_SWC);
}
catch (Exception)
{
return [Link];
}
return [Link];
}
Example 2 – STC & OpenSavePage
public void app_SWC(object sender,
DocumentSynchronizingWithCentralEventArgs swcArgs)
{
Document doc = [Link];
[Link] m_view = [Link];
{
if (m_view.Name != "OpenSavePage")
{
//cancel the Synchronize With Central process
[Link] = true;
[Link]("Synchronize With Central Cancelled -
Activate the OpenSavePage to Synchronize With the Central
Database.");
}
Example – KR+H Cabinet Makers
[Link]
VIDEO
Example 3 – Door/Wall Fire Rating
Purpose: Set a doors fire rating based on the hosting walls Fire Rating
Rule of Thumb for a doors fire rating applies to ~95% of instances
Based on 2006 International Building Code®
Wall Fire Door Fire Rating
Rating
3 Hour 120 Minute
2 Hour 90 Minute
1 Hour 45 Minute
Smoke 20 Minute
Partition
Example 4
Create Sheets
Purpose: To reduce the time,
frustration and clicks required to
create numerous View Sheets.
Additional API Ideas
Add Fire Rating Line
Export Settings
Revisions on Sheets
Room Data Sheets (RDBLink)
All Elements in a Room
Room/Area Creation
Timer
Write Errors to Journal
Straighten lines off Axis
Get Room Dimensions
Reset Mark Values
Center Room Object Tag
Levels and Objects
AUGI Wish List 2009
Advanced Text Editor
Non-Vertical Walls
Select All Instances in View
Custom Elevation Tags
Print Window Options
Adjust Material Layer
Hide Element in All Views
Tagging Elements in Revit Link
Photo Backgrounds in Rendering
Automatic Consultant Sheets
AUGI Wish List 2009
Advanced Text Editor
Non-Vertical Walls
Select All Instances in View
Custom Elevation Tags
Print Window Options
Adjust Material Layer
Hide Element in All Views
Tagging Elements in Revit Link
Photo Backgrounds in Rendering
Automatic Consultant Sheets
Additional Ideas
Graphic Revision Schedule
Additional Resources
Blogs
The Building Coder by Jeremy Tammik
[Link]
Bolt out of the Red by Guy Robinson
[Link]
CAD Application Development by Matt Mason
[Link]
Revit Programming by Ed Pitt
[Link]
Forum
Autodesk Users Group International – Revit API Forum
[Link]
I will also be posting information and downloads on the AU site and at
[Link]
API FUN
HARRY MATTISON
EXAMPLES
“LIVE DEMO”
Announcements
Next Meeting
Mid March
Topics being Discussed
Revit 101
What’s New in 2011
Revit Templates
Revit in the Construction Process
Sharing Models among Consultants