Use the Debug option to test, debug, step-through, track, and edit variable values in your macros.
To display the Macro Debugger dialog:
The left pane shows the macro you are debugging. The right pane shows the variable assignment at that point in the macro.
When you debug a macro, you tend to be interested in a particular portion of the code (either to understand how it works, or why it is not working). To look at this portion of code:
The Macro Debugger dialog contains the following:
Execute — Click to run the macro from the current position to either a breakpoint or the end of the macro. If you pause a macro, click to resume the macro execution.
Pause — Click to insert a temporary breakpoint after you execute the current line.
Stop — Click to stop the macro execution and return the macro to the start.
When you use the Step commands, the debugger executes the current line only and then waits for your next instruction. This enables you to see the effect of a macro statement or command and so helps you to understand the macro. The variable values assigned at this point of the macro are displayed in the right-hand pane.
Step into — Click to execute the current line. If the current line is a macro function call, then the debugger pauses before executing the first line of the function. This enables you to check a function.
Step over — Click to execute the current line. If the current line is a macro function call, then the debugger pauses after the entire function is executed. This is useful when you know the function works, so you do not need to look at it in detail, but you want the results from it.
Step out — Click to execute the current line and all subsequent lines within the block. When the block of commands ends, PowerMill waits for further debugger interaction.
Skip next line — Click to skip the next line without executing the command. This is useful when you know a command executes successfully but it takes a long time to calculate; for example, calculating a toolpath. However, skipping the next line can be dangerous because future commands may require the output from this command.
Add breakpoint — Click to place a breakpoint at the start of the selected line. A breakpoint forces the macro to stop at this point. The variable values assigned at this point of the macro are displayed in the right-hand pane. You can insert multiple breakpoints in your macro.
For example, if you put a breakpoint at the end of a loop, you can examine the variable values and see how they change with each iteration. This enables you to find out if the macro is behaving as you'd expect.
Another example is: if you put a breakpoint at the beginning of a function, you can see which variables and parameters are passed to the function.
Delete breakpoint — Click to remove a breakpoint from the selected line.
Delete all breakpoints — Click to remove all breakpoints from the macro.
Reload macro — Click to stop the current execution of the macro and reload the macro file. This is useful when you have fixed a problem with your macro and want to run it again to check it.
To edit a variable assignment: