Quantcast
Viewing all articles
Browse latest Browse all 14319

lisp for changing text globally

I have a routine that works the way i want but need to add a function that will also change the text  (attributes, mtext, text) style to simplex. I have and old routine that will do that but am not sure how to incorporate it into my lisp.

 

 

 

;;;Routine will rename selected block and edit to change entities to layer 0 and color to bylayer. Would like to add change all text to simplex.

(defun c:RB (/)
  (vl-load-com)
  (setq obj (vlax-ename->vla-object (car (entsel "Select block: ")))
        Eblkname (vlax-get obj 'Effectivename)
        Nblkname (strcat (vlax-get obj 'Effectivename) "-ex")
  )
  (prompt (strcat "\n\nDynamic block " Eblkname "\nhas been renamed to: " Nblkname "\n"))
  (command "_.rename" "b" Eblkname Nblkname)
(command "-bedit" nblkname)                 
(command "change" "all" "" "p" "la" "0" "p" "c" "bylayer" "" "")

;INSERT CHANGE TEXT STYLE HERE

(command "bclose" "s")
  (princ)
)


;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;Global Text Change;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defun c:GT ()
   (setq S1 nil) (gc)   ; Clear Selection set for use.
   (prompt "\nSelect text objects:") ; Will already be selected
   (setq S1 (ssget))
   (ss-sieve S1 "TEXT") ; Utility routine from Listing 2.
   (setq User "Go")
   (while (/= User "Exit")
      (setq User
 (strcase
  (getstring "\nChange: Style/Height/Oblq angle/Rot angle/ <eXit>:"))) ;All I need is Style
      (if (> (strlen User) 1) (setq User (substr User 1 1)))
      (cond
 ((and (/= User "X") (/= User ""))
   (setq Code


      (cond
        ((= User "S") 7)
        ((= User "H") 40)
        ((= User "O") 51)
        ((= User "R") 50)
        (t nil)))
   (cond
      ((boundp 'Code)
        (setq New (getstring "\nNew value:")); simplex
        (if (> Code 20) (setq New (atof New)))
        (if (and (> Code 49) (< Code 60))
      (setq New (* (/ New 180.0) pi)))
        (setq CNT -1)
        (repeat (sslength S1)
    (setq Elist (entget (ssname S1 (setq CNT (1+ CNT)))))
    (entmod
      (cond
         ((null (assoc Code Elist))
     (append Elist (list (cons Code New))))
         (t
     (subst (cons Code New) (assoc Code Elist) Elist)
         )))))(t (prompt "\nEntry invalid:"))))(t
    (setq User "Exit")))))
(defun ss-sieve (S1 Screen)
   (setq CNT (sslength S1))
   (while (> CNT 0)
      (setq Elist (entget (ssname S1 (setq CNT (1- CNT)))))
      (cond
 ((/= (cdr (assoc 0 Elist)) Screen)
   (ssdel (ssname S1 CNT) S1)))))

Image may be NSFW.
Clik here to view.

Viewing all articles
Browse latest Browse all 14319

Trending Articles