lisp xoay text theo pline
Viết lại cho bạn:
(defun c:tt (/ FixTextAngle a ang els ent h mid p pte pts spt txt)(defun FixTextAngle (ang)
(if (and (> ang (* 0.5 pi)) (<= ang (* 1.5 pi)))
(+ ang pi)
ang))
(while (and (setq txt (car (entsel "\nPick Text")))
(wcmatch (cdr (assoc 0 (entget txt))) "TEXT")
(setq ent (entsel "\nPick LINE, PLINE: "))
(setq els (entget (car ent)))
(wcmatch (cdr (assoc 0 els)) "*LINE"))
(setq spt (osnap (cadr ent) "NEA")
mid (osnap (cadr ent) "MID"))
(if (< (car mid) (car spt))
(setq pts mid
pte spt)
(setq pts spt
pte mid))
(setq ang (FixTextAngle (angle pts pte))
els (entget txt))
(setq h (cdr (assoc 40 els))
p (cons 10 (polar spt (+ ang (* 0.5 pi)) (* 0.5 h)))
a (cons 50 ang))
(setq els (subst a (assoc 50 els) els))
(entmod (subst p (assoc 10 els) els)))
(princ))
P/s: Chọn Text trước, Line or Pline sau:
Lsp có thể uốn cong theo spline dc không bạn ?
- Tải lisp
- 407355_tt.lsp
Cách dùng
- Tải tệp 407355_tt.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 TT để chạy lisp.
Mã nguồn 407355_tt.lsp
;; free lisp from cadviet.com
;;; this lisp was downloaded from https://www.cadviet.com/forum/topic/69045-nh%E1%BB%9D-ch%E1%BB%89nh-s%E1%BB%ADa-lisp-xoay-text-theo-pline/?page=3
(defun c:tt (/ FixTextAngle a ang els ent h mid p pte pts spt txt)Thảo luận gốc
Lisp được chia sẻ trong chủ đề [Nhờ chỉnh sửa] lisp xoay text theo pline. Xem đúng bài viết #407355 để đọc hướng dẫn và trao đổi thêm.