bagulhodoido Posted February 22, 2010 Share Posted February 22, 2010 Hi there. Is there anyway to increase an atributte when copying some text. Like, I oftenly need to number walls on drawings. So, like, I copy the text EW 01 (exterior wall 01) and when I paste it, I want it to become EW 02. Thanks for your help. Quote Link to comment Share on other sites More sharing options...
paulmcz Posted February 22, 2010 Share Posted February 22, 2010 Hi there. Is there anyway to increase an atributte when copying some text. Like, I oftenly need to number walls on drawings. So, like, I copy the text EW 01 (exterior wall 01) and when I paste it, I want it to become EW 02. Thanks for your help. I use this: ;;; Replaces selected attribute value with new one and adds sequential number at the end ;;; Author paulmcz Copyright© 2006 (defun c:qs (/ ans st nw oerr e1 e2 natt) (setq oerr *error*) (defun *error* (msg) (princ "\n ERROR!") (setq *error* oerr) (command) (princ) ) (if ns (princ (strcat "\n Previous text = " ns (itoa stt))) ) (if ns (setq ans (getstring "\n Keep previous text? [ENTER = yes]: " ) ) ) (if (= ans "") () (setq ns nil st nil ) ) (if ns () (setq ns (getstring t "\n Type in new text: ")) ) (if stt () (setq stt 1) ) (princ "\n Start with number < ") (princ stt) (princ " >?: ") (setq st (getint)) (if (= st nil) (setq st stt) (setq stt st) ) (setq nw (strcat ns (itoa st))) (setq e1 (nentsel "\n Select attribute, do not miss: ")) (while e1 (setq e2 (entget (setq natt (car e1)))) (entmod (subst (cons 1 nw) (assoc 1 e2) e2)) (entupd natt) (if (eq (cdr (assoc 0 e2)) "ATTRIB") (setq st (+ 1 st)) (princ "\n You missed! ") ) (if st (setq nw (strcat ns (itoa st)) stt st ) ) (setq e1 (nentsel "\n Select next attribute or [ENTER] to exit: ")) ) (princ) ) (prompt "\n Type > qs < to update attributes: ") It is not made for copy & paste but it works the similar way. Try it. Quote Link to comment Share on other sites More sharing options...
bagulhodoido Posted February 22, 2010 Author Share Posted February 22, 2010 I use this: ;;; Replaces selected attribute value with new one and adds sequential number at the end ;;; Author paulmcz Copyright© 2006 (defun c:qs (/ ans st nw oerr e1 e2 natt) (setq oerr *error*) (defun *error* (msg) (princ "\n ERROR!") (setq *error* oerr) (command) (princ) ) (if ns (princ (strcat "\n Previous text = " ns (itoa stt))) ) (if ns (setq ans (getstring "\n Keep previous text? [ENTER = yes]: " ) ) ) (if (= ans "") () (setq ns nil st nil ) ) (if ns () (setq ns (getstring t "\n Type in new text: ")) ) (if stt () (setq stt 1) ) (princ "\n Start with number < ") (princ stt) (princ " >?: ") (setq st (getint)) (if (= st nil) (setq st stt) (setq stt st) ) (setq nw (strcat ns (itoa st))) (setq e1 (nentsel "\n Select attribute, do not miss: ")) (while e1 (setq e2 (entget (setq natt (car e1)))) (entmod (subst (cons 1 nw) (assoc 1 e2) e2)) (entupd natt) (if (eq (cdr (assoc 0 e2)) "ATTRIB") (setq st (+ 1 st)) (princ "\n You missed! ") ) (if st (setq nw (strcat ns (itoa st)) stt st ) ) (setq e1 (nentsel "\n Select next attribute or [ENTER] to exit: ")) ) (princ) ) (prompt "\n Type > qs < to update attributes: ") It is not made for copy & paste but it works the similar way. Try it. Thanks man. Btw, what am I supposed to select (and NOT MISS) when it prompts to select the attributes? I thought it was the text string so It would keep the desired style, but whenever I select the strings it prompts a "You missed!" Quote Link to comment Share on other sites More sharing options...
paulmcz Posted February 22, 2010 Share Posted February 22, 2010 Select attribute value to be updated or changed Quote Link to comment Share on other sites More sharing options...
bagulhodoido Posted February 22, 2010 Author Share Posted February 22, 2010 Select attribute value to be updated or changed Hmm, But what am I doing wrong? I select the text string I want to update and it says You missed! It does change the string for, in my case, EW1, but the next string I select becomes EW1 again and so it goes. I wanted it to be like, first one EW1, next string, EW2. You know, like that. That's how it works right? Quote Link to comment Share on other sites More sharing options...
paulmcz Posted February 22, 2010 Share Posted February 22, 2010 The green texts in the title block in the attached drawing are all attributes. If you start the routine and click on any of the green text, it should update with any next one having incremented number at the end. Try it and let me know if it works with the attached drawing. 10DX05,5HX2LXMELRWA32959.dwg Quote Link to comment Share on other sites More sharing options...
bagulhodoido Posted February 22, 2010 Author Share Posted February 22, 2010 The green texts in the title block in the attached drawing are all attributes. If you start the routine and click on any of the green text, it should update with any next one having incremented number at the end. Try it and let me know if it works with the attached drawing. Oh, that's what you ment by attributes. Hm, I don't really know how to manage them. I'll look on Autocad help files about creating blocks with attributes. Thanks for your help. Quote Link to comment Share on other sites More sharing options...
paulmcz Posted February 22, 2010 Share Posted February 22, 2010 If you just want to insert annotation incremental text, try my numbering routine. Read first few lines in the code, to see what it does. numbering.lsp Quote Link to comment Share on other sites More sharing options...
bagulhodoido Posted February 23, 2010 Author Share Posted February 23, 2010 If you just want to insert annotation incremental text, try my numbering routine. Read first few lines in the code, to see what it does. Exactly what I wanted. Amazing lisp. Thanks for your help. Quote Link to comment Share on other sites More sharing options...
paulmcz Posted February 23, 2010 Share Posted February 23, 2010 You are welcome Quote Link to comment Share on other sites More sharing options...
AJBuckers Posted August 5, 2011 Share Posted August 5, 2011 Hi Paul, firstly thanks for the lisp routine, it's great and very useful. One question though, I used it to incrementally number blocks on my drawings representing pile foundations. These often number into the 100's so when prompted with "start with number?" I entered 001 but the 0's were left out when I clicked on the attributes. Is there a way for the number to keep the 0's at the beginning? The 0's make the numbers list in order when I run a data extraction to create a piling table. Make sense? Cheers in advance. Quote Link to comment Share on other sites More sharing options...
paulmcz Posted August 5, 2011 Share Posted August 5, 2011 Try this. You don't have to type in the preceding zeros. It does it automatically. atted-00.lsp Quote Link to comment Share on other sites More sharing options...
AJBuckers Posted August 5, 2011 Share Posted August 5, 2011 Thanks a lot, perfect! Quote Link to comment Share on other sites More sharing options...
ajazraj Posted July 8, 2013 Share Posted July 8, 2013 If you just want to insert annotation incremental text, try my numbering routine. Read first few lines in the code, to see what it does. thanks for the lisp, i found it very helpful. Is it possible for u to edit the routine so that annotation incremental text gets aligned to curves and lines. Quote Link to comment Share on other sites More sharing options...
paulmcz Posted July 8, 2013 Share Posted July 8, 2013 No, it is not possible for me right now. Sorry. Quote Link to comment Share on other sites More sharing options...
ajazraj Posted July 9, 2013 Share Posted July 9, 2013 No, it is not possible for me right now. Sorry. ok, thanks by the way. Quote Link to comment Share on other sites More sharing options...
nnatev Posted September 11, 2017 Share Posted September 11, 2017 Using autocad architecture 2014 Lisp works great, but the location of the inserted text is not at the crosshairs. Can you fix this? Quote Link to comment Share on other sites More sharing options...
paulmcz Posted September 12, 2017 Share Posted September 12, 2017 If it is not inserted at the crosshairs, where is it inserted? 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.