;;; 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 2017
(defun C:Cst (/ entities len count ent ent_data ent_name new_style_name)

(princ "\nSelect text :")
(setq entities (ssget '((0 . "TEXT")))
len (sslength entities)
count 0
);setq
(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

(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))
);while

(princ)

);defun

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

(while (setq bltxt (nentsel "\nSelect text to add cm²: "))

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

);_while
);_defun

(defun c:cmt() ;Main function
(c:cst)
(c:smt1)

)

(c:cmt)

Advertisements