Đang chuẩn bị nút TẢI XUỐNG, xin hãy chờ
Tải xuống
Nếu bạn muốn, bạn có thể tạo ra khối của riêng bạn và đặt tên cho nó dviewblock. Tạo ra nó với X, Y, Z kích thước của 1. Khi bạn nhấn Enter Chọn hoặc các đối tượng: nhắc nhở, AutoCAD tìm kiếm dviewblock và sử dụng nó để hiển thị các kết quả của các thiết lập xem quan điểm. | 1146 Part VII ProgrammingAutoCAD 6. Type cdr endpt J. AutoLISP returns 2.0 1.4 . 7. Type nth 1 endpt J. AutoLISP returns 2.0. Do not save your drawing. Setting Conditions Often you want to execute a procedure based on a certain condition. One way of doing this is with the IF statement which does one thing if a statement is true and another thing if it is false. In other words the operation is conditioned on the truth of a certain statement. Looping is an important part of programming. Frequently you want to execute a procedure over and over until the routine has finished operating on all the target objects or items. Looping sets up the condition that determines when the operation starts the number of objects upon which the routine operates and when the operation ends. Conditional structures Conditional structures enable program flow to be determined based on the outcome of a given decision. These decisions result in the return of either T meaning true or nil meaning false. To try out the following statements type them in the Visual LISP Console window. For instance for the statement 3 5 T AutoLISP returns T for true having determined that 3 is less than 5. For the statement 3 5 nil AutoLISP returns nil for false having determined that 3 is not greater than 5. For the statement 3 5 nil AutoLISP returns nil. Here we have determined that 3 is not equal to 5. Because these statements return either T or nil you can use the IF statement. The general syntax of the IFstatement is if conditional-test if-true if-false . Say you want to find circles whose radius is less than 0.25. Here s a sample IF statement. In this example radius is a variable that has been previously set. Chapter 35 Exploring AutoLISP Further 1147 if radius .25 princ The radius is less than .25 princ The radius is not less than .25 The conditional test is radius .25 . The if-true statement is princ The radius is less than .25 . The if-false statement is princ The radius is not less than .25 . This IF .