4 Mayıs 2009 Pazartesi

Text leri Hizalayın

;;;hizala.lsp

;;;Seçilen text'leri yatay/düşey olarak aynı hizaya getirir.İlk seçilen text referans olarak alınır.


 

(defun c:hz ( / obje n i hizanok10 yazinok10 hizanok11 yazinok11 ename elist yon)

(princ "\nHizalanacak Yazıları Seçiniz :")

(setq obje (ssget '((0 . "TEXT"))))

(if obje

(progn

(setq n (sslength obje))

(setq i 0

hizanok10 (cdr (assoc 10 (entget (ssname obje 0))))

hizanok11 (cdr (assoc 11 (entget (ssname obje 0))))

)

(initget "X Y")

(setq yon (getkword "Hizalama Yönü ( X / Y ) <Y> ?"))

(command "undo" "begin")

(repeat n

(setq ename (ssname obje i)

elist (entget ename)

yazinok10 (cdr (assoc 10 elist))

yazinok11 (cdr (assoc 11 elist))

)

(if yon

(progn

(setq hizanok10 (list (car hizanok10) (cadr yazinok10))) ;;; x yönünde hizalama

(if yazinok11 (setq hizanok11 (list (car hizanok11) (cadr yazinok11))))

)

(progn

(setq hizanok10 (list (car yazinok10) (cadr hizanok10))) ;;; y yönünde hizalama

(if yazinok11 (setq hizanok11 (list (car yazinok11) (cadr hizanok11))))

)

);_if

(setq elist (subst (cons 10 hizanok10) (assoc 10 elist) elist))

(if yazinok11 (setq elist (subst (cons 11 hizanok11) (assoc 11 elist) elist)))

(entmod elist)

(setq i (+ i 1))

);repeat

(command "undo" "end")

(princ (strcat "\n" (itoa i) " TEXT hizalandı."))

(princ)

));_if & progn

);defun

(princ "\nSeçilen TEXT'leri aynı hizaya getirir (ilk seçilene göre). [HZ] komutu ile çalışır")

(princ "\n© 2000 dꮥå")

(princ)

Hiç yorum yok:

Yorum Gönder