Lisp lệnh TTA trong chủ đề “Chuyển Text Att Về Text”
Lệnh Burst là chuyển block ATT về block thường
Chứ nó k chuyển được text ATT thanh text
Mình vẫn dùng cái này này
(defun c:tta (/ en sset ostr str osty sty olay lay ospt
spt ojpt jpt otxht txht otxwd txwd orot rot
oaln1 aln1 olan2 aln2 angd stytbl cursty curht
curwd curobl curupdn curlastht curfont just
newattrib entjunk junkpoint origcol col ocol)
(command "undo" "begin")
(SETVAR "CMDECHO" 0)
(graphscr)
;(prompt "\nSelect text object to change.")
(setq sset (entsel "\nSelect text object to change."))
(if (null sset)
(progn
(princ "\nNo objects selected.")
(exit)
)
)
(setq en (entget (car sset))
ostr (assoc 1 en)
str (cdr ostr)
osty (assoc 7 en)
sty (cdr osty)
olay (assoc 8 en)
lay (cdr olay)
ospt (assoc 10 en)
spt (cdr ospt)
ojpt (assoc 11 en)
jpt (cdr ojpt)
otxht (assoc 40 en)
txht (cdr otxht)
otxwd (assoc 41 en)
txwd (cdr otxwd)
orot (assoc 50 en)
rot (cdr orot)
ocol (assoc 62 en)
col (cdr ocol)
oaln1 (assoc 72 en)
aln1 (cdr oaln1)
oaln2 (assoc 73 en)
aln2 (cdr oaln2)
angd (/ (* rot 180) pi)
) ;end_setq en
(setq stytbl (tblsearch "style" sty)
cursty (cdr (assoc 2 stytbl))
curht (cdr (assoc 40 stytbl))
curwd (cdr (assoc 41 stytbl))
curobl (cdr (assoc 50 stytbl))
curupdn (cdr (assoc 71 stytbl))
curlastht (cdr (assoc 42 stytbl))
curfont (cdr (assoc 3 stytbl))
)
(command "-style" sty curfont 0 txwd 0 "n" "n" (if (> (getvar "cmdactive") 0)(command "n")))
(command "erase" sset "")
(cond
((= aln1 5)(setq horiz-just "fit"))
((= aln1 3)(setq horiz-just "aligned"))
((= aln1 4)(setq horiz-just "M"))
((= aln1 2)(setq horiz-just "R"))
((= aln1 1)(setq horiz-just "C"))
((= aln1 0)(setq horiz-just "L"))
)
(cond
((= aln2 0)(setq vert-just ""))
((= aln2 1)(setq vert-just "B"))
((= aln2 2)(setq vert-just "M"))
((= aln2 3)(setq vert-just "T"))
)
(setq just (strcat vert-just horiz-just))
(cond
((= just "aligned")(command "-attdef" "" str str str "S" sty "j" "aligned" spt jpt))
((= just "fit")(command "-attdef" "" str str str "S" sty "j" "fit" spt jpt txht))
((= just "L")(command "-attdef" "" str str str "S" sty spt txht (angtos rot)))
((or (/= just "aligned")(/= just "fit")(/= just "L"))(command "-attdef" "" str str str "S" sty "j" just spt txht (angtos rot)))
)
(setq newattrib (entlast))
(setq entjunk (entget newattrib))
(setq junkpoint (cdr (assoc 10 entjunk)))
(command "move" newattrib "" junkpoint spt)
(cond
((= col nil)(setq origcol "bylayer"))
((= col 0) (setq origcol "byblock"))
((or (/= col nil)(/= col 0))(setq origcol col))
)
(command "change" newattrib "" "p" "c" origcol "layer" lay "")
(command "-style" sty curfont curht curwd curobl "n" "n" (if (> (getvar "cmdactive") 0)(command "n")))
(command "undo" "end")
)
- Tải lisp
- 400149_tta.lsp
Cách dùng
- Tải tệp 400149_tta.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 TTA để chạy lisp.
Mã nguồn 400149_tta.lsp
;; free lisp from cadviet.com
;;; this lisp was downloaded from https://www.cadviet.com/forum/topic/162606-chuy%E1%BB%83n-text-att-v%E1%BB%81-text/
(defun c:tta (/ en sset ostr str osty sty olay lay osptThảo luận gốc
Lisp được chia sẻ trong chủ đề Chuyển Text Att Về Text. Xem đúng bài viết #400149 để đọc hướng dẫn và trao đổi thêm.