Author Topic: find and replace help  (Read 2998 times)

0 Members and 1 Guest are viewing this topic.

ELOQUINTET

  • Guest
find and replace help
« on: January 21, 2004, 12:19:00 PM »
ok guys i've asked about this before and would like to figure out how to fix it. sometimes it works and sometimes not. let's say this is how my note reads:

1/4" white laminated glass-
owner to select color
of pvb interlayer

let's say i want to change the note to read:


1/4" white laminated glass-
interlayer color blue

i figured out that find treats each line as a string so i would have to find the last string and replace it with nothing. then find and replace the second string with: interlayer color blue.

what i would like to be able to do is copy and paste from the mtext editor the whole note and replace it all in one shot. is this possible? if not is there a better way of doing what i want? thanks

Keith™

  • Villiage Idiot
  • Seagull
  • Posts: 16899
  • Superior Stupidity at its best
find and replace help
« Reply #1 on: January 21, 2004, 12:39:46 PM »
Ok, the fact is that mtext WILL be modified if you enter the entire string and enter the replace value. If it is not a single bit of text, it won't work.
Proud provider of opinion and arrogance since November 22, 2003 at 09:35:31 am
CadJockey Militia Field Marshal

Find me on https://parler.com @kblackie

daron

  • Guest
find and replace help
« Reply #2 on: January 21, 2004, 01:00:42 PM »
If it is a single bit of text, I'll leave you with this:
Code: [Select]

(defun text-remover (string)
     (setq $acad (vlax-get-acad-object)
  $doc  (vla-get-activedocument $acad)
  model (vla-get-modelspace $doc)
  )
     (vlax-for each model
 (cond ((vlax-property-available-p each 'TextString)
(if (= (vla-get-TextString each) string)
    (vla-erase each)
    )
)
)
 )
     (princ)
)

Now, it's your job to figure out how to incorporate that function into a lisp command. Example:
Code: [Select]

(defun c:eponymous (/ var)
(you figure out what goes here)
(princ)
)

Are you up to the challenge? Look under g in the acad_dev.chm file under the help folder in the ADT folder. Extra credit if you can, by breaking down the word eponymous, tell the definition of it. No cheating.