Ozymandias Posted February 3, 2010 Share Posted February 3, 2010 Hey guys I hope your all good, I have a bit of a quiry to help quicken up a repetetive task. I have created a block that I put into the middle of a room and this block has various bits of information on it. I have a piece of script that allows me to click on a polyline and then click on a one of the txt fields on the block and it will insert the area. The question here is I have som room numbers that I would like to put into the block and I was wondering if someone had a lisp that would allow me to click on the original text and then click the target location replacing the target text with first selected text. i,.e. replace "room number" with "CX340B" or "OG01A" .. Thus saving me having to go into the field and manually type in the room number. It would literally save me hours worth of mundane work. you would be my hero! Quote Link to comment Share on other sites More sharing options...
Ozymandias Posted February 3, 2010 Author Share Posted February 3, 2010 I have had a go at creating something but when I load this into CAD and try to run it i get the "unkown command" message. (defun c:rtxt () (command "ddedit") (command "Copy") (command "") (command "esc") (command "_eattedit") (command "Paste") (command "") (command "") any help would be appreciated. Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted February 3, 2010 Share Posted February 3, 2010 Try this: (defun c:atxt (/ ent1 ent2 eLst) ;; Lee Mac ~ 03.02.10 (while (progn (setq ent1 (car (entsel "\nSelect Text: "))) (cond ( (eq 'ENAME (type ent1)) (if (member (cdr (assoc 0 (entget ent1))) '("TEXT" "MTEXT")) (while (progn (setq ent2 (car (nentsel "\nSelect Attrib: "))) (cond ( (eq 'ENAME (type ent2)) (if (eq "ATTRIB" (cdr (assoc 0 (setq eLst (entget ent2))))) (entupd (cdr (assoc -1 (entmod (subst (assoc 1 (entget ent1)) (assoc 1 eLst) eLst))))) (princ "\n** Object Must be an Attrib **")))))) (princ "\n** Object Must be Text **")))))) (princ)) Quote Link to comment Share on other sites More sharing options...
Ozymandias Posted February 3, 2010 Author Share Posted February 3, 2010 Thank you very much.. I take it my way of putting in commands doesnt really work its really sped up a monotonous task !!! Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted February 3, 2010 Share Posted February 3, 2010 Thank you very much.. I take it my way of putting in commands doesnt really work its really sped up a monotonous task !!! You're welcome 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.