Revit API Differences
Quick Reference
The following table summarizes differences between the standard Revit API and the Revit Macro API.
Revit Macro API
Standard Revit API
Feature or Capability
Declare a public method with no parameters and void
return type in the
ThisApplication
or
ThisDocu-
ment
class.
Must implement
IExternalCom-
mand
interface and its
Execute
method.
Declaration
The
this
keyword in C# points to the Application object
for Application-level macros, and points to the Docu-
Access the
Application
object
through
externalCommand-
Data.Application
Application
object
ment object for Document-level macros. (Use the
Me
keyword in VB.NET). For Document-level macros,
this.Application
points to the Application object
(
Me.Application
in VB.NET).
The Revit API objects that can be created by
new
oper-
ator in external commands cannot be created by
new
Some Revit API objects can be cre-
ated directly by
new
operator, such
as
Geometry.XYZ
. For example:
XYZ a = new XYZ(1.0, 0.0,
0.0)
new
operator
operator in macros. Instead, they must be created by
Application.Create.NewXXX
methods. For ex-
ample, in a C# Document-level macro:
XYZ a = this.Application.Cre-
ate.NewXYZ(1.0, 0.0, 0.0);
In a VB.NET Document-level macro:
Dim a As Autodesk.Revit.Geometry.XYZ =
Me.Application.Create.NewXYZ(1.0, 0.0,
0.0)
Revit API Differences | 1361
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 ...