;;; Add Sq.cm simbol to the end of text and change text style to apropriative one.
;;; Combined from existing routines and deeply modified by Igal Averbuh 2016

(defun C:Cst (/ entities len count ent ent_data ent_name new_style_name)

(princ "\nSelect Area text to change style:")
(setq entities (ssget '((0 . "TEXT")))
len (sslength entities)
count 0
(command "STYLE" "igal" "arial.ttf" "" "" "" "" "")
(while (< count len)
(setq ent (ssname entities count)
ent_data (entget ent)
ent_name (cdr (assoc 7 ent_data))

(setq new_style_name (cons 7 "igal"))
(setq ent_data (subst new_style_name (assoc 7 ent_data) ent_data))
(entmod ent_data)

(setq count (+ count 1))



(defun c:smt1 (/ entdata btxt ntxt bltxt)

(while (not (setq bltxt (nentsel "\nSelect text to add [cm²]: ")))
(prompt " Nothing selected, retry!\n")

(setq entdata (entget (car bltxt))
btxt (cdr (assoc 1 entdata))
ntxt (strcat btxt " cm²")
(entmod (subst (cons 1 ntxt)(assoc 1 entdata) entdata))
(entupd (cdr (assoc -1 entdata)))


(defun c:cmt() ;Main function