- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I found this small lisp routine that allows searching of a dwg for all instances of a specified text string (case sensitive) and replace it with a specified text string:
(setq tss (ssget "X" (list (cons 1 "OLD-NOT WHAT I NEED"))))
(repeat (sslength tss)
(setq
tdata (entget (ssname tss 0))
tdata (subst (cons 1 "NEW-WHAT I NEED") (assoc 1 tdata) tdata)
); end setq
(entmod tdata)
(ssdel (ssname tss 0) tss)
); end repeat
It works great but I need help to write a similar routine that searches for a particular character within all text strings and remove it from those text strings.
To complicate matters, the characters I need to remove from the strings are quote marks ("). I'm not even sure where to begin because, as in the lisp routine above, the quote characters are used by lisp to enclose the old/new strings.
In addition to this, the text strings I need to change are always different like "A" or "XYZ". So in short, and to use this example, I want the result to be like A or XYZ.
I have very few other characters that would need to be removed also, like the pound character (#).
So if i can get the quote one working I can simply copy the routine to handle the pound character also.
These few characters are all that need to change so I will hard code the characters that I want changed.
I do not want the routine to pause for my input until I type in a character, but rather I want it to run uninterrupted.
I know this can be done with the find/replace command of AutoCAD; however, I have been tasked with making this a part of a larger lisp routine for standardization.
Any help you can provide it greatly appreciated
Barry Navarre
Lafayette, Louisiana
Solved! Go to Solution.