Message 1 of 3
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi All.
This program add sq. m suffix to selected text (see code):
;;; Add Sq.m 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:Sst (/ 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 m²: ")) (setq entdata (entget (car bltxt)) btxt (cdr (assoc 1 entdata)) ntxt (strcat btxt " m²") );_setq (entmod (subst (cons 1 ntxt)(assoc 1 entdata) entdata)) (entupd (cdr (assoc -1 entdata))) );_while );_defun (defun c:smt() ;Main function (c:sst) (c:smt1) ) (c:smt)
but first of all it change style of selected text in order to use Unicode extensions
This routine was combined and deeply modified in order to combine changing style of selected text with add sq. m suffix
All works properly, but "dirty" I mean user need to select text twice: once to change style and other one - to add suffix
Is it possible to do it in one selection?
Note: Select previous not works because text has been already changed
Any help will be very appreciated
Solved! Go to Solution.