Lisp routine to add a specified number to a dtext or mtext number
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I have a set of plans for a water treatment plant. The plans show elevation information for many different levels, floor, wier, high water level, low water level, etc., of the plant. The original survey was on an older datum and we now have a new survey of the same plant on a new datum. In order to re-use the previous plans, I need to add a specific value to all the elevations shown. I could edit one at a time but there are many many elevations called out.
My question is, where could I find a lisp routine that prompts the user for a specific value to add, or subtract, to selected dtext or mtext numbers? It would be nice if I could enter the desired number to add or subtract then select the dtext or mtext to be modified.
I found a lsp routine written by user Commandobill on Cadtutor.net but it changed all my numbers to the number I entered to add.
(defun c:addn ( / ss)
(vl-load-com)
(if (and (setq ss (ssget "X" (list (cons 0 "*text"))))
(setq amt (getreal "\nPlease type the amount you would like to add: ")))
(progn
(mapcar '(lambda (z) (vla-put-textstring z (rtos (+ (atof (vla-get-textstring z)) amt) 2 3)))
(mapcar 'vlax-ename->vla-object (vl-remove-if 'listp (mapcar 'cadr (ssnamex ss)))))
)
)
(princ)
)
EvilSi
Maybe someone could edit this or has one of their own they would be willing to share?
Thanks!