Hello all,
I'm looking for the code for a lisp routine that will change the text height of selected text. The height is set to "0" within the style itself. I'm looking to change only certain text strings to have 16" text height.
The code for the desired routine is as follows:
(defun C:t16 (/ ss)
(princ "Select text which shall be changed to 16" text height ...\n")
(setq ss (ssget)) ; General selection-set
(if ss (progn ; If any objects selected...
(command "optchprop" ss "" "t" "heldustry" "")
(command **INSERT CODE TO CHANGE TEXT HEIGHT HERE")
(command "CHANGE" ss "" "PROP" "layer" "C-NOTE" "")
))
)
(princ)
Any hellp here is greatly appreciated.
Mike
Solved! Go to Solution.
Solved by _Tharwat. Go to Solution.
Using codes is much more better than comman calls .
(defun c:Test (/ height selectionset integer selectionsetname entlist) ;;; Tharwat 11. MAy. 2012 ;;; (if (setq height (* 16 25.4) selectionset (ssget "_:L" '((0 . "TEXT,MTEXT"))) ) (repeat (setq integer (sslength selectionset)) (setq selectionsetname (ssname selectionset (setq integer (1- integer)) ) ) (entmod (subst (cons 40 height) (assoc 40 (setq entlist (entget selectionsetname))) entlist ) ) ) (princ) ) (princ) )
Works fine...only problem is it sets the text height to 33'-10 13/32". I'm looking to have the final text height to be 16".
A revised routine is greatly appreciated.
Lets see...
(* 16 25.4) equals 406.4 (inches). This is equal to 33.867 feet.
Try replacing the stated equation with your desired value: 16.0
???
Scot-65
A gift of extraordinary Common Sense does not require an Acronym Suffix to be added to my given name.
ok that worked.
now how would I incorporate the following:
(command "optchprop" "t" "heldustry" "")
(command "CHANGE" "PROP" "layer" "C-NOTE" "")
into the routine listed above?
Thank you in advance for any help.
In the overall picture, I'm looking to change text height to 16, change text style to "Heldustry", and place the text on layer C-NOTE.
@Anonymous wrote:In the overall picture, I'm looking to change text height to 16, change text style to "Heldustry", and place the text on layer C-NOTE.
Try this ......
(defun c:Test (/ textstyle layer selectionset integer selectionsetname obj) (vl-load-com) ;;; Tharwat 11. MAy. 2012 ;;; (if (tblsearch "style" "Heldustry") (setq textstyle t) (princ "\n Text Style <Heldustry> is not existed ") ) (if (tblsearch "LAYER" "C-NOTE") (setq layer t) (princ "\n Layer <C-NOTE> is not existed ") ) (if (setq selectionset (ssget "_:L" '((0 . "TEXT,MTEXT")))) (repeat (setq integer (sslength selectionset)) (setq selectionsetname (ssname selectionset (setq integer (1- integer)) ) ) (setq obj (vlax-ename->vla-object selectionsetname)) (vla-put-height obj 406.4) (if textstyle (vla-put-stylename obj "Heldustry") ) (if layer (vla-put-layer obj "C-NOTE") ) ) (princ) ) (princ) )
@Anonymous wrote:Perfect! Works like a charm
Thank you so much.
I am happy to hear that .
You're welcome any time .
Tharwat
My lisp skills are very elementary...mainly learned from looking at codes others have written and tried to figure what code performs which function. Is there an online reference or a book you would recommend to expand my lisp writing skillset?
Check this great ref. uploaded by Alanjt