tailieunhanh - autocad 2007 and autocad lt 2007 bible - phần 10

Mở AutoCAD và bắt đầu một bản vẽ bằng cách sử dụng bất kỳ mẫu. 2. Bắt đầu Editor LISP trực quan. Mở từ đĩa CD-ROM. Chọn File ➪ Save As và lưu nó như trong AutoCAD 2007 \ Support folder hoặc trong một thư mục khác mà bạn đã thêm vào đường dẫn hỗ trợ tìm kiếm tập tin. 3. Chọn tải Chỉnh sửa cửa sổ đăng nhập từ thanh công cụ Tools. 4. | 1128 Part VII Programming AutoCAD STEPS Working with Break Points 1. Open AutoCAD and start a drawing using any template. 2. Start the Visual LISP Editor. Open from the CD-ROM. Choose File Save As and save it as in the AutoCAD 2007 Support folder or in another folder that you ve added to the support file search path. 3. Choose Load Active Edit Window from the Tools toolbar. 4. Read through the code. This routine creates a vertical list of numbers. The new FOREACH function steps through each item in a list. The comments explain why it contains a bug. 5. If you didn t do the previous exercise choose Debug Break on Error. Don t do anything if the Break on Error item is already checked. 6. Type the following in the Console window list-beautify-with-bug 1 2 3 4 5 J The Console returns the following 1 error bad argument type FILE 1 7. Choose Last Break on the Debug toolbar to jump to the error in the source code. 8. To place a break point in the code place the cursor after princ chr 40 . Press F9. Visual LISP marks the break with a red box. 9. Place another break point after princ car aList . Finally place a third break point after the closing parenthesis on the line that follows princ item 1 . Your code should look like Figure 36-3. 10. After the code produces an error you need to reset. Click Reset on the Debug toolbar. 11. Click the Visual LISP Editor window and reload the function into Visual LISP. Choose Load Active Edit Window on the Tools toolbar. 12. Type the same expression that produced the error in the Console list-beautify-with-bug 1 2 3 4 5 J 13. Visual LISP highlights the expression princ chr 40 . Choose Step Into on the Debug toolbar. Visual LISP highlights princ car aList . 14. Choose Step Into. Now only car aList is highlighted. 15. Choose Step Into until you reach the error princ item 1 . 16. Edit princ item 1 so that it reads princ item . 17. Click Reset again. 18. Choose Debug Clear All Breakpoints. Click Yes to confirm. 19. .