JPayne Posted September 30, 2013 Share Posted September 30, 2013 This is a little hairy - I have about 4000 labels with Stations and a weld number along a pipeline and the stations are all going to increase or decrease depending on new data being provided. Here are a few random labels: 0+57 MLC-25 748+94 ATI-16 Only the stationing needs to be changed - so if they all increase by 6, it would be 0+63 MLC-25 or 749+00 ATI-16. Is there a lisp out there that will do that? Assuming I need to remove the +, modify the number and place the + back in. Thanks for any help! Quote Link to comment Share on other sites More sharing options...
Ohnoto Posted September 30, 2013 Share Posted September 30, 2013 I have attached a LISP program I used to use. I didn't write it, and credit to the original writer is in the code itself. This should work on single line text. If you have attributes or mtext, it will likely need some modification. Also, welcome to CadTutor. CS.LSP Quote Link to comment Share on other sites More sharing options...
JPayne Posted September 30, 2013 Author Share Posted September 30, 2013 That did it! Huge thanks, Ohnoto!! Quote Link to comment Share on other sites More sharing options...
fixo Posted September 30, 2013 Share Posted September 30, 2013 my 2 cents: (setq inc (getint "\Enter increment with + / decrement with - : ")) (setq strRep (vl-string-left-trim "0123456789" oldLabel)) (setq strFst (vl-string-trim strRep oldLabel)) (setq strEnd (vl-string-left-trim "+0123456789" strRep)) (setq sign (if (minusp inc) "-" "+")) (setq decs (if (= "-" sign) (- (atoi strRep) (abs inc) ) (+ (atoi strRep) (abs inc) ) )) (setq newLabel (if (= (fix (/ decs 100)) 1) (strcat (itoa (+ (atoi strFst) (fix (/ decs 100)))) sign "00" strEnd) (strcat strFst sign (itoa decs) strEnd))) Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.