Lisp Thay ??i Height Và Width Factor C?a Text Attribute Trong Block
bạn thử xem
(defun c:CHW (/ ss h sc)
(if (and
(SETQ ss (ssget '((0 . "insert") (66 . 1))))
(setq h (getreal "\nChieu cao chu: "))
(setq sc (getreal "\nDo rong chu: "))
)
(progn
(setq
ss (mapcar 'vlax-ename->vla-object
(vl-remove-if 'listp (mapcar 'cadr (ssnamex ss)))
)
)
(mapcar '(lambda (Obj)
(mapcar '(lambda (x)
(vla-put-height x h)
(vla-put-scalefactor x sc)
)
(vlax-invoke Obj 'GetAttributes)
)
)
ss
)
)
)
(princ)
)
- Tải lisp
- 379548_chw.lsp
Cách dùng
- Tải tệp 379548_chw.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 CHW để chạy lisp.
Mã nguồn 379548_chw.lsp
;; free lisp from cadviet.com
;;; this lisp was downloaded from https://www.cadviet.com/forum/topic/150386-lisp-thay-%C4%91%E1%BB%95i-height-v%C3%A0-width-factor-c%E1%BB%A7a-text-attribute-trong-block/
(defun c:CHW (/ ss h sc)
(if (and
(SETQ ss (ssget '((0 . "insert") (66 . 1))))
(setq h (getreal "\nChieu cao chu: "))
(setq sc (getreal "\nDo rong chu: "))
)
(progn
(setq
ss (mapcar 'vlax-ename->vla-object
(vl-remove-if 'listp (mapcar 'cadr (ssnamex ss)))
)
)
(mapcar '(lambda (Obj)
(mapcar '(lambda (x)
(vla-put-height x h)
(vla-put-scalefactor x sc)
)
(vlax-invoke Obj 'GetAttributes)
)
)
ss
)
)
)
(princ)
)Thảo luận gốc
Lisp được chia sẻ trong chủ đề Lisp Thay Đổi Height Và Width Factor Của Text Attribute Trong Block. Xem đúng bài viết #379548 để đọc hướng dẫn và trao đổi thêm.