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

auto change text

3 REPLIES 3
SOLVED
Reply
Message 1 of 4
E.S.7.9
322 Views, 3 Replies

auto change text

i wanna change attribute tag which i choice with my specific texts ;

for example , i have text A500 ,B750 ,C1000, D1250, E1500 and i wanna change attribute tags in every click as my specific texts until i found necessary text

 

is there a lisp somthing like that

3 REPLIES 3
Message 2 of 4
pbejse
in reply to: E.S.7.9


@E.S.7.9 wrote:

i wanna change attribute tag which i choice with my specific texts ;

for example , i have text A500 ,B750 ,C1000, D1250, E1500 and i wanna change attribute tags in every click as my specific texts until i found necessary text

 

is there a lisp somthing like that


I dont get it E.S.7.9, is that TEXT entity to attribute? or select A500 then select tags to copy string value A500?

Message 3 of 4
E.S.7.9
in reply to: pbejse

those texts are going to be in lisp memory and when i run to lisp command and click to attribute tag , it s going to write there first text "A500" for example if i want to write 3 th text "C1000" i ll click to tag 3 time and lisp will put there to my 3th place text..

of course if there is a possibility

i realised that manually change mean it is a big lost time because there are a lot of attribute blocks i have to change

 

Message 4 of 4
Lee_Mac
in reply to: E.S.7.9

Try the following:

 

(defun c:attval ( / e l n o p )
    (setq l '("A500" "B750" "C1000" "D1250" "E1500")
          n 0
    )
    (while
        (progn (setvar 'errno 0) (setq e (car (nentsel "\nSelect text or attribute <Exit>: ")))
            (cond
                (   (= 7 (getvar 'errno))
                    (princ "\nMissed, try again.")
                )
                (   (= 'ename (type e))
                    (setq o (vlax-ename->vla-object e))
                    (cond
                        (   (not (wcmatch (vla-get-objectname o) "AcDbAttribute,AcDb*Text"))
                            (princ "\nInvalid object selected.")
                        )
                        (   (not (vlax-write-enabled-p o))
                            (princ "\nObject is on a locked layer.")
                        )
                        (   (equal p o)
                            (vla-put-textstring o (nth (setq n (rem (1+ n) (length l))) l))
                            t
                        )
                        (   (setq p o n 0)
                            (vla-put-textstring o (car l))
                            t
                        )
                    )
                )
            )
        )
    )
    (princ)
)
(vl-load-com) (princ)

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

Post to forums  

Autodesk Design & Make Report

”Boost