Step Through the Code

AutoCAD ActiveX

 
Step Through the Code
 
 
 

Now run the macro, stepping through the code as it executes.

From the AutoCAD Tools menu, click Macro Macros. From the Macros dialog box select ThisDrawing.gardenpath and click Step Into.

The VBA IDE is brought to the front of the screen, with the first line of the gardenpath macro highlighted. The highlighted line is the line of code that is about to be executed. To execute the line, press F8. The next line of code to be executed is the gpuser subroutine. To step into the gpuser subroutine, press F8 again.

Now you are at the beginning of the gpuser routine. Press F8 one more time to highlight the first GetPoint method. Before you execute this line, open the Locals window by clicking View Locals Window. This window is displayed at the bottom of the VBA IDE. All the local variables and their values are displayed in the Locals window while the macro is executing.

Now press F8 to execute the GetPoint method. Notice that the highlight disappears and no new code is presented. This is because the GetPoint method is waiting for the user to enter a point in AutoCAD. Switch back to the AutoCAD window. You see the prompt you specified in the GetPoint call on the command line. Enter a point.

Control now returns to the macro. The line following the call to the GetPoint method is highlighted. Continue stepping through the code by pressing F8. Remember to switch back to the AutoCAD window when you are entering information.