AddModule Method


Adds a MacroModule to the application or document.

Namespace: Autodesk.Revit.UI.Macros
Assembly: RevitAPIUIMacros (in RevitAPIUIMacros.dll) Version: 24.0.0.0 (24.0.0.0)
Since:  2014

Syntax

C#
public MacroModule AddModule(
	ModuleSettings moduleSettings,
	MacroEnvironment environment
)
Visual Basic
Public Function AddModule ( _
	moduleSettings As ModuleSettings, _
	environment As MacroEnvironment _
) As MacroModule
Visual C++
public:
MacroModule^ AddModule(
	ModuleSettings^ moduleSettings, 
	MacroEnvironment environment
)

Parameters

moduleSettings
Type: Autodesk.Revit.DB.MacrosModuleSettings
The module settings.
environment
Type: Autodesk.Revit.DB.MacrosMacroEnvironment
The module environment.

Return Value

The new module.

Remarks

Note: document-level modules will not be saved to the document until the document is saved. Thus this operation is not undoable and does not require an open transaction even for document-level modules.

Exceptions

ExceptionCondition
Autodesk.Revit.ExceptionsArgumentException Thrown when the module name is duplicated with the existing one, or the name is too long, or the name contains invalid identifier(s), such as include "#", "%", ... and key words in C# or VB.NET.
Autodesk.Revit.ExceptionsArgumentNullException A non-optional argument was null
Autodesk.Revit.ExceptionsArgumentOutOfRangeException A value passed for an enumeration argument is not a member of that enumeration

See Also