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

Edit text that has been grouped

3 REPLIES 3
Reply
Message 1 of 4
lgabriel
1552 Views, 3 Replies

Edit text that has been grouped

Looking for a way, whether within AutoCAD or thru Autolisp or VBA, to individually edit text that has been grouped. Ungrouping and regrouping is too cumbersome. Search and replace will work, but will change all instances of text that match the serach/replace criteria.

 

Any suggestions?

3 REPLIES 3
Message 2 of 4
_Tharwat
in reply to: lgabriel

Hi ,

 

What is the name of the group and what is the text string inside of it that you want to replace with another ?

 

Tharwat

Message 3 of 4
lgabriel
in reply to: _Tharwat

The name of the group is TMPnn, where nn is a number. I create groups with a lisp program which assigns the next TMPnn to it.

 

As for the string, I am not looking for search and replace, but the abiliity to edit the text. Within these groups there is usually similar text that using a search/replace algorithm will replace everything, which is not what I am looking for.

 

I have a lisp program that allows the user to select multiple text, which then copies them to a text file, opens NOTEPAD, allows me to edit any text, then update the text back to AutoCAD.

 

Looking for something similar where if I select a group, it will write all text (TEXT,DTEXT,MTEXT, ATTRIBUTES) to NOTEPAD, allow me to edit what I want, then update all text within the group, without ever exploding the group.

 

Message 4 of 4
pbejse
in reply to: lgabriel

DEMO:

(defun c:demo  (/ etype)
      (vl-load-com)
      (vlax-for
             itm  (vla-get-groups (vla-get-ActiveDocument
                               (vlax-get-acad-object)))
            (if (wcmatch (strcase (vla-get-name itm)) "TMP*")
                  (vlax-for
                         ob  itm
                        (setq etype (vla-get-ObjectName ob))
                        (cond
                              ((member etype
                                       '("AcDbMText" "AcDbText"))
                               (princ
                                     "\nDo this on TEXT entties/call your program here"))
                              ((and (eq etype
                                        "AcDbBlockReference")
                                    (eq (vla-get-HasAttributes
                                              ob)
                                        :vlax-true))
                               (princ
                                     "\nDo this on ATTRIBUTE entties/call your program here"))
                              )
                        )
                  )
            )
      (princ)
      )

 


You said:

 I have a lisp program that allows the user to select multiple text, which then copies them to a text file, opens NOTEPAD, allows me to edit any text, then update the text back to AutoCAD.

 

HENCE:

Do this on TEXT entties/call your program here

Do this on ATTRIBUTE entties/call your program here


HTH

 

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

Post to forums  

Autodesk Design & Make Report

”Boost