Need a LISP that will edit multiple lines of text on a single sheet
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello,
I am struggling to create a lisp that allows me to do the following:
1. Enter "ET" into the command line to begin the command.
2. allow me to window select as many text lines i want, can be anywhere on the sheet.
3. allow me to edit the text similar to when it is double clicked with a mouse (i am trying to avoid seeing my edits in the command line, as my current lisp does).
4. each time i hit the enter key, the next line of text will be selected (going from top most to bottom most)
5. this process is to continue until i press enter on the final line of text that i selected for editing.
below is my current existing lisp. the issues i am having with this one are as follows:
1. the editing of the text appears in the command line, i want the editing to work as though i double clicked that line of text on the sheet.
2. it processes my multiple selected lines of text from the bottom up, i need it to process top down.
LISP:
(defun c:ET ()
(setq textObjects (ssget '((0 . "TEXT")))) ; Select all text objects
(if textObjects
(progn
(setq count (sslength textObjects) index 0)
(princ "\nPress Enter to start editing the selected text.")
(getstring) ; Wait for Enter key
(while (< index count)
(setq ent (ssname textObjects index))
(setq entData (entget ent))
;; Prompt for new text
(setq newText (getstring (strcat "\nEnter new text for: " (cdr (assoc 1 entData)) ": ")))
;; Update text if newText is not empty
(if (not (equal newText ""))
(progn
(entmod (subst (cons 1 newText) (assoc 1 entData) entData)) ; Update text
(princ (strcat "\nUpdated text: " newText))
)
)
(setq index (1+ index)) ; Move to next text object
)
)
(princ "\nNo text objects selected.")
)
(princ)
)