KBJockey Posted December 19, 2012 Posted December 19, 2012 My second similar question..i will give it a try again…below are the example I want to make an increment by clicking the existing attributes, the letters will remain at is only the last 1 or 2 digits will change to 1,2,3 and so on….how can do this using lisp…thanks for your help. Eg. ABCD-00 TO ABCD-01 EFGH-00 TO EFGH-02 IJKLM-00 TO IJKLM-03 Quote
Dadgad Posted December 19, 2012 Posted December 19, 2012 Welcome to the forum. Sorry I can't help you with this, except to suggest that your question would be better posted in the lisp forum than the Autocad General forum. In that way you can be reasonably sure that the lisperati will see it, and hopefully show you the way. I hope somebody can help you, just be patient. Perhaps a moderator can move this to the lisp forum? Quote
ReMark Posted December 19, 2012 Posted December 19, 2012 Maybe Lee Mac has a custom routine in his bag of tricks that might work. I've yet to check however. Quote
KBJockey Posted December 19, 2012 Author Posted December 19, 2012 Thank for your tips dadgad, better to post this in lisp forum I thought I was in the right forum…yes ReMark Lee Mac has this called Numinc.lsp but im afraid that my situation is different & not suitable in his lisp program… Quote
KBJockey Posted December 19, 2012 Author Posted December 19, 2012 Below are the example, I want to make an increment by clicking the existing attributes, the letters will remain at is and only the last 1 or 2 digits will change to 1,2,3 and so on….is there any lisp that can do this…i hope someone can help me :(thanks in advance... Eg. ABCD-00 TO ABCD-01 EFGH-00 TO EFGH-02 IJKLM-00 TO IJKLM-03 etc... Quote
Lee Mac Posted December 19, 2012 Posted December 19, 2012 Here is a function to increment a numerical suffix: ([color=BLUE]defun[/color] incsuff ( s [color=BLUE]/[/color] _incsuff ) ([color=BLUE]defun[/color] _incsuff ( l ) ([color=BLUE]cond[/color] ( ([color=BLUE]=[/color] 57 ([color=BLUE]car[/color] l)) ([color=BLUE]if[/color] ([color=BLUE]<[/color] 47 ([color=BLUE]cadr[/color] l) 58) ([color=BLUE]cons[/color] 48 (_incsuff ([color=BLUE]cdr[/color] l))) ([color=BLUE]cons[/color] 48 ([color=BLUE]cons[/color] 49 ([color=BLUE]cdr[/color] l))) ) ) ( ([color=BLUE]<[/color] 47 ([color=BLUE]car[/color] l) 58) ([color=BLUE]cons[/color] ([color=BLUE]1+[/color] ([color=BLUE]car[/color] l)) ([color=BLUE]cdr[/color] l)) ) ( l ([color=BLUE]cons[/color] ([color=BLUE]car[/color] l) (_incsuff ([color=BLUE]cdr[/color] l))) ) ) ) ([color=BLUE]vl-list->string[/color] ([color=BLUE]reverse[/color] (_incsuff ([color=BLUE]reverse[/color] ([color=BLUE]vl-string->list[/color] s))))) ) _$ (incsuff "ABCD-00") "ABCD-01" Now that the core of the program is written, you are left to write the program to prompt for text selection and modify the content. Quote
SLW210 Posted December 19, 2012 Posted December 19, 2012 I merged your threads, in the future just ask a Moderator to move your thread. Quote
KBJockey Posted December 20, 2012 Author Posted December 20, 2012 thank you LeeMac idol:) i will do the rest..... Quote
KBJockey Posted December 20, 2012 Author Posted December 20, 2012 I merged your threads, in the future just ask a Moderator to move your thread. thanks, for the next time... i will ask. Quote
Lee Mac Posted December 22, 2012 Posted December 22, 2012 thank you LeeMac idol:) i will do the rest..... You're very welcome - good luck! Quote
pBe Posted December 22, 2012 Posted December 22, 2012 Here is a function to increment a numerical suffix: ([color=BLUE]defun[/color] incsuff ( s [color=BLUE]/[/color] _incsuff ) ............... Brilliant Quote
Lee Mac Posted December 22, 2012 Posted December 22, 2012 Brilliant Many thanks Patrick, I appreciate the time you have spent to look over and study my code Quote
GP_ Posted December 22, 2012 Posted December 22, 2012 Here is a function to increment a numerical suffix: ([color=blue]defun[/color] incsuff ( s [color=blue]/[/color] _incsuff ) ................................. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Quote
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.