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
Содержание 24000-000000-9860 - Revit Architecture - PC
Страница 1: ...Revit Architecture 2009 User s Guide April 2008 240A1 050000 PM02A ...
Страница 4: ......
Страница 56: ...18 ...
Страница 116: ...78 Chapter 3 Revit Essentials ...
Страница 172: ...134 Chapter 4 ProjectViews ...
Страница 178: ...Schedule with Grid Lines Schedule with Grid Lines and an Outline 140 Chapter 4 ProjectViews ...
Страница 352: ...Defining the first scale vector Defining the second scale vector 314 Chapter 7 Editing Elements ...
Страница 554: ...516 ...
Страница 739: ...Curtain wall Curtain Grid Curtain Walls Curtain Grids and Mullions 701 ...
Страница 898: ...Pile caps with multiple piles Rectangular and triangular pile caps 860 Chapter 12 Working with Structural Components ...
Страница 1004: ...966 ...
Страница 1136: ...1098 ...
Страница 1226: ...1188 ...
Страница 1250: ...1212 ...
Страница 1276: ...1238 Chapter 20 Design Options ...
Страница 1310: ...1272 ...
Страница 1366: ...1328 ...
Страница 1406: ...1368 ...