Re: Filling a block attribute value?

I want to insert the "DWGNAME" system variable into a block attribute > "dwg_number".
Grab LTEXT.VLX from
formatting link

Reply to
Terry W. Dotson
Loading thread data ...
Try this, making sure you put your border block name on line 4. I used DWG# as the attribute, you can substitute your own name.
;;Update Border title number to match file no. ;;BRC 17 July 00 ;;--------------------------------------------
(defun c:ud-dwgno (/ FILE# DWG# TTLSS DWGTTL DWG#AT DWG#OLD) (setq FILE# (getvar "dwgname")) (setq DWGNO (substr FILE# 1 (- (strlen FILE#) 4))) (setq TTLSS (ssget "X" '((2 . "Your-block-name")))) (if TTLSS (progn (setq DWGTTL (ssname TTLSS 0)) (setq DWG#AT (entget DWGTTL)) (while (/= "DWG#" (cdr (assoc 2 DWG#AT))) (setq DWGTTL (entnext DWGTTL)) (setq DWG#AT (entget DWGTTL)) (setq DWG#OLD (cdr (assoc 1 DWG#AT))) ) (if (= DWG#OLD DWGNO) (princ "\n No Change. File No. and drawing No. already match.") (progn (setq DWG#AT (subst (cons 1 DWGNO) (assoc 1 DWG#AT) DWG#AT)) (entmod DWG#AT) (entupd DWGTTL) (princ (strcat "\n Drawing No. updated to " DWGNO ".")) ) ) ) (alert "\n Border block not found!") ) (princ) )
Reply to
Brian Cannon

PolyTech Forum website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.