Presentation is loading. Please wait.

Presentation is loading. Please wait.

Diary of a Wimpy BIM Manager: Tales of In-House Revit® API Development for Architects Iffat Mai Practice Application Development Manager Perkins+Will.

Similar presentations


Presentation on theme: "Diary of a Wimpy BIM Manager: Tales of In-House Revit® API Development for Architects Iffat Mai Practice Application Development Manager Perkins+Will."— Presentation transcript:

1 Diary of a Wimpy BIM Manager: Tales of In-House Revit® API Development for Architects
Iffat Mai Practice Application Development Manager Perkins+Will

2 Thanks to:

3 Poll Discipline Revit Experience Revit API Skill Architect Engineer
Programmer Other Revit Experience Very experienced Quite experienced Not experienced Revit API Skill

4 Overview Introduction Overview of Revit API Tool Development Process
Demo of sample tools Walk through some codes Resources

5 Objective Share in-house Revit API tool development process
Do it in-house or out-source the development work Inspire BIM Manager to take on the Revit API challenge

6 Background Architectural Degree from MIT
Worked with MIT media lab (have some programming skills) Twenty plus years of experience of working in the Architectural field in NYC. Started as an Arris user (Unix)  AutoCAD user (DOS, Windows)  CAD Manager  IT Manager  Digital Design Manager  BIM Manager  Research Manager/Application Developer

7 Perkins + Will and Autodesk Revit
Began implementation in 2004 Revit Architecture is our Core BIM Application Team of 24+ Design Applications Professionals supporting Projects 850+ Staff trained in-house Over 180 projects are completed or underway Committed to Use BIM Methods for 100% of our Projects

8

9 Kempinski Hotel + Residences

10 Revit Experience Familiar with Autodesk® Revit® Architecture
Have an architectural design background Trained and supported architectural teams to use Autodesk® Revit® Architecture Began developing with API in 2007 I’m an Autodesk® Revit® BIM Manager who learned API programming

11 Why Customize Revit? Automate repetitive work
Processing large quantity of data Facilitate import & export Synchronize data

12 What is Revit API? API = Application Programming Interface

13 AutoCAD API vs. Revit API
Scripts Lisp ObjectARX ActiveX AutoCAD.Net .Net VSTA

14 Revit API History No API Revit 5 Revit 6 No API Revit 7 No API
First Public API for Building and Structure Revit 8 More Element Creation Added Revit 9 Revit Architecture 2008 Revit API SDK released Revit Architecture 2009 VSTA Released. API for MEP added Autodesk Revit Architecture 2010 Developer’s Guide released RevitAPI.dll and RevitAPIUI.dll split Autodesk Revit Architecture 2011

15 Revit API Namespace Changes
Revit 2011 divides the API three primary namespaces: Autodesk.Revit.ApplicationServices Classes accessing application settings and options Autodesk.Revit.DB Classes accessing file data Autodesk.Revit.UI Classes accessing or customizing the user interface

16 Revit API Namespaces Revit API Platform Application Services Database
(Revit.ApplicationServices) Database (Revit.DB) User Interface (Revit.UI) Structure (Revit.DB.Structure) Architecture (Revit.DB.Architecture) MEP (Revit.DB.Mechanical) (Revit.DB.Electrical ) (Revit.DB.Plumbing)

17 1

18 .Net vs. VSTA .Net VSTA Editor: Microsoft Visual Studio
DECAF Editor: Microsoft Visual Studio Program language VB.net C# Create external tools/App Exist outside of Revit Use across many Revit Projects Editor: Built-in inside Revit Program language VB.net C# Create Macro Exist inside of Revit Use only in the Projects it was created or loaded in

19 2

