Author Topic: Updating a block routine, ...  (Read 4886 times)

0 Members and 1 Guest are viewing this topic.

deegeecees

  • Guest
Re: Updating a block routine, ...
« Reply #15 on: May 09, 2007, 11:44:08 AM »
Code: [Select]
(defun c:TY (/ oldecho oldos Sel EntData Txt)
  (defun $error (msg /)
    (if (or (= msg "Function cancelled")
            (/= msg "quit / exit abort")
        )
        (princ (strcat "Error: " msg))
    )
    (command ".undo" "e" "undo" "")
    (command ".redraw")
    (setvar "cmdecho" oldecho)
    (setq *error* old_err)
    (princ)
  );end error
  (setq old_err *error*
        *error* $error
        oldecho (getvar "cmdecho"))
  (setvar "cmdecho" 0)
  (and
    (setq Sel (nentsel "\n Select text to copy: "))
    (setq EntData (entget (car Sel)))
    (setq Txt (cdr (assoc 1 EntData)))
    (setq wid (cdr (assoc 41 EntData)))
    (setq Sel (nentsel "\n Select attribute to replace: "))
    (setq EntData (entget (car Sel)))
    (entmod (subst (cons 1 Txt) (assoc 1 EntData) EntData))
    (entupd (car Sel))
    (setq EntData (entget (car Sel)))
    (entmod (subst (cons 41 wid) (assoc 41 EntData) EntData))
    (entupd (car Sel)))
  (princ)
)

Fixed, width and text content works.