This is the most recent version of Tekla Open API.
For older versions, please visit Tekla Warehouse.

OperationRunMacro Method

Starts a macro with the given name. Throws an exception if the file is not found.

Macros are saved as *.cs files in the folder defined with the XS_MACRO_DIRECTORY variable.

It is possible to run drawing macros using relative paths.

See Tekla Structures Help for more information about macros.

Namespace:  Tekla.Structures.Model.Operations
Assembly:  Tekla.Structures.Model (in Tekla.Structures.Model.dll) Version: 2019.0.0.0 (2019.0.0.0)
Syntax
public static bool RunMacro(
	string FileName
)

Parameters

FileName
Type: SystemString
The name of the macro to start.

Return Value

Type: Boolean
True if the macro existed.
Examples
using Tekla.Structures.Model.Operations;

public class Example
{
       public void Example1()
       {
           Operation.RunMacro("MyModelingMacro.cs");
           Operation.RunMacro(@"..\drawings\MyDrawingMacro.cs");
       }
}
See Also