		; Kopie textu ze zdrojové textové entity na cílové entity (ve stejném prostoru)
		; (copy text content from a source text entity to target text entities)
		; z www.cadforum.cz (Pajas+Hadraba)
		;
(defun C:KOPIRUJTEXT (/ sel text blky jb te s_jba at atr) ;TE
  (while (not sel)
    (princ "\n*** Vyberte kopírovaný text: ")
    (setq sel (entget (car (nentsel))))
    (if	(and (/= (cdr (assoc 0 sel)) "TEXT")
	     (/= (cdr (assoc 0 sel)) "MTEXT")
	     (/= (cdr (assoc 0 sel)) "ATTDEF")
	     (/= (cdr (assoc 0 sel)) "ATTRIB")
	     (/= (cdr (assoc 0 sel)) "MULTILEADER")
	)
      (progn
	(prompt
	  "\n*** Vybraná entita není text, mtext, multileader ani atribut."
	)
	(setq sel nil)
      )
      sel
    )
  )
  (if (or (= (cdr (assoc 0 sel)) "TEXT")
	  (= (cdr (assoc 0 sel)) "MTEXT")
	  (= (cdr (assoc 0 sel)) "ATTRIB")
      )
    (setq text (cdr (assoc 1 sel)))
    (setq text (cdr (assoc 2 sel)))
  )
  (if (= (cdr (assoc 0 sel)) "MULTILEADER")

    (setq text (cdr (assoc 304 sel)))

  )
  (princ text)
;;;Výběr atributů
  (princ
    "\n*** Vyberte položky pro nakopírování nového textu: "
  )
  (setq	blky (ssget
	       '((-4 . "<OR")
		 (0 . "TEXT")
		 (0 . "MTEXT")
		 (0 . "ATTDEF")
		 (0 . "MULTILEADER")
		 (-4 . "OR>")
		)
	     )
  )
  (setq nt 0)
  (repeat (sslength blky)
    (setq jb (ssname blky nt)
	  te (cdr (assoc '0 (entget jb)))
	  nt (1+ nt)
    )
    (if	(or (= "TEXT" te) (= "MTEXT" te) (= "ATTDEF" te)(= "MULTILEADER" te))
      (setq s_jba (append s_jba (list (list jb jb)))
		  ;;seznam entit
      )
    )
  )
  (princ (strcat "*** Nalezeno "
		 (itoa (length s_jba))
		 " přepisovatelných položek."
	 )
  )
;;;Číslování
  (setq nt 0)
  (while (< nt (length s_jba))
    (setq atr (cdr (assoc '0 (entget (cadr (nth nt s_jba))))))
    (if	(or (= atr "TEXT") (= atr "MTEXT"))
      (setq at
	     (subst
	       (cons 1 text)
	       (assoc '1 (entget (cadr (nth nt s_jba))))
	       (entget (cadr (nth nt s_jba)))
	     )
      )
      (if (= atr "MULTILEADER")
	(setq at
	       (subst
		 (cons 304 text)
		 (assoc '304 (entget (cadr (nth nt s_jba))))
		 (entget (cadr (nth nt s_jba)))
	       )
	)
	(setq at
	       (subst
		 (cons 2 text)
		 (assoc '2 (entget (cadr (nth nt s_jba))))
		 (entget (cadr (nth nt s_jba)))
	       )
	)
      )
    )
    (entmod at)
    (entupd (car (nth nt s_jba)))
    (setq nt (1+ nt))
  )
  (princ)
)
;;;Konec Okopírování textu 
