+ Reply to Thread
Page 1 of 2 1 2 LastLast
Results 1 to 10 of 17
  1. #1
    Forum Newbie
    Using
    AutoCAD 2006
    Join Date
    Sep 2009
    Posts
    8

    Default Number Increment...

    Registered forum members do not see this ad.

    Hey guys, looking for some help here,
    i've found various lisp files for incrementing numbers but none that do multiple numbers in a single text line i.e. 01/01/01-02 then the next being 01/01/03-04 then 01/01/05-06 and so on...

    Anyone got any ideas??

    Cheers,

    Jason

  2. #2
    Senior Member
    Using
    not specified
    Join Date
    Dec 2004
    Location
    YUL
    Posts
    484

    Default

    All the lisp files you already have can be easily modified to what you need. The mechanism is already there.

  3. #3
    Forum Newbie
    Using
    AutoCAD 2006
    Join Date
    Sep 2009
    Posts
    8

    Default

    how could i do that?

  4. #4
    Senior Member
    Using
    not specified
    Join Date
    Dec 2004
    Location
    YUL
    Posts
    484

    Default

    Open one of them in "_vlide" go to help to learn what does what and you'll be able to figure out the rest. I did it the same way.

  5. #5
    Quantum Mechanic Lee Mac's Avatar
    Computer Details
    Lee Mac's Computer Details
    Operating System:
    Windows 7 Ultimate (32-bit)
    Discipline
    Multi-disciplinary
    Lee Mac's Discipline Details
    Discipline
    Multi-disciplinary
    Details
    Custom Programming / Software Customisation
    Using
    AutoCAD 2013
    Join Date
    Aug 2008
    Location
    London, England
    Posts
    15,816

    Default

    Quote Originally Posted by paulmcz View Post
    Open one of them in "_vlide" go to help to learn what does what and you'll be able to figure out the rest. I did it the same way.
    DIY is the best way to learn imo...

    And if you need more guidance see here:



    http://www.cadtutor.net/forum/showthread.php?t=38760



    http://www.cadtutor.net/forum/showthread.php?t=38734



    http://www.afralisp.net/



    http://www.jefferypsanders.com/autolisptut.html



    http://ronleigh.info/autolisp/index.htm



    http://midpointcad.com/au/docs/lakose_The_Visual_LISP_Developers_Bible.pdf
    Lee Mac Programming

    With Mathematics there is the possibility of perfect rigour, so why settle for less?

    Just another Swamper

  6. #6
    Forum Newbie
    Using
    AutoCAD 2006
    Join Date
    Sep 2009
    Posts
    8

    Default

    hey, had a quick look through some of that there but cant see how i could increment 2 parts of the text line??

    Cheers

  7. #7
    Senior Member
    Using
    not specified
    Join Date
    Dec 2004
    Location
    YUL
    Posts
    484

    Default

    Of course not. Quick look will not get you very far. It takes some effort.
    What routine or part of the routine are you looking at?

  8. #8
    Forum Newbie
    Using
    AutoCAD 2006
    Join Date
    Sep 2009
    Posts
    8

    Default

    hey, i've managed to get it to the stage it asks for the 2nd number but it only inserts and increments the 1st number...


    Code:
    (defun c:dinc (/ p n ni pref suff nns ntx ntxx oecho osn ds th txt)
    (setq oecho (getvar "cmdecho")
    osn (getvar "osmode")
    )
    (if (= 0 (getvar "dimscale"))(setq ds 1.0)(setq ds (getvar "dimscale")))
    (setq th (getvar "dimtxt"))
    (setq txt (* th ds))
    (setvar "cmdecho" 0)
    (setvar "osmode" 0)
    (if nn
    (setq nn (fix nn))
    (setq nn 1)
    )
    (if (= nn 0)(setq nn 1))
    (princ "\n Increment numbers by < ")
    (princ nn)
    (princ " >? : ")
    (setq ni (getint))
    (if (= ni nil)
    (setq ni nn)
    (setq nn ni)
    )
    (if np
    (setq np (fix np))
    (setq np nn)
    )
    (princ "\n Start or continue with number < ")
    (princ np)
    (princ " >? : ")
    (setq n (getint))
    (if (= n nil)
    (setq n np)
    (setq np n)
    )
    (setq nns (itoa n))
    (princ "\n Prefix text < ")
    (princ pre)
    (princ " >? or <.> for none: ")
    (setq pref (getstring t))
    (if (= pref ".")
    (progn
    (setq pre nil)
    (setq pref nil)
    )
    (progn
    (if (= pref "")
    (setq pref pre)
    (setq pre pref)
    )
    (if pref
    (setq ntx (strcat pref nns))
    )
    )
    )
    (princ "\n Suffix text < ")
    (princ suf)
    (princ " >- or <.> for none: ")
    (setq suff (getstring t))
    (if (= suff ".")
    (progn
    (setq suf nil)
    (setq suff nil)
    )
    (progn
    (if (= suff "")
    (setq suff suf)
    (setq suf suff)
    )
    (if suff
    (if pref
    (setq ntxx (strcat pref nns suff))
    (setq ntxx (strcat nns suff))
    )
    )
    )
    )
    (if (= nn 0)(setq nn 1))
    (princ "\n Increment 2nd number by < ")
    (princ nn)
    (princ " >? : ")
    (setq ni (getint))
    (if (= ni nil)
    (setq ni nn)
    (setq nn ni)
    )
    (if np
    (setq np (fix np))
    (setq np nn)
    )
    (princ "\n 2nd number < ")
    (princ np)
    (princ " >? : ")
    (setq n (getint))
    (if (= n nil)
    (setq n np)
    (setq np n)
    )
    (setq p (getpoint "\n Insert: "))
    (setq oecho (getvar "cmdecho"))
    (while p
    (if suff
    ;(command "text" "j" "mc" p "" "" ntxx)
    (entmake (list (cons 0 "TEXT")
    (cons 10 p)
    (cons 11 p)
    (cons 1 ntxx) ; actual text
    (cons 7 (getvar "TEXTSTYLE"))
    (cons 40 txt)
    (cons 72 4)
    )
    )
    (if pref
    ;(command "text" "j" "mc" p "" "" ntx)
    (entmake (list (cons 0 "TEXT") 
    (cons 10 p) 
    (cons 11 p) 
    (cons 1 ntx); actual text
    (cons 7 (getvar "TEXTSTYLE"))
    (cons 40 txt)
    (cons 72 4)
    )
    )
    ;(command "text" "j" "mc" p "" "" n)
    (entmake (list (cons 0 "TEXT") 
    (cons 10 p) 
    (cons 11 p) 
    (cons 1 n); actual text
    (cons 7 (getvar "TEXTSTYLE"))
    (cons 40 txt)
    (cons 72 4)
    )
    )
    )
    )
    (setq p (getpoint "\n Next number location: ")
    n (+ ni n)
    nns (itoa n)
    np n
    )
     
    (if suff
    (if pref
    (setq ntxx (strcat pref nns suff))
    (setq ntxx (strcat nns suff))
    )
    )
    (if pref
    (if suff
    (setq ntxx (strcat pref nns suff))
    (setq ntx (strcat pref nns))
    )
    )
    )
    (setvar "cmdecho" oecho)
    (setvar "osmode" osn)
    (princ)
    )
    (princ "\n Type > DINC < to insert text with ascending integers.")
    not sure what to do next??

    Cheers
    Last edited by jasonb_880; 3rd Sep 2009 at 10:28 am.

  9. #9
    Senior Member
    Using
    not specified
    Join Date
    Dec 2004
    Location
    YUL
    Posts
    484

    Default

    Because this is an extract from the routine I wrote a few years back, I am willing to help you to modify it. I will not do it for you though.

    How much time you have for this? I am leaving now and will be gone for about a week.

    If someone else wants to jump in, by all means.

  10. #10
    Forum Newbie
    Using
    AutoCAD 2006
    Join Date
    Sep 2009
    Posts
    8

    Default

    Registered forum members do not see this ad.

    not a lot of time to be honest but i'll take all the help i can get?

    Cheers

Similar Threads

  1. lisp want for increment
    By harshad in forum AutoLISP, Visual LISP & DCL
    Replies: 12
    Last Post: 31st Oct 2010, 11:14 pm
  2. Automated number insert and increment*noob*
    By bograd in forum AutoLISP, Visual LISP & DCL
    Replies: 8
    Last Post: 29th Jan 2010, 09:54 am
  3. Copy and Increment Text
    By cedwards in forum AutoLISP, Visual LISP & DCL
    Replies: 4
    Last Post: 26th Aug 2009, 03:04 pm
  4. Copy and increment
    By richard3009 in forum AutoCAD Beginners' Area
    Replies: 3
    Last Post: 21st May 2009, 11:53 pm
  5. Increment Number automatically
    By RCFun in forum AutoCAD General
    Replies: 1
    Last Post: 8th Aug 2003, 11:35 pm

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts