Jump to content

copy Mtxt into block


Ozymandias

Recommended Posts

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!

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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))
                

Link to comment
Share on other sites

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...