Add Existing Files to Macro Project in IDE
Return to the Revit VSTA IDE. In the Project Explorer (to continue this example) right-click on the folder
you created for your macro, and select Add
In the resulting IDE dialog, browse to the corresponding subfolder on the file system, under your Revit
installation folder, select all the files that comprise the macro, and click Add.
In this example, the refreshed IDE Project Explorer for
Create and Build Your Macro
Once the files have been added to your project, you can write a method that runs the macro. For example,
in C#:
/// Sample Rooms test
public void RunSampleRooms()
{
SamplesRoom sample = new SamplesRoom(this);
sample.Run();
}
Be sure to add a using directive for the macro's namespace. For example:
using Revit.SDK.Samples.Rooms.CS;
Save the project and then click Build from the IDE toolbar menu. In Revit, launch Macro Manager and select
your macro from the categorized list. On the SDK, the Rooms sample may be coded as a Document-level
macro. In which case, code changes would be needed to run it in the
section's screens.
When run from Macro Manager, the macro collects data from your model and presents summary information.
Here is an example:
Existing Item from the menu. For example:
contains:
AppCSharp
AppCSharp
Integrating Macros into Revit VSTA | 1359
project shown in this
Need help?
Do you have a question about the 24000-000000-9860 - Revit Architecture - PC and is the answer not in the manual?