Jump to content

Match Text LISP


Zorg

Recommended Posts

On 1/17/2019 at 1:39 PM, marko_ribar said:

Here is that code without BBCode Tags :

 

(defun c:mt  (/ cEnt mEnt)
 (if (and (setq cEnt (car (nentsel "\nSelect Source Text: ")))
          (member (cdr (assoc 0 (entget cEnt)))
                  '("TEXT" "MTEXT" "ATTRIB")))
   (progn
     (redraw cEnt 3)
     (while (and (setq mEnt (car (nentsel "\nSelect Destination Text: ")))
                 (member (cdr (assoc 0 (entget mEnt)))
                         '("TEXT" "MTEXT" "ATTRIB")))
       (entmod (subst (assoc 1 (entget cEnt))
                      (assoc 1 (entget mEnt))
                      (entget mEnt))))
     (redraw cEnt 4))
   (princ "\n<!> Incorrect Selection <!>"))
 (princ))



(defun c:mt2  (/ cEnt mEnt sLst)
 (if (and (setq cEnt (car (nentsel "\nSelect Source Text: ")))
          (member (cdr (assoc 0 (entget cEnt)))
                  '("TEXT" "MTEXT" "ATTRIB")))
   (progn
     (redraw cEnt 3)
     (if (setq ss (ssget "_X" '((-4 . "<NOT") (0 . "TEXT,MTEXT,INSERT") (-4 . "NOT>"))))
       (mapcar '(lambda (x) (redraw x 2)) (setq sLst (mapcar 'cadr (ssnamex ss)))))
     (while (and (setq mEnt (car (nentsel "\nSelect Destination Text: ")))
                 (member (cdr (assoc 0 (entget mEnt)))
                         '("TEXT" "MTEXT" "ATTRIB")))
       (entmod (subst (assoc 1 (entget cEnt))
                      (assoc 1 (entget mEnt))
                      (entget mEnt)))))
   (princ "\n<!> Incorrect Selection <!>"))
 (command "_regenall")
 (princ))



(defun c:mt3  (/ cEnt ss)
 (vl-load-com)
 (if (and (setq cEnt (car (nentsel "\nSelect Source Text: ")))
          (member (cdr (assoc 0 (entget cEnt)))
                  '("TEXT" "MTEXT" "ATTRIB")))
   (progn
     (redraw cEnt 3)
     (if (setq ss (ssget '((0 . "TEXT,MTEXT"))))
       (foreach x  (vl-remove-if 'listp
                     (mapcar 'cadr (ssnamex ss)))
         (entmod (subst (assoc 1 (entget cEnt))
                        (assoc 1 (entget x))
                        (entget x))))))
   (princ "\n<!> Incorrect Selection <!>"))
 (command "_regenall")
 (princ))

HTH., M.R.

Hello, 

 

Is possible to have this lisp to make also -match field to field - and - match text, mtext to field-   ?

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