;;; Add Sq.cm simbol to the end of text and change text style to apropriative one.
;;; Created by BeekeeCZ 2017
;;; Saved from: https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/double-selection-issue/td-p/6980727

(defun c:cmt (/ ss ots i ed tx)

(if (and (setq ss (ssget '((0 . "TEXT"))))
(setq ots (getvar 'TEXTSTYLE))
(or (tblsearch "STYLE" "igal")
(command "STYLE" "igal" "arial.ttf" "" "" "" "" "")
(setvar 'TEXTSTYLE ots))
)
(repeat (setq i (sslength ss))
(setq ed (entget (ssname ss (setq i (1- i)))))
(entmod (append ed
(list (cons 1 (strcat (setq tx (cdr (assoc 1 ed)))
(if (wcmatch tx "* cm\\U+00B2")
""
" cm\\U+00B2")))
(cons 7 "igal"))))))
(princ)
)

(c:cmt)

Advertisements