Lisp lệnh T2U trong chủ đề “chuyển bảng mã từ TCVN3 sang UNICODE”
Bạn dùng lệnh T2U (TCVN3 to Unicode)
(defun c:t2u (/ taptext) (defun chuyenfontstr (stsua / daichuoi index stdich chuht CHUSUA tAPSUA) (setq tapsua (list(cons "®" "\U+0110")(cons "§" "\U+0110")(cons "µ" "À")(cons "¸" "Á")(cons "¶" "\U+1EA2")(cons "·" "Ã")(cons "¹" "\U+1EA0")(cons "©" "Â")(cons "¢" "Â")(cons "Ç" "\U+1EA6")(cons "Ê" "\U+1EA4")(cons "È" "\U+1EA8")(cons "É" "\U+1EAA")(cons "Ë" "\U+1EAC")(cons "¨" "\U+0102")(cons "¡" "\U+0102")(cons "»" "\U+1EB0")(cons "¾" "\U+1EAE")(cons "¼" "\U+1EB2")(cons "½" "\U+1EB4")(cons "Æ" "\U+1EB6")(cons "Ì" "È")(cons "Ð" "É")(cons "Î" "\U+1EBA")(cons "Ï" "\U+1EBC")(cons "Ñ" "\U+1EB8")(cons "ª" "Ê")(cons "£" "Ê")(cons "Ò" "\U+1EC0")(cons "Õ" "\U+1EBE")(cons "Ó" "\U+1EC2")(cons "Ô" "\U+1EC4")(cons "Ö" "\U+1EC6")(cons "×" "Ì")(cons "Ý" "Í")(cons "Ø" "\U+1EC8")(cons "Ü" "\U+0128")(cons "Þ" "\U+1ECA")(cons "ß" "Ò")(cons "ã" "Ó")(cons "á" "\U+1ECE")(cons "â" "Õ")(cons "ä" "\U+1ECC")(cons "«" "Ô")(cons "¤" "Ô")(cons "å" "\U+1ED2")(cons "è" "\U+1ED0")(cons "æ" "\U+1ED4")(cons "ç" "\U+1ED6")(cons "é" "\U+1ED8")(cons "¬" "\U+01A0")(cons "¥" "\U+01A0")(cons "ê" "\U+1EDC")(cons "í" "\U+1EDA")(cons "ë" "\U+1EDE")(cons "ì" "\U+1EE0")(cons "î" "\U+1EE2")(cons "ï" "Ù")(cons "ó" "Ú")(cons "ñ" "\U+1EE6")(cons "ò" "\U+0168")(cons "ô" "\U+1EE4")(cons "" "\U+01AF")(cons "¦" "\U+01AF")(cons "õ" "\U+1EEA")(cons "ø" "\U+1EE8")(cons "ö" "\U+1EEC")(cons "÷" "\U+1EEE")(cons "ù" "\U+1EF0")(cons "ú" "\U+1EF2")(cons "ý" "Ý")(cons "û" "\U+1EF6")(cons "ü" "\U+1EF8")(cons "þ" "\U+1EF4")(cons "a" "A")(cons "b" "B")(cons "c" "C")(cons "d" "D")(cons "e" "E")(cons "f" "F")(cons "g" "G")(cons "h" "H")(cons "i" "I")(cons "j" "J")(cons "k" "K")(cons "l" "L")(cons "m" "M")(cons "n" "N")(cons "o" "O")(cons "p" "P")(cons "q" "Q")(cons "r" "R")(cons "s" "S")(cons "t" "T")(cons "u" "U")(cons "v" "V")(cons "w" "W")(cons "x" "X")(cons "y" "Y")(cons "z" "Z") ) ) (setq daichuoi (strlen stsua) index 1 stdich "" ) (repeat daichuoi (setq chuht (substr stsua index 1) index (1+ index) chusua (cond ((assoc chuht tapsua) (cdr (assoc chuht tapsua))) (t chuht) ) stdich (strcat stdich chusua) ) ) stdich) (defun doone(ent / new old tt) (setq tt (entget ent) old (assoc 1 tt) new (cons 1 (chuyenfontstr (cdr old))) ) (if (/= new old) (progn (setq tt (subst new old tt)) (entmod tt) (entupd ent) ) ) ) (setq taptext (ssget '((0 . "TEXT")))) (sudung doone taptext) )(defun sudung (ham ss / sodt index entdt soapp) (setq sodt (cond (ss (sslength ss)) (t 0) ) soapp 0 index 0 ) (repeat sodt (setq entdt (ssname ss index) index (1+ index) ) (if (ham entdt) (setq soapp (1+ soapp)) ) ) soapp)
bác nguyenhoanh ơi, co thể cho em xin đc mail hoặc nik yahoo của bác đc không, đẻ có gì em ll với bác cho tiện,cám ơn bác nhiều!
- Tải lisp
- 197704_t2u.lsp
Cách dùng
- Tải tệp 197704_t2u.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 T2U để chạy lisp.
Mã nguồn 197704_t2u.lsp
;; free lisp from cadviet.com
;;; this lisp was downloaded from https://www.cadviet.com/forum/topic/10894-chuy%E1%BB%83n-b%E1%BA%A3ng-m%C3%A3-t%E1%BB%AB-tcvn3-sang-unicode/
(defun c:t2u (/ taptext) (defun chuyenfontstr (stsua / daichuoi index stdich chuht CHUSUA tAPSUA) (setq tapsua (list(cons "®" "\U+0110")(cons "§" "\U+0110")(cons "µ" "À")(cons "¸" "Á")(cons "¶" "\U+1EA2")(cons "·" "Ã")(cons "¹" "\U+1EA0")(cons "©" "Â")(cons "¢" "Â")(cons "Ç" "\U+1EA6")(cons "Ê" "\U+1EA4")(cons "È" "\U+1EA8")(cons "É" "\U+1EAA")(cons "Ë" "\U+1EAC")(cons "¨" "\U+0102")(cons "¡" "\U+0102")(cons "»" "\U+1EB0")(cons "¾" "\U+1EAE")(cons "¼" "\U+1EB2")(cons "½" "\U+1EB4")(cons "Æ" "\U+1EB6")(cons "Ì" "È")(cons "Ð" "É")(cons "Î" "\U+1EBA")(cons "Ï" "\U+1EBC")(cons "Ñ" "\U+1EB8")(cons "ª" "Ê")(cons "£" "Ê")(cons "Ò" "\U+1EC0")(cons "Õ" "\U+1EBE")(cons "Ó" "\U+1EC2")(cons "Ô" "\U+1EC4")(cons "Ö" "\U+1EC6")(cons "×" "Ì")(cons "Ý" "Í")(cons "Ø" "\U+1EC8")(cons "Ü" "\U+0128")(cons "Þ" "\U+1ECA")(cons "ß" "Ò")(cons "ã" "Ó")(cons "á" "\U+1ECE")(cons "â" "Õ")(cons "ä" "\U+1ECC")(cons "«" "Ô")(cons "¤" "Ô")(cons "å" "\U+1ED2")(cons "è" "\U+1ED0")(cons "æ" "\U+1ED4")(cons "ç" "\U+1ED6")(cons "é" "\U+1ED8")(cons "¬" "\U+01A0")(cons "¥" "\U+01A0")(cons "ê" "\U+1EDC")(cons "í" "\U+1EDA")(cons "ë" "\U+1EDE")(cons "ì" "\U+1EE0")(cons "î" "\U+1EE2")(cons "ï" "Ù")(cons "ó" "Ú")(cons "ñ" "\U+1EE6")(cons "ò" "\U+0168")(cons "ô" "\U+1EE4")(cons "" "\U+01AF")(cons "¦" "\U+01AF")(cons "õ" "\U+1EEA")(cons "ø" "\U+1EE8")(cons "ö" "\U+1EEC")(cons "÷" "\U+1EEE")(cons "ù" "\U+1EF0")(cons "ú" "\U+1EF2")(cons "ý" "Ý")(cons "û" "\U+1EF6")(cons "ü" "\U+1EF8")(cons "þ" "\U+1EF4")(cons "a" "A")(cons "b" "B")(cons "c" "C")(cons "d" "D")(cons "e" "E")(cons "f" "F")(cons "g" "G")(cons "h" "H")(cons "i" "I")(cons "j" "J")(cons "k" "K")(cons "l" "L")(cons "m" "M")(cons "n" "N")(cons "o" "O")(cons "p" "P")(cons "q" "Q")(cons "r" "R")(cons "s" "S")(cons "t" "T")(cons "u" "U")(cons "v" "V")(cons "w" "W")(cons "x" "X")(cons "y" "Y")(cons "z" "Z") ) ) (setq daichuoi (strlen stsua) index 1 stdich "" ) (repeat daichuoi (setq chuht (substr stsua index 1) index (1+ index) chusua (cond ((assoc chuht tapsua) (cdr (assoc chuht tapsua))) (t chuht) ) stdich (strcat stdich chusua) ) ) stdich) (defun doone(ent / new old tt) (setq tt (entget ent) old (assoc 1 tt) new (cons 1 (chuyenfontstr (cdr old))) ) (if (/= new old) (progn (setq tt (subst new old tt)) (entmod tt) (entupd ent) ) ) ) (setq taptext (ssget '((0 . "TEXT")))) (sudung doone taptext) )(defun sudung (ham ss / sodt index entdt soapp) (setq sodt (cond (ss (sslength ss)) (t 0) ) soapp 0 index 0 ) (repeat sodt (setq entdt (ssname ss index) index (1+ index) ) (if (ham entdt) (setq soapp (1+ soapp)) ) ) soapp)Thảo luận gốc
Lisp được chia sẻ trong chủ đề chuyển bảng mã từ TCVN3 sang UNICODE. Xem đúng bài viết #197704 để đọc hướng dẫn và trao đổi thêm.