Jump to content

Increment Numbers


gS7

Recommended Posts

Hi all !!!

 

Guys Please Tel me How To Increment Numbers ..........

 

1.Starting No. (Example:2 is Stating No)

2.Increment No(Example :2 Is Increment)

3.when i click to a text it Should Change Text Value 4

while

6,8,10,12,14....................

 

 

:cry:

Link to comment
Share on other sites

I think you would learn a great deal about incrementing numbers if you were to take a look at Lee Mac's Incremental Numbering Suite lisp routine which can be found here...

 

http://lee-mac.com/lisp/NumIncV3-2.lsp

 

If you have further questions you can always come back here and ask. Lee or one of the other lisp masters will gladly assist you.

Link to comment
Share on other sites

Quick demo, Not a great deal, but its a start :)

 

(defun c:demo  (/ _def obj)
(vl-load-com)
[b][color=blue](defun _def (msg def)
    (setq def  (cond ((getint (strcat msg
                               (if def (strcat " <" (itoa def) ">: ") ": ")
                           )))
                   (   def   ))))
[/color][/b] (setq startNumber [color=blue][b](_def "\nStart Nummber: " startNumber)[/b][/color])     
(setq IncrementNumber [b][color=blue](_def "\nIncrement Nummber: " IncrementNumber)[/color][/b])    
(while (setq obj (ssget "_+.:S:E:L"
                                         '((0 . "*TEXT"))))
                       (vla-put-textstring
                             (vlax-ename->vla-object
                                   (ssname obj 0))
                             startNumber)
                       (setq startNumber
                                  (+ startNumber
                                     IncrementNumber))
                       )
     (princ)
     )
     

Edited by pBe
add default value
Link to comment
Share on other sites

Great...!!!!! pBe .....i Got what i exactly needed ........

 

ok tell me How to to put Next Increment Value in to Users1 or Users2 .......

 

display next text value in selection line

 

 

(sorry for my poor english )

Link to comment
Share on other sites

You are welcome gs7 :)

 

Why do you need the value assinged to USERS1? I assume its for the just "display"? does that mean everytime you pick you want to be able to see whats the next increment? Or are you pertaining to "Default value" to show the last number the nex time you use the routine?

 

BTW: Welcome to CADTutor

Link to comment
Share on other sites

Or are you pertaining to "Default value" to show the last number the nex time you use the routine?

 

 

yes exactly right pBe ..... i wnt to do like that only

Link to comment
Share on other sites

Wow !! its working nicely ......

Tank u pBe ........

 

You are Welcome gS7, hope you will learn a bit from that code.

 

Cheers

Link to comment
Share on other sites

For anyone who is using LT and so can't use lisp try these-

 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Put the following string on a user defined menu button.

 

*^C^C_text;\;;$M=$(+,$(getvar,USERI1),1);setvar;US ERI1;$M=$(+,$(getvar,USERI1),1);

 

This puts a new text with an incremented value on the drawing with each click of your mouse.

 

You can also use SETVAR to change USERI1 to 1 below whatever initial value you want.

 

Many thanks to ZOOMHARIS on the AUGI forum.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

 

AND this one increments text that is already on the drawing

 

 

*^C^C_.Change;\;;;;;;$M=$(getvar,USERI1);_.Setvar; USERI1;$(+,1 ,$(getvar,USERI1))

 

This time though set USERI1 to the value you want to start with.

 

Thanks to MIKE.PERRY the AUGI director

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Link to comment
Share on other sites

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