Lisp lệnh TOADO trong chủ đề “Viết Lisp theo yêu cầu”
- Tải lisp
- 3663_toado.lsp
Cách dùng
- Tải tệp 3663_toado.lsp về máy.
- Trong AutoCAD gõ lệnh APPLOAD, chọn tệp vừa tải rồi bấm Load. Cũng có thể kéo thả tệp .lsp vào cửa sổ bản vẽ.
- Gõ lệnh TOADO để chạy lisp.
Mã nguồn 3663_toado.lsp
;; free lisp from cadviet.com
;;; this lisp was downloaded from https://www.cadviet.com/forum/topic/205-vi%E1%BA%BFt-lisp-theo-y%C3%AAu-c%E1%BA%A7u/?tab=comments#comment-573
(DEFUN EXCUTE(/ n P TX TY)
(setq str (strcat "\nPhan so le muon lay [" (itoa sl) "] (press Enter or Space for get default): "))
(setq n (getint str))
(if (/= n Nil)
(setq sl n)
)
(While T
(setq P Null)
(princ "\nPick a point or press ESC for exit:")
(setq P (getpoint))
(if (/= P Nil)
(progn
(setq TX (rtos (Car P) 2 sl))
(setq TY (rtos (Cadr P) 2 sl))
(command "-INSERT" "TD" P "1" "1" "0" TX TY)
)
)
);End While
)
(DEFUN INIT()
(if (= sl Nil)
(setq sl 2)
)
)
(DEFUN C:TOADO()
(INIT)
(EXCUTE)
)Thảo luận gốc
Lisp được chia sẻ trong chủ đề Viết Lisp theo yêu cầu. Xem đúng bài viết #3663 để đọc hướng dẫn và trao đổi thêm.