mtreyger Posted October 6, 2009 Share Posted October 6, 2009 Hey, New to the forums, old to CAD, might as well jump right in with my problem. I recently found this amazing lisp app by ASMI (AsmiTools_Renum.lsp) while i find this app very useful, there is another little attribute that i would like added to the lisp. As it stands, after you give your prefix/suffix/starting number, the lisp begins to start counting from 1 etc... The problem is that sometimes my blocks need to hold decimal places for counts that will be over 100/1000 etc... Would it be possible for the app to ask you how many integer places the sequential number should have. ie.. 3 places for example, so it starts the count at 001 instead of 1. or for 2 places, so it starts at 01, or 4 places, so it starts at 0001. If someone could include the code to do this, or edit the lisp itself, it would be greatly appreciated. Quote Link to comment Share on other sites More sharing options...
SteveK Posted October 6, 2009 Share Posted October 6, 2009 Hey, Quick question, why can't you just enter a 0 (or multiple zeros) when the program asks for a prefix? Admittedly you'd have to reset the program when you reach say 10, but is that so common? Quote Link to comment Share on other sites More sharing options...
SteveK Posted October 7, 2009 Share Posted October 7, 2009 Anyways I had a minute, something like this? (changes are highlighted) ;; ;; ;; ==================================================================== ;; ;; ;; ;; RENUM.LSP - This program converts TEXT, MTEXT and ATTRIBUTES in ;; ;; numbers with a prefix and a suffix. ;; ;; ;; ;; ==================================================================== ;; ;; ;; ;; Command(s) to call: RENUM ;; ;; ;; ;; Specify a suffix, a prefix and starting number (for erase the old ;; ;; suffix or prefix you should press Spacebar). Pick to TEXT, MTEXT ;; ;; ATTRIBUTES or press Esc to quit. The program remembers old ;; ;; properties and it is possible to confirm it pressing of Spacebar ;; ;; key. ;; ;; ;; ;; ==================================================================== ;; ;; ;; ;; THIS PROGRAM AND PARTS OF IT MAY REPRODUCED BY ANY METHOD ON ANY ;; ;; MEDIUM FOR ANY REASON. YOU CAN USE OR MODIFY THIS PROGRAM OR ;; ;; PARTS OF IT ABSOLUTELY FREE. ;; ;; ;; ;; THIS PROGRAM PROVIDES 'AS IS' WITH ALL FAULTS AND SPECIFICALLY ;; ;; DISCLAIMS ANY IMPLIED WARRANTY OF MERCHANTABILITY OR FITNESS ;; ;; FOR A PARTICULAR USE. ;; ;; ;; ;; ==================================================================== ;; ;; ;; ;; V1.0, 16 June, 2005, Riga, Latvia ;; ;; © Aleksandr Smirnov (ASMI) ;; ;; For AutoCAD 2000 - 2008 (isn't tested in a next versions) ;; ;; ;; ;; http://www.asmitools.com ;; ;; ;; ;; ==================================================================== ;; (defun c:renum (/ oldPref oldSuf oldStart curText curStr [color=Blue]numZeros[/color]) (vl-load-com) [color=Blue] (initget 6) (setq numZeros (getInt "\nEnter number of 0 prefix's:")) (defun num2str (num / numStr) (setq numStr (itoa num)) (If (< (strlen numStr) numZeros) (repeat (- numZeros (strlen numStr)) (setq numStr (strcat "0" numStr)) ) ) numStr )[/color] (if(not rnm:Pref)(setq rnm:Pref "")) (if(not rnm:Suf)(setq rnm:Suf "")) (if(not rnm:Start)(setq rnm:Start 1)) (setq oldPref rnm:Pref oldSuf rnm:Suf oldStart rnm:Start); end setq (setq rnm:Pref (getstring T (strcat "\nPrefix: <"rnm:Pref">: "))) (if(= "" rnm:Pref)(setq rnm:Pref oldPref)) (if(= " " rnm:Pref)(setq rnm:Pref "")) (setq rnm:Suf (getstring T (strcat "\nSuffix: <"rnm:Suf">: "))) (if(= "" rnm:Suf)(setq rnm:Suf oldSuf)) (if(= " " rnm:Suf)(setq rnm:Suf "")) (setq rnm:Start (getint (strcat "\nStarting number <" (itoa rnm:Start)">: "))) (if(null rnm:Start)(setq rnm:Start oldStart)) (while T (setq curStr(strcat rnm:Pref([color=Blue]num2Str[/color] rnm:Start)rnm:Suf)) (setq curText (car (nentsel "\n<<< Pick TEXT, MTEXT or ATTRIBUTE or press Esc to quit >>> "))) (if (and curText (member(cdr(assoc 0(entget curText))) '("TEXT" "MTEXT" "ATTRIB")) ); end and (progn (vla-put-TextString (vlax-ename->vla-object curText)curStr) (setq rnm:Start(1+ rnm:Start)) ); end progn (princ "\n This is not DText or MText ") ); end if ); end while (princ) ); end of c:renum (princ "\n[info] http:\\\\www.AsmiTools.com [info]") (princ "\n[info] Renumber tool. Type RENUM to run. [info]") Quote Link to comment Share on other sites More sharing options...
mtreyger Posted October 7, 2009 Author Share Posted October 7, 2009 its actually very common, being a telecom consultant, i have to label outlets in a office building, so we're talking hundreds of outlets per floor im going to try the code addition and see if it works shortly. Quote Link to comment Share on other sites More sharing options...
mtreyger Posted October 7, 2009 Author Share Posted October 7, 2009 amazing work steve, works like a charm, thank you Quote Link to comment Share on other sites More sharing options...
SteveK Posted October 7, 2009 Share Posted October 7, 2009 No problem. Not sure if you'll find it more useful but have you tried Lee Mac's Number Incrementing program? Quote Link to comment Share on other sites More sharing options...
vinod Posted July 2, 2010 Share Posted July 2, 2010 Anyways I had a minute, something like this? (changes are highlighted) ;; ;; ;; ==================================================================== ;; ;; ;; ;; RENUM.LSP - This program converts TEXT, MTEXT and ATTRIBUTES in ;; ;; numbers with a prefix and a suffix. ;; ;; ;; ;; ==================================================================== ;; ;; ;; ;; Command(s) to call: RENUM ;; ;; ;; ;; Specify a suffix, a prefix and starting number (for erase the old ;; ;; suffix or prefix you should press Spacebar). Pick to TEXT, MTEXT ;; ;; ATTRIBUTES or press Esc to quit. The program remembers old ;; ;; properties and it is possible to confirm it pressing of Spacebar ;; ;; key. ;; ;; ;; ;; ==================================================================== ;; ;; ;; ;; THIS PROGRAM AND PARTS OF IT MAY REPRODUCED BY ANY METHOD ON ANY ;; ;; MEDIUM FOR ANY REASON. YOU CAN USE OR MODIFY THIS PROGRAM OR ;; ;; PARTS OF IT ABSOLUTELY FREE. ;; ;; ;; ;; THIS PROGRAM PROVIDES 'AS IS' WITH ALL FAULTS AND SPECIFICALLY ;; ;; DISCLAIMS ANY IMPLIED WARRANTY OF MERCHANTABILITY OR FITNESS ;; ;; FOR A PARTICULAR USE. ;; ;; ;; ;; ==================================================================== ;; ;; ;; ;; V1.0, 16 June, 2005, Riga, Latvia ;; ;; © Aleksandr Smirnov (ASMI) ;; ;; For AutoCAD 2000 - 2008 (isn't tested in a next versions) ;; ;; ;; ;; http://www.asmitools.com ;; ;; ;; ;; ==================================================================== ;; (defun c:renum (/ oldPref oldSuf oldStart curText curStr [color=blue]numZeros[/color]) (vl-load-com) [color=blue] (initget 6)[/color] [color=blue] (setq numZeros (getInt "\nEnter number of 0 prefix's:"))[/color] [color=blue] (defun num2str (num / numStr)[/color] [color=blue] (setq numStr (itoa num))[/color] [color=blue] (If (< (strlen numStr) numZeros)[/color] [color=blue] (repeat (- numZeros (strlen numStr))[/color] [color=blue] (setq numStr (strcat "0" numStr))[/color] [color=blue] )[/color] [color=blue] )[/color] [color=blue] numStr[/color] [color=blue] )[/color] (if(not rnm:Pref)(setq rnm:Pref "")) (if(not rnm:Suf)(setq rnm:Suf "")) (if(not rnm:Start)(setq rnm:Start 1)) (setq oldPref rnm:Pref oldSuf rnm:Suf oldStart rnm:Start); end setq (setq rnm:Pref (getstring T (strcat "\nPrefix: <"rnm:Pref">: "))) (if(= "" rnm:Pref)(setq rnm:Pref oldPref)) (if(= " " rnm:Pref)(setq rnm:Pref "")) (setq rnm:Suf (getstring T (strcat "\nSuffix: <"rnm:Suf">: "))) (if(= "" rnm:Suf)(setq rnm:Suf oldSuf)) (if(= " " rnm:Suf)(setq rnm:Suf "")) (setq rnm:Start (getint (strcat "\nStarting number <" (itoa rnm:Start)">: "))) (if(null rnm:Start)(setq rnm:Start oldStart)) (while T (setq curStr(strcat rnm:Pref([color=blue]num2Str[/color] rnm:Start)rnm:Suf)) (setq curText (car (nentsel "\n<<< Pick TEXT, MTEXT or ATTRIBUTE or press Esc to quit >>> "))) (if (and curText (member(cdr(assoc 0(entget curText))) '("TEXT" "MTEXT" "ATTRIB")) ); end and (progn (vla-put-TextString (vlax-ename->vla-object curText)curStr) (setq rnm:Start(1+ rnm:Start)) ); end progn (princ "\n This is not DText or MText ") ); end if ); end while (princ) ); end of c:renum (princ "\n[info] http:\\\\www.AsmiTools.com [info]") (princ "\n[info] Renumber tool. Type RENUM to run. [info]") I've got what I was looking for long time. It's working in my laptop and failed to get the same result in my office system which installed the same version (Acad2009) Autocad. I've been receiving error message something like 'cant paste text'. Please get me a solution in this regard. Thanks in advance Quote Link to comment Share on other sites More sharing options...
alanjt Posted July 2, 2010 Share Posted July 2, 2010 Works fine on my end. Can't say I've ever seen the 'can't past text' error. Are you trying it on the same drawing? Post a sample drawing. Quote Link to comment Share on other sites More sharing options...
vinod Posted July 4, 2010 Share Posted July 4, 2010 :oI have tried it on the same drawing in different machines. The difference is 34 bit Autocad in my office sysytem and 64 bit in my laptop. Quote Link to comment Share on other sites More sharing options...
vinod Posted July 4, 2010 Share Posted July 4, 2010 Works fine on my end. Can't say I've ever seen the 'can't past text' error. Are you trying it on the same drawing? Post a sample drawing. A little bit crazzzy.. Today I've got the error related to ActiveX Any idea ? Quote Link to comment Share on other sites More sharing options...
alanjt Posted July 4, 2010 Share Posted July 4, 2010 :oI have tried it on the same drawing in different machines. The difference is 34 bit Autocad in my office sysytem and 64 bit in my laptop. It's 32 or 64 bit. No such thing as 34 - must be divisible by 8. A little bit crazzzy.. Today I've got the error related to ActiveXAny idea ? Not sure what error you are referring to. Why don't you post the exact error displayed. 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.