20 Microsoft Visual Studio
.Net Framework 3.5 Editor(IDE)  Microsoft Visual Studio (

21 3

22 Parlez Vous C Sharp? Language Options:
VB.net C++ Most sample codes in SDK are written in C# VB.net is much more readable VB.net is not case sensitive. VB.net - Intellisense can automatically corrects Keywords and variable names Use web translator to convert C# to VB ( Both compiles and runs at the same speed You can reference .dll written in other language.

23 VB.NET vs. C# VB.NET C# Imports System Namespace Hello    Class HelloWorld       Overloads Shared Sub Main(ByVal args() As String)          Dim name As String = "VB.NET"   'See if an argument was passed from the command line           If args.Length = 1 Then name = args(0)           Console.WriteLine("Hello, " & name & "!")       End Sub    End Class End Namespace using System; namespace Hello {    public class HelloWorld {       public static void Main(string[] args) {          string name = "C#"; // See if an argument was passed from the command line          if (args.Length == 1)             name = args[0];          Console.WriteLine("Hello, " + name + "!");       }    } } (Source:

24 4

25 Autodesk Revit SDK SDK = Software Development ToolKit
Install from Autodesk Revit Installation disk Download from Autodesk Developer Center .NET code samples and documentation Useful tools

26 Autodesk Revit SDK Add-In Manager RevitLookup RevitAPI.chm
Revit 2011 Developer Guide.pdf

27 Training DevTV: Introduction to Revit 2011 Programming - Part 1 - New!
DevTV: Introduction to Revit 2011 Programming – Part 2 - New! %20part%202.html

28 Microsoft Visual Studio
.NET Microsoft Visual Studio VB.Net Revit API SDK

29 Tool Development Process
Documentation Coding Training Feasibility Study Tool Proposal Debugging Maintenance Specification Testing Deployment

30 Tool Proposal Welcome ideas from all users
Showcase your tools to encourage more ideas. End user – task specific tools Design Application Manager – common issue tools Technical Directors Quality control Standard enforcement Process enhancement

31 Feasibility Study Can you do it with Revit API?
How long will it take to do it? What is my ROI?

32 Can you do it using Revit API?
Can the steps be done manually via the User Interface? Use Revit LookUp tool to trace the object Check with RevitAPI.CHM reference to see what properties and methods are available Review the Revit API Developer’s Guide. Look at the SDK sample folder for similar application Search Revit API blogs and Forum on the internet Verify with ADN support that it can be done

33 How long will it take to develop?
How familiar are you with Revit API? How good are you with .Net programming Is the logic and task very straight forward? Is there an existing sample application that you can modify? Make your best estimate Then multiply by 3x

34 What is my ROI? How often will they use the tool on this project?
One time only Only during one phase Used through out the entire project Can this tool be used on other projects? Not at all If parameter and variable are customizable Yes, all the time!

35 Specification Clearly define input and output requirement
Describe in details all the functions the application will have. Work out the logics of how the tool will flow Sketch out flow chart for visual overview Cartoon sets of the input and output forms and reports

36 Coding, Debugging & Testing
Use Revit API template to start Use SDK sample application as a base Set Microsoft Visual Studio Debug property to start Revit Add option to automatically load test file Use small test file for initial testing Use copies of actual project files for later testing Solicit project team members to test the application Implement feedback to improve design and performance

37 Documentation, Training & Maintenance
Add comments inside the codes for documentation Create user guide documentation Add Help button that will take the user directly to the documentation Provide video snippet for self-guided training Maintenance for version upgrade is required for every new Revit API release.

38 Deployment Consolidate all tools into one folder
Create a Ribbon ExternalApplication that contains all the tools as buttons. Copy the DLL folder to the local machines Maintain subfolder for version control Copy .addin manifest file to designated Revit addins folder Keep icon files in a separate folder

39 ExternalApplication Ribbon
Create Ribbon file to combine all commands Design Ribbon icons Read Autodesk Icon Guidelines.pdf Check out Ribbon sample file in the SDK

40 SDK Samples Category Basics Geometry Parameters Elements Families
Materials Annotation Views Rooms/Spaces Data Exchange MEP Structure

41 Import Export MissinG Tools Demo Dwg Data Manipulation Tools
Design Tools MissinG Dwg Utility Tools Batch Tools

42 Data Manipulation Tools
Import Export Export Drawing List to Excel Import updates from Excel Add new sheets from Excel

43 Design Tool SDK – Sample>Massing MeasurePanelArea

44 Measure Panel Area (Update)
protected IList<Element> GetPanels() {   FilteredElementCollector collector     = new FilteredElementCollector( m_uiDoc.Document);   BuiltInCategory bic = BuiltInCategory.OST_CurtainWallPanels;    collector.OfClass( typeof( FamilyInstance ) ).OfCategory( bic);     IList<Element> panels = collector.ToElements();   return panels; } Source:

45 Batch Tools Door Renumber Renumber door number to match room number

46 Utility Tool – Find Dwg MissinG Dwg

47 Find Dwg Problem: Solution: Dwg can be linked and imported
Often Dwg files can’t be found after it is inserted I want to be able to find it and delete it if I want to. Solution: Filter elements till I find DWG Present them in a list Give user the option to View and Delete

48 Revit LookUp Tool RvtMgdDbg  Revit Lookup

49 Anatomy of Find Dwg Tool
Command IExternalCommand CommandData CommandData Filter DwgList (Form) Dwg Obj Array

50 Anatomy of Find Dwg Tool
Command.vb DwgList.vb (Form) DwgObj.vb

51 Reference Revit Assemblies
Revit required assemblies: C:\Program Files\Autodesk\Revit Architecture 2011\Program\RevitAPI.dll C:\Program Files\Autodesk\Revit Architecture 2011\Program\RevitAPIUI.dll Set property of the dll to: Copy Local = False Specific Version = True

52 Implements IExternalCommand
Command.vb Imports Imports Autodesk.Revit Imports Autodesk.Revit.UI Imports System.Windows.Forms <Autodesk.Revit.Attributes.Transaction(Autodesk.Revit.Attributes.TransactionMode.Automatic)> _ <Autodesk.Revit.Attributes.Regeneration(Autodesk.Revit.Attributes.RegenerationOption.Automatic)> _ <Autodesk.Revit.Attributes.Journaling(Autodesk.Revit.Attributes.JournalingMode.NoCommandData)> _ Public Class Command Implements IExternalCommand Private m_revit As Autodesk.Revit.UI.UIApplication Public Function Execute(ByVal commandData As Autodesk.Revit.UI.ExternalCommandData, _ ByRef message As String, _ ByVal elements As Autodesk.Revit.DB.ElementSet) _ As Autodesk.Revit.UI.Result Implements Autodesk.Revit.UI.IExternalCommand.Execute m_revit = commandData.Application Dim displayForm As New DwgList(commandData) Using (displayForm) If displayForm.ShowDialog() <> DialogResult.OK Then Return Autodesk.Revit.UI.Result.Cancelled End If End Using displayForm.Dispose() Return Autodesk.Revit.UI.Result.Succeeded End Function Protected Overrides Sub Finalize() MyBase.Finalize() End Sub End Class Attributes Command Class Begin Implements IExternalCommand Function Execute calls DwgListForm Sub Finalize Command Class End

53 IExternalCommand Implements IExternalCommand Private m_revit As Autodesk.Revit.UI.UIApplication Public Function Execute(ByVal commandData As Autodesk.Revit.UI.ExternalCommandData, _ ByRef message As String, _ ByVal elements As Autodesk.Revit.DB.ElementSet) _ As Autodesk.Revit.UI.Result Implements Autodesk.Revit.UI.IExternalCommand.Execute m_revit = commandData.Application Dim displayForm As New DwgList(commandData) Using (displayForm) If displayForm.ShowDialog() <> DialogResult.OK Then Return Autodesk.Revit.UI.Result.Cancelled End If End Using displayForm.Dispose() Return Autodesk.Revit.UI.Result.Succeeded End Function

54 Anatomy of Dwg Obj Tool Name ElementID Dwg Obj Type ViewType BaseLevel

55 DwgList Class Public Sub New(ByVal commandData As ExternalCommandData)
Public Class DwgList 'a reference to the external command data. Private m_commandData As ExternalCommandData ''' <summary> ''' Constructor ''' </summary> ''' <param name="commandData">the external command data</param> Public Sub New(ByVal commandData As ExternalCommandData) MyBase.New() InitializeComponent() m_commandData = commandData Initialize() End Sub

56 Filter Dim ImportInstanceFilter As New ElementClassFilter(GetType(DB.ImportInstance)) iter = New FilteredElementCollector(doc)_ .WherePasses(ImportInstanceFilter)_ .GetElementIterator()

57 Looping (Do While…Loop)
'Move to the first instance symbol iter.Reset() 'Create a array of DwgObjList Do While iter.MoveNext If (Not (iter.Current) Is Nothing) Then sym = iter.Current sym_name = sym.Parameter(ImpSymName).AsString ins_id = sym.Id ins_size = sym.Parameters.Size parByName = iter.Current.Parameter(csParamToFind) Is2D = iter.Current.Parameter(csParam2D) Linked = sym.IsLinked LinkedType = "N.A." viewname = "N.A." baselevel = "N.A."

58 Creating DwgObj Array Name ElementID Dwg Obj Type ViewType BaseLevel
DwgObjList.Add(New DwgObj(sym_name, ins_id, LinkedType, viewname, baselevel)) Name ElementID Dwg Obj Type ViewType BaseLevel

59 Tool Deployment Compile .dll Create .addin manifest files
Pushout the dll and .addin files to local machines Or Use Add in Manager to load the external tool manually

60 Register .addin Manifest file
<?xml version="1.0" encoding="utf-8"?> <RevitAddIns> <AddIn Type="Command"> <Text>$projectname$</Text> <Description>Some description for $projectname$</Description> <Assembly>$destinationdirectory$\$safeprojectname$.dll</Assembly> <FullClassName>$safeprojectname$.Commands</FullClassName> <ClientId>$guid1$</ClientId> </AddIn> </RevitAddIns>

61 GUID GUID = Globally Unique Identifier

62 Addin File Revit requires the add-in to be registered BEFORE it starts
Open the FindDwg.addin file Edit the <Assembly> to reflect the actual location of .dll Copy the .dll to one of the following locations: - For the current Windows User only %APPDATA%\Autodesk\REVIT\Addins\2011 - For all users %ALLUSERSPROFILE%\Autodesk\REVIT\Addins\2011 For Windows XP – C:\Documents and Settings\All Users\ApplicationData\Autodesk\Revit\Addins\2011\ For Vista/Windows 7 – C:\ProgramData\Autodesk\Revit\Addins\2011\

63 How to run the Tool? Go to Addin Tab > External Commands dropdown,
select “FindDwg” Or Create a custom Application with a Ribbon button for the command

64 Blogs Bolt Out Of The Red – Guy Robinson - http://redbolts.com/blog/
Revit Programming – Ed Pitt - programmer.blogspot.com/ The Building Coder – Jeremy Tammik - CAD Application Development – Matt Mason - Rod Howarth – Rod Howarth -

65 Revit Resource Guide Revit Resource Guide – by Rod Howarth
( free-download.html)

66 Summary Knowing Revit API gives you an edge over your competition
Learning Revit API has become a lot easier than ever before To do or not to do (in-house vs. out-sourcing) ? Give yourself an early Holiday present – Learn Revit API!

67 Please Complete the Survey!
Q & A

68 Autodesk [and other] are registered trademarks or trademarks of Autodesk, Inc., and/or its subsidiaries and/or affiliates in the USA and/or other countries. All other brand names, product names, or trademarks belong to their respective holders. Autodesk reserves the right to alter product and services offerings, and specifications and pricing at any time without notice, and is not responsible for typographical or graphical errors that may appear in this document. © 2010 Autodesk, Inc. All rights reserved.


Download ppt "Diary of a Wimpy BIM Manager: Tales of In-House Revit® API Development for Architects Iffat Mai Practice Application Development Manager Perkins+Will."

Similar presentations


Ads by Google