Modify Elevations in text

Discussion in 'AutoCAD' started by P Fardanesh, Jul 3, 2003.

  1. P Fardanesh

    P Fardanesh Guest

    Does anybody have a lisp that will modify elevations in text while keeping
    any other text in the string the same. For example I'd like to change

    45.45 FG

    to

    25.45 FG

    by selecting the text and then inputing -20.

    Thanks

    P. Fardanesh
     
    P Fardanesh, Jul 3, 2003
    #1
  2. P Fardanesh

    pkirill Guest

    Here's a simple setup. Requires that the first 5 characters be your
    elevation number as shown in your example...

    (defun C:CGELEV ()
    (setq ELEV_STR (entget (car (entsel))))
    (while (/= (cdr (assoc 0 ELEV_STR)) "MTEXT")
    (princ "Not Mtext! Try Again...")
    (setq ELEV_STR (entget (car (entsel))))
    )
    (setq ELEV (cdr (assoc 1 ELEV_STR))
    ELEV (atof (substr ELEV 1 5))
    )
    (setq DIFF (getint "\nEnter positive or negative value: "))
    (setq BAL (rtos (+ ELEV DIFF) 2 2))
    (setq ELEV_STR (subst (cons 1 BAL) (assoc 1 ELEV_STR) ELEV_STR))
    (entmod ELEV_STR)
    )
     
    pkirill, Jul 3, 2003
    #2
  3. P Fardanesh

    John Uhden Guest

    Cadlantic has a routine called EDITNUM that does what you want with choice of
    multiple Text and Attribute entities by either a difference or a product. It's
    limited to finding only the first numeric in any string. Just checked... it
    includes our standard selection methods of "All/Layers/Picklayers/Manually."
    And it includes user options for encountering locked layers.
     
    John Uhden, Jul 4, 2003
    #3
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.