jasonb_880 Posted September 2, 2009 Share Posted September 2, 2009 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 Quote Link to comment Share on other sites More sharing options...
paulmcz Posted September 2, 2009 Share Posted September 2, 2009 All the lisp files you already have can be easily modified to what you need. The mechanism is already there. Quote Link to comment Share on other sites More sharing options...
jasonb_880 Posted September 2, 2009 Author Share Posted September 2, 2009 how could i do that? Quote Link to comment Share on other sites More sharing options...
paulmcz Posted September 2, 2009 Share Posted September 2, 2009 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. Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted September 2, 2009 Share Posted September 2, 2009 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 Quote Link to comment Share on other sites More sharing options...
jasonb_880 Posted September 2, 2009 Author Share Posted September 2, 2009 hey, had a quick look through some of that there but cant see how i could increment 2 parts of the text line?? Cheers Quote Link to comment Share on other sites More sharing options...
paulmcz Posted September 2, 2009 Share Posted September 2, 2009 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? Quote Link to comment Share on other sites More sharing options...
jasonb_880 Posted September 3, 2009 Author Share Posted September 3, 2009 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... (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 Quote Link to comment Share on other sites More sharing options...
paulmcz Posted September 3, 2009 Share Posted September 3, 2009 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. Quote Link to comment Share on other sites More sharing options...
jasonb_880 Posted September 3, 2009 Author Share Posted September 3, 2009 not a lot of time to be honest but i'll take all the help i can get? Cheers Quote Link to comment Share on other sites More sharing options...
jasonb_880 Posted September 3, 2009 Author Share Posted September 3, 2009 what do you reccomend i do? Cheers Quote Link to comment Share on other sites More sharing options...
paulmcz Posted September 3, 2009 Share Posted September 3, 2009 My code asks user for increment number, starting number, prefix and suffix. What you need (if I understand it well [01/01/03-04]) is first starting number(fsn), second starting number (ssn), first increment number (fn), second increment number (sn), first text string (fts) and second text string (sts) in order of fts-fsn-sts-ssn, where fsn and ssn will be updated with each round in 'while' loop by fn and sn respectively. That means that you will have to put in all these user prompts and then assemble the user inputs in correct order and syntax before the "entmake" function can be executed. What you just did is you copied part of the code, overwrote the prompt string and left the variables as they are. That way you are overwriting the variables "ni", "nn", "n" and "np" (in the code), which were set by user to some values just prior to these added prompts. You have to asign new variables to "ssn" and "sn" to avoid this conflict. If nobody else jumps in while I am gone, read a lot in help files and in the links Lee Mac provided for you and we will continue when I am back. Quote Link to comment Share on other sites More sharing options...
jasonb_880 Posted September 3, 2009 Author Share Posted September 3, 2009 thanks a lot, i'll look into it and hopefully i'll sort it out! Cheers Quote Link to comment Share on other sites More sharing options...
paulmcz Posted September 8, 2009 Share Posted September 8, 2009 hopefully i'll sort it out! Cheers Did you? How far did you get? Quote Link to comment Share on other sites More sharing options...
jasonb_880 Posted September 8, 2009 Author Share Posted September 8, 2009 managed to get it sorted thanks, kinda understand how it all works now thanks a lot! Cheers Quote Link to comment Share on other sites More sharing options...
dober Posted September 8, 2009 Share Posted September 8, 2009 managed to get it sorted thanks, kinda understand how it all works now thanks a lot! Cheers Hallo Würdest du den Code hier reinstellen wollen, sowas könnte ich auch gebrauchen. Danke Quote Link to comment Share on other sites More sharing options...
ReMark Posted September 8, 2009 Share Posted September 8, 2009 It looks like dober (above) would very much like it if you could post the code here so he too could use it. Thanks. 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.