Jump to content

Scale text block

Thứ này có nhiều.


(defun c:SCT(/ ci tl n i)
 (prompt "\n Moi ban chon CIRCLE/DONUT/BLOCK")
 (setq ci (ssget '((0 . "CIRCLE,LWPOLYLINE,INSERT"))))
 (setq tl (getreal "\n Nhap ti le scale :") n (sslength ci) i 0)
 (while (< i n)
  (setq ent (ssname ci i))
  (if (= (cdr (assoc 0 (entget ent))) "LWPOLYLINE")
   (command "scale" ent "" (centre ent) tl)
   (command "scale" ent "" (cdr (assoc 10 (entget ent))) tl))
  (setq i (1+ i)))
 (princ))

Cách dùng

  1. Tải tệp 463291_sct.lsp về máy.
  2. 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ẽ.
  3. Gõ lệnh SCT để chạy lisp.

Mã nguồn 463291_sct.lsp

;; free lisp from cadviet.com
;;; this lisp was downloaded from https://www.cadviet.com/forum/topic/191858-scale-text-block/

(defun c:SCT(/ ci tl n i)
 (prompt "\n Moi ban chon CIRCLE/DONUT/BLOCK")
 (setq ci (ssget '((0 . "CIRCLE,LWPOLYLINE,INSERT"))))
 (setq tl (getreal "\n Nhap ti le scale :") n (sslength ci) i 0)
 (while (< i n)
  (setq ent (ssname ci i))
  (if (= (cdr (assoc 0 (entget ent))) "LWPOLYLINE")
   (command "scale" ent "" (centre ent) tl)
   (command "scale" ent "" (cdr (assoc 10 (entget ent))) tl))
  (setq i (1+ i)))
 (princ))

Thảo luận gốc

Bài viết gốc #463291 không còn trên diễn đàn.

Về Thư viện AutoLisp (trang 328)