Revit Macro API
Standard Revit API
Feature or Capability
See the MyFirstMacro* examples in this topic.
Not supported.
API external applications can create
menus and toolbars for each extern-
Menus and toolbars
al command through an external
application.
Migrating SDK Samples to Revit VSTA
The Revit SDK contains two samples folders:
\Revit <release> SDK\Samples\...
\Revit <release> SDK\VSTA Samples\...
The programs in the SDK's
\Samples\
folder use the standard Revit API. We refer to these samples as the
"SDK sample code," as distinct from the "Revit VSTA samples."
If you want to use the SDK sample code for macros, modifications are needed. Follow the steps in this section.
For a programming language, we will show C# examples. However these instructions also apply to the
VB.NET versions of the SDK samples.
Initial Steps
The initial steps to migrate standard API samples from the SDK into your Revit VSTA macro project are
similar to the section
Integrating Macros into Revit VSTA
on page 1355. Except instead of copying files from
the SDK's \VSTA Samples\<sample-name>\... folders, you will copy files from the SDK's
\Samples\<sample-name>\... folders.
To review, the steps are:
1
In the IDE, add required references
2
In the IDE, create folders for the SDK samples you want to migrate
3
In Windows Explorer, copy the SDK standard API samples’ files to the corresponding file system folders
4
In the IDE, add existing files to the macro project
Update the SDK Samples’ Code
In the Revit VSTA IDE, the
IExternalCommand
interface is not available or used. In the SDK standard API
sample code, you must update the class that inherits from this interface:
■
Remove the method parameters and the return of the
Execute
method
■
Update other code related to
ExternalCommandData
Code Example Before Edits
The following code snippet is from a program that uses the standard Revit API:
1362 | Chapter 24 Creating Macros with Revit VSTA
Summary of Contents for 24000-000000-9860 - Revit Architecture - PC
Page 1: ...Revit Architecture 2009 User s Guide April 2008 240A1 050000 PM02A ...
Page 4: ......
Page 56: ...18 ...
Page 116: ...78 Chapter 3 Revit Essentials ...
Page 172: ...134 Chapter 4 ProjectViews ...
Page 178: ...Schedule with Grid Lines Schedule with Grid Lines and an Outline 140 Chapter 4 ProjectViews ...
Page 554: ...516 ...
Page 739: ...Curtain wall Curtain Grid Curtain Walls Curtain Grids and Mullions 701 ...
Page 1004: ...966 ...
Page 1136: ...1098 ...
Page 1226: ...1188 ...
Page 1250: ...1212 ...
Page 1276: ...1238 Chapter 20 Design Options ...
Page 1310: ...1272 ...
Page 1366: ...1328 ...
Page 1406: ...1368 ...