Jump to content

Recommended Posts

Posted

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

Posted

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?

Posted

Maybe Lee Mac has a custom routine in his bag of tricks that might work. I've yet to check however.

Posted

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…

Posted

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...

Posted

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.

Posted

I merged your threads, in the future just ask a Moderator to move your thread.

Posted

thank you LeeMac idol:) i will do the rest.....

Posted
I merged your threads, in the future just ask a Moderator to move your thread.

 

thanks, for the next time... i will ask.

Posted
thank you LeeMac idol:) i will do the rest.....

 

You're very welcome - good luck!

Posted
Here is a function to increment a numerical suffix:

([color=BLUE]defun[/color] incsuff ( s [color=BLUE]/[/color] _incsuff )
   ...............

 

Brilliant :thumbsup:

Posted
Brilliant :thumbsup:

 

Many thanks Patrick, I appreciate the time you have spent to look over and study my code :)

Posted
Here is a function to increment a numerical suffix:

 

([color=blue]defun[/color] incsuff ( s [color=blue]/[/color] _incsuff )
.................................

 

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

applausi.gif

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...