I have a lot of texts that need to be modified like this one: TC=50.12
Is it possible to input a number to add/subtract the value in that text?
I know there are other threads with similar discussion like this one, but it doesn't apply to this particular problem I'm having.
Thanks!
Solved! Go to Solution.
Solved by john.uhden. Go to Solution.
(read) can come in handy in some odd situations. F;rinstance if you want to allow entry of either a real or an integer but have to know which it is...
John F. Uhden
to check for 5 digit numbers.
;; By JOHN.UHDEN
(DEFUN C:SUBTRACTNAME (/ AMOUNT OLD-DATA OLDNAME OLD NUM PREFIX SUFFIX NEW)
(SETQ OLDNAME (SSNAME (SSGET "_:S+." '((0 . "*text") (1 . "*#####"))) 0))
(SETQ OLD (CDR (ASSOC 1 (ENTGET OLDNAME))))
;(setq old (getstring "\nEnter old name: "))
;(setq amount (getint "\nAmount to change last five digits (integer): "))
(SETQ AMOUNT -2000)
(SETQ PREFIX (SUBSTR OLD 1 (- (STRLEN OLD) 5)))
(SETQ SUFFIX (SUBSTR OLD (- (STRLEN OLD) 4))) ; string
(atoi SUFFIX )
(SETQ NEW (STRCAT PREFIX (ITOA (+ (READ SUFFIX) AMOUNT))))
(PRINC NEW)
(SETQ OLD-DATA (ENTGET OLDNAME))
(SETQ OLD-DATA (SUBST (CONS 1 NEW) (ASSOC 1 OLD-DATA) OLD-DATA))
(ENTMOD OLD-DATA)
(PRINC)
)
(DEFUN C:SN () (C:SUBTRACTNAME))
You are all good with this. I'm sorry because I am new to this Autocad Feature.
Thank's a lot for your help. I will continue studying this code because what I wanna do is change all the last 5 digits of all the names/Elevation on the drawing.
"the last 5 digits of elevation?" What, are you surveying Mount Everest?
John F. Uhden
Well 15000 inches is 1250 feet, which is up there a ways. And 2000 inches is 166 feet, which is quite an adjustment.
"Old surveyors never die. They just lose their bearings." - Uhden
John F. Uhden
i just did an entire topo and didnt realize i didnt change the datum and this lisp just save me a days worth of work. holy crap thanks haha
Can't find what you're looking for? Ask the community or share your knowledge.