Execute the macro passed on the CAD System

Parameters

Macro (String) - The macro code to execute. This is CODE as a string and not direct code or a filename to code in a file.

Return Value

none

Remarks

This is synonymous with the same manually performed user action in the 3D environment.

Examples

Build code line by line to send as a macro ...

Dim mac as string = "Macro Code Line"                ' this is not a real macro code line, just an example
mac &= vbcrlf & "Second Code Line" ' example of appending new lines to build a macro code block
mac &= vbcrlf & "More Code Lines"                     ' repeat as needed to add more and more lines ...

' ...
CAD.RunMacro(mac)                                               ' execute the macro built inside the variable "mac"

More efficient way to build larger code ...

Dim mac As New System.Text.StringBuilder           ' generic object used to build large strings in .NET
mac.AppendLine("Code line 1")
mac.AppendLine("Code Line 2")
' ...
CAD.RunMacro(mac.ToString)                                 ' flushes the contents of the string builder to the command


Example code to repaint current active window

CAD.RunMacro("~ Command `ProCmdViewRepaint`;")