Lisp vẽ Pline mũi tên 2 đầu
Xong rồi đây.
Còn đang bị độ rộng pline sau khi chạy lệnh đang khác độ rộng hiện hành trước đó. Hiện ko có sách bên cạnh nên ko nhờ biến này lưu tên gì nên chưa có trả lại đc sẽ cập nhật sau.
- Tải lisp
- 159454_plmt.lsp
Cách dùng
- Tải tệp 159454_plmt.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 PLMT để chạy lisp.
Mã nguồn 159454_plmt.lsp
;; free lisp from cadviet.com
;;; this lisp was downloaded from https://www.cadviet.com/forum/topic/47541-%C4%91%C3%A3-xong-lisp-v%E1%BA%BD-pline-m%C5%A9i-t%C3%AAn-2-%C4%91%E1%BA%A7u/
(defun c:plmt()
(command "undo" "be")
(vl-load-com)
(if (null dlmt)(setq dlmt "10"))
(if (null dlvt)(setq dlvt "2"))
(Setq temp T)
(While temp
(setq po1 (strcat "\ndo lon Mui ten la(" dlmt ")/ Do lon Vong tron (" dlvt ")<Chon diem xuat phat>: "))
(Initget "m M v V")
(setq str (getpoint po1))
(Cond
((= str "m") (setq dlmt (getstring (strcat"\nDo lon mui ten <" dlmt "> :"))))
((= str "M") (setq dlmt (getstring (strcat"\nDo lon mui ten <" dlmt "> :"))))
((= str "V") (setq dlvt (getstring (strcat"\nDo lon vong tron <" dlvt "> :"))))
((= str "v") (setq dlvt (getstring (strcat"\nDo lon vong tron <" dlvt "> :"))))
(Progn
(Setq po1 str)
(setq temp nil)
)
)
)
(setq dlmtt (atof dlmt))
(setq po2 (getpoint po1"\n Chon diem tiep theo :"))
(setq luubatdiem (getvar "osmode"))
(setvar "osmode" 0)
(command "pline" po1 "w" 0 (/ dlmtt 2) (polar po1 (angle po1 po2) dlmtt) "w" 0 0 po2 "")
(setvar "osmode" luubatdiem)
(setq La (entlast))
(while (setq po3 (getpoint po2"\nChon diem tiep theo <Enter de ket thuc>: "))
(setq luubatdiem (getvar "osmode"))
(setvar "osmode" 0)
(command "pline" po2 po3 "")
(setvar "osmode" luubatdiem)
(command "pedit" "m" "L" La "" "j" "0" "")
(setq La (entlast))
(cond
((/= (angle po1 po2) (angle po2 po3)))
((= (angle po1 po2) (angle po2 po3))
(setq luubatdiem (getvar "osmode"))
(setvar "osmode" 0)
(command ".circle" po3 dlvt))
(setvar "osmode" luubatdiem)
)
(setq po1 po2)
(setq po2 po3)
)
(setq luubatdiem (getvar "osmode"))
(setvar "osmode" 0)
(command "pline" po2 "w" 0 (/ dlmtt 2) (polar po2 (angle po2 po1) dlmtt) "")
(setvar "osmode" luubatdiem)
(command "pedit" "m" "L" La "" "j" "0" "")
(command "undo" "end")
(princ)
)Thảo luận gốc
Lisp được chia sẻ trong chủ đề [Đã xong] Lisp vẽ Pline mũi tên 2 đầu. Xem đúng bài viết #159454 để đọc hướng dẫn và trao đổi thêm.