Lisp lệnh TTT trong chủ đề “help lisp vẽ đường tròn chỉ 1 cái pick”
(defun MakeText (point string Height Wid Ang justify Style Layer Color xdata / Lst); Ang: Radial
(setq Lst (list '(0 . "TEXT")
(cons 8 (if Layer Layer (getvar "Clayer")))
(cons 62 (if Color Color 256))
(cons 10 point)
(cons 40 Height)
(cons 41 Wid)
(cons 1 string)
(if Ang (cons 50 Ang))
(cons 7 (if Style Style (getvar "Textstyle")))
(cons -3 (if xdata (list xdata) nil)))
justify (strcase justify))
(cond ((= justify "C") (setq Lst (append Lst (list (cons 72 1) (cons 11 point)))))
((= justify "R") (setq Lst (append Lst (list (cons 72 2) (cons 11 point)))))
((= justify "M") (setq Lst (append Lst (list (cons 72 4) (cons 11 point)))))
((= justify "TL") (setq Lst (append Lst (list (cons 72 0) (cons 11 point) (cons 73 3)))))
((= justify "TC") (setq Lst (append Lst (list (cons 72 1) (cons 11 point) (cons 73 3)))))
((= justify "TR") (setq Lst (append Lst (list (cons 72 2) (cons 11 point) (cons 73 3)))))
((= justify "ML") (setq Lst (append Lst (list (cons 72 0) (cons 11 point) (cons 73 2)))))
((= justify "MC") (setq Lst (append Lst (list (cons 72 1) (cons 11 point) (cons 73 2)))))
((= justify "MR") (setq Lst (append Lst (list (cons 72 2) (cons 11 point) (cons 73 2)))))
((= justify "BL") (setq Lst (append Lst (list (cons 72 0) (cons 11 point) (cons 73 1)))))
((= justify "BC") (setq Lst (append Lst (list (cons 72 1) (cons 11 point) (cons 73 1)))))
((= justify "BR") (setq Lst (append Lst (list (cons 72 2) (cons 11 point) (cons 73 1))))))
(entmakex Lst));end
;=================================
(defun C:ttt(/ dia disadd pleft pright pup pdown p1)
(if (not dia0) (setq dia0 30.0))
(setq dia (getdist (strcat "\nNhap duong kinh: <" (rtos dia0 2 2) ">:")))
(if (not dia)
(setq dia dia0)
(setq dia0 dia)
)
(setq disadd (/ dia 10.0))
(while (setq p1 (getpoint "Pick diem"))
(setq pleft (polar p1 pi (+ (* 0.5 dia) disadd)))
(setq pright (polar p1 0 (+ (* 0.5 dia) disadd)))
(setq pup (polar p1 (/ pi 2) (+ (* 0.5 dia) disadd)))
(setq pdown (polar p1 (/ pi -2) (+ (* 0.5 dia) disadd)))
(entmake (list (cons 0 "CIRCLE") (cons 10 p1) (cons 40 (/ dia 2.0))))
(entmake (list (cons 0 "LINE") (cons 10 pleft) (cons 11 pright)))
(entmake (list (cons 0 "LINE") (cons 10 pup) (cons 11 pdown)))
(MakeText p1 (strcat "D" (rtos dia 2 0)) (/ dia 3.0) 0.7 0 "BC" nil nil nil nil)
)
(princ "Viet boi hochoaivandot-Cadviet.com")
)
Bạn thử có đúng ý không nhé.
Tên lệnh TTT
Tệp .lsp gốc không còn trên máy chủ. Hãy chép mã nguồn bên dưới (lấy từ bài viết gốc) vào một tệp văn bản, lưu với đuôi .lsp.
Cách dùng
- Chép mã nguồn, lưu thành tệp 272466_ttt.lsp.
- 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 TTT để chạy lisp.
Thảo luận gốc
Lisp được chia sẻ trong chủ đề help lisp vẽ đường tròn chỉ 1 cái pick. Xem đúng bài viết #272466 để đọc hướng dẫn và trao đổi thêm.