Message 1 of 4
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
hello guys, I'm trying to modify a program that should transfers the content of a text to other text fields regardless of whether the recipients are text or multiple text
But I'm having problems with the conditional that discriminates between both types of target entities, only works for multiple text.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (defun c:txtransfer() ;;copy tx content from a field to others (setvar "cmdecho" 0) (setq oldcmd (getvar "pickbox")) (setvar "pickbox" 15) (setq eset1(ssget '((-4 . "<or")(0 . "text") (0 . "mtext")(-4 . "or>")))) (setq pre (cdr (assoc 1 (entget (ssname eset1 0))))) (setq ss (ssget)) (setq i -1) (while (setq en (ssname ss (setq i (1+ i)))) (setq enlist(entget en)) (if ;;;;;;;Here is the conditional with the problem (or (equal "text" (cdr(assoc 0 enlist))) (equal "mtext" (cdr(assoc 0 enlist))) );;or ;;;;;;;Here is the conditional with the problem (progn (setq str(strcat pre)) (setq enlist(subst (cons 1 str)(assoc 1 enlist) enlist)) (entmod enlist) );progn );if (setq ernote "select text only please.") );while (setq ernote "nothing selected.") (setvar "cmdecho" 1) (princ "\n \n ") (princ ernote) (setvar "pickbox" oldcmd ) (princ pre) ) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
Thanks for all
Here is the initial code I am working with:
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (defun c:txtransfer() ;;copy tx content from a field to others (setvar "cmdecho" 0) (setq oldcmd (getvar "pickbox")) (setvar "pickbox" 15) (setq eset1(ssget '((-4 . "<or")(0 . "text") (0 . "mtext")(-4 . "or>")))) (setq pre (cdr (assoc 1 (entget (ssname eset1 0))))) (setq ss (ssget)) (setq i -1) (while (setq en (ssname ss (setq i (1+ i)))) (setq enlist(entget en))
;;;here no conditional (if (= "mtext" (cdr(assoc 0 enlist)))
;;;here no conditional (progn (setq str(strcat pre)) (setq enlist(subst (cons 1 str)(assoc 1 enlist) enlist)) (entmod enlist) );progn );if (setq ernote "select text only please.") );while (setq ernote "nothing selected.") (setvar "cmdecho" 1) (princ "\n \n ") (princ ernote) (setvar "pickbox" oldcmd ) (princ pre) ) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
Solved! Go to Solution.