[Lisp]Scale Block and Text Under Object Insertion Point

[Lisp]Scale Block and Text Under Object Insertion Point

Have you ever noticed that the object must scale according to the text block and insert the point of it? SB STE command in lisp and it helps you.

 

 

(defun c:sb (/ tapblock sodt index soblocksua
entdt tt diemchen tyle DAIHT DAIMOI
TEMP
)
(init)
(princ "\nCADViet.com (c) 2007")
(princ "\nDay la lenh Scale block!")
(setq tapblock (ssget '((0 . "INSERT")))
temp (initget "R C")
temp (getreal "\nTy le phong: ")
tyle (cond
((= temp "R")
(setq
daiht (getdist "\nDo dai hien tai: ")
daimoi (getdist "\nDo dai moi: ")
tyle (/ daimoi daiht)
)
)
((= temp "C")
(setq tyle (getreal "\nTy le moi: "))
)
(t temp)
)
sodt (sslength tapblock)
index 0
soblocksua 0
)
(repeat sodt
(setq entdt (ssname tapblock index)
index (1+ index)
tt (entget entdt)
diemchen (trans (cdr (assoc '10 tt)) 0 1)
soblocksua (1+ soblocksua)
)
(luuos)
(setvar "OSMODE" 0)
(command ".scale" entdt "" diemchen tyle)
(traos)
)
(princ (strcat "\nSo block da sua: " (itoa soblocksua)))
(sssetfirst nil tapblock)
(done)
)
;;-----------------------------------
(defun c:ste (/ tapblock sodt index soblocksua
entdt tt diemchen tyle DAIHT DAIMOI
TEMP
)
(init)
(princ "\nCADViet.com (c) 2007")
(princ "\nDay la lenh Scale TEXT!")
(setq tapblock (ssget '((0 . "TEXT")))
temp (initget "R C")
temp (getreal "\nTy le phong: ")
tyle (cond
((= temp "R")
(setq
daiht (getdist "\nDo dai hien tai: ")
daimoi (getdist "\nDo dai moi: ")
tyle (/ daimoi daiht)
)
)
((= temp "C")
(setq tyle (getreal "\nTy le moi: "))
)
(t temp)
)
sodt (sslength tapblock)
index 0
soblocksua 0
)
(repeat sodt
(setq entdt (ssname tapblock index)
index (1+ index)
tt (entget entdt)
diemchen (trans (cdr (assoc '10 tt)) 0 1)
soblocksua (1+ soblocksua)
)
(luuos)
(setvar "OSMODE" 0)
(command ".scale" entdt "" diemchen tyle)
(traos)
)
(princ (strcat "\nSo TEXT da sua: " (itoa soblocksua)))
(sssetfirst nil tapblock)
(done)
)
(princ "\nsb, ste - free lisp")
(princ)

Free download [Lisp]Scale Block and Text Under Object Insertion Point

Download Mirror 01  Mirror 02  Mirror 03  Mirror 04

[Lisp]Scale Block and Text Under Object Insertion Point
Rate this post

Leave a Reply

Your email address will not be published. Required fields are marked *

3 + 6 =