Modify Elevations in text

P Fardanesh

Usenet Archive
Joined
Jul 3, 2003
Messages
1
Reaction score
0
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
 
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)
)
 
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.
 

Latest threads

Back
Top