;; Replace text, mtext, dim or attribute to filename
;; Created by pony.chubby 2016
;; Saved from here: http://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/replace-text-to-filename-problem/td-p/6512932

(defun c:flc ()
(setq aa (strcat (vl-filename-base (getvar 'DwgName)) ".dwg"))
(while (setq txt (car (nentsel "\n Select text, mtext, dim or attribute to replace to filename: ")))
(setq vla_obj (vlax-ename->vla-object txt))
(vla-put-textstring vla_obj aa)
)
(vla-regen (vla-get-activedocument (vlax-get-acad-object)) acAllViewports)
)

Advertisements