Lisp lệnh LTR trong chủ đề “lisp tính chiều dài một phần polyline”
Lệnh LTR (Lý trình) dưới đây sẽ giúp bạn:
- Tải lisp
- 13988_ltr.lsp
Cách dùng
- Tải tệp 13988_ltr.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 LTR để chạy lisp.
Mã nguồn 13988_ltr.lsp
;; free lisp from cadviet.com
;;; this lisp was downloaded from https://www.cadviet.com/forum/topic/3100-lisp-t%C3%ADnh-chi%E1%BB%81u-d%C3%A0i-m%E1%BB%99t-ph%E1%BA%A7n-polyline/
(defun c:ltr()
(setq
ent (car (entsel "\nVao pline: "))
p (getpoint "\nVao diem xac dinh ly trinh: ")
)
(command ".copy" ent "" "0,0,0" "@")
(setq ent (entlast))
(command ".break" ent p "@")
(setq ent1 (entlast))
(command ".lengthen" ent "")
(setq l (rtos (getvar "perimeter")))
(command ".lengthen" ent1 "")
(setq l1 (rtos (getvar "perimeter")))
(command ".erase" ent ent1 "")
(alert (strcat "diem vua pick chia pline thanh 2 doan\n\nTu dau den diem pick: " l "\n\nTu diem pick den cuoi: " l1))
(princ)
)
Thảo luận gốc
Lisp được chia sẻ trong chủ đề lisp tính chiều dài một phần polyline. Xem đúng bài viết #13988 để đọc hướng dẫn và trao đổi thêm.