Lisp lệnh DF trong chủ đề “Lisp đổi Font cho text được chọn tại sao lỗi với Font .vnarial narrow !!!!!!”
Đây là đoạn Code đổi font của Text sang font .vnarial narrow(defun c:df () (command "undo" "be") (command "-style" "doifont" "VNARIALN.TTF" "0" "1" "0" "n" "n") (prompt "\nChon chu muon chinh.") (setq ss (ssget)) (setq c 0) (if ss (setq e (ssname ss c))) (while e (setq e (entget e)) (if (= (cdr (assoc 0 e)) "TEXT") (progn (setq txt "doifont") (setq e (subst (cons 7 txt) (assoc 7 e) e)) (entmod e) ) ) (setq c (1+ c)) (setq e (ssname ss c)) ) (command "undo" "end") (Prin I) )Còn đây là đoạn Code đổi font của Text sang font .vnarial narrowH
(defun c:df () (command "undo" "be") (command "-style" "doifont" "VHARIALN.TTF" "0" "1" "0" "n" "n") (prompt "\nChon chu muon chinh.") (setq ss (ssget)) (setq c 0) (if ss (setq e (ssname ss c))) (while e (setq e (entget e)) (if (= (cdr (assoc 0 e)) "TEXT") (progn (setq txt "doifont") (setq e (subst (cons 7 txt) (assoc 7 e) e)) (entmod e) ) ) (setq c (1+ c)) (setq e (ssname ss c)) ) (command "undo" "end") (Prin I) )Chúc thành công ^_^
ko chạy được bác Tuệ af, báo lỗi : Command: ; error: no function definition: PRIN Bác sửa lại cho em đi !
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 48558_df.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 DF để chạy lisp.
Mã nguồn 48558_df.lsp (trích từ bài viết gốc)
(defun c:df ()
(command "undo" "be")
(command "-style" "doifont" "VNARIALN.TTF" "0" "1" "0" "n" "n")
(prompt "\nChon chu muon chinh.")
(setq ss (ssget))
(setq c 0)
(if ss (setq e (ssname ss c)))
(while e
(setq e (entget e))
(if (= (cdr (assoc 0 e)) "TEXT")
(progn
(setq txt "doifont")
(setq e (subst (cons 7 txt) (assoc 7 e) e))
(entmod e)
)
)
(setq c (1+ c))
(setq e (ssname ss c))
)
(command "undo" "end")
(Prin I)
)
(defun c:df ()
(command "undo" "be")
(command "-style" "doifont" "VHARIALN.TTF" "0" "1" "0" "n" "n")
(prompt "\nChon chu muon chinh.")
(setq ss (ssget))
(setq c 0)
(if ss (setq e (ssname ss c)))
(while e
(setq e (entget e))
(if (= (cdr (assoc 0 e)) "TEXT")
(progn
(setq txt "doifont")
(setq e (subst (cons 7 txt) (assoc 7 e) e))
(entmod e)
)
)
(setq c (1+ c))
(setq e (ssname ss c))
)
(command "undo" "end")
(Prin I)
)Thảo luận gốc
Lisp được chia sẻ trong chủ đề Lisp đổi Font cho text được chọn tại sao lỗi với Font .vnarial narrow !!!!!!. Xem đúng bài viết #48558 để đọc hướng dẫn và trao đổi thêm.