Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Change Text Height

10 REPLIES 10
SOLVED
Reply
Message 1 of 11
mdouglas3800
3425 Views, 10 Replies

Change Text Height

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

10 REPLIES 10
Message 2 of 11
_Tharwat
in reply to: mdouglas3800

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)
)

 

Message 3 of 11
mdouglas3800
in reply to: _Tharwat

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.

Message 4 of 11
scot-65
in reply to: mdouglas3800

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.


Message 5 of 11
mdouglas3800
in reply to: scot-65

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.

Message 6 of 11
mdouglas3800
in reply to: mdouglas3800

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.

Message 7 of 11
_Tharwat
in reply to: mdouglas3800


@mdouglas3800 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)
)

 

Message 8 of 11
mdouglas3800
in reply to: _Tharwat

Perfect!  Works like a charm

 

Thank you so much.

Message 9 of 11
_Tharwat
in reply to: mdouglas3800


@mdouglas3800 wrote:

Perfect!  Works like a charm

 

Thank you so much.


I am happy to hear that .Smiley Happy

 

You're welcome any time .

 

Tharwat

Message 10 of 11
mdouglas3800
in reply to: _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? 

Message 11 of 11
_Tharwat
in reply to: mdouglas3800

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost