AddMacro Method


Adds a macro to the module.

Namespace: Autodesk.Revit.DB.Macros
Assembly: RevitAPIMacros (in RevitAPIMacros.dll) Version: 23.0.0.0 (23.1.0.0)
Since: 2014

Syntax

C#
public Macro AddMacro(
	string name,
	string description,
	string code
)
Visual Basic
Public Function AddMacro ( _
	name As String, _
	description As String, _
	code As String _
) As Macro
Visual C++
public:
Macro^ AddMacro(
	String^ name, 
	String^ description, 
	String^ code
)

Parameters

name
Type: System String
The macro name.
description
Type: System String
The description.
code
Type: System String
The code string, which should be the lines between the main bounding brackets of a method.

Return Value

The new macro.

Exceptions

Exception Condition
Autodesk.Revit.Exceptions ArgumentNullException A non-optional argument was null
Autodesk.Revit.Exceptions InvalidOperationException Cannot add the Macro due to no permission.

See Also

ArchiLabs Desktop

Put AI to work inside Revit.

Give Desktop your instructions and project files to build Revit families, update model elements, and create views and schedules. Works directly in Revit and AutoCAD.

Explore Desktop →