Re: Filling a block attribute value?

Aug 18, 2003 1 Replies


I want to insert the "DWGNAME" system variable into a block attribute > "dwg_number".


Grab LTEXT.VLX from

formatting link
Terry

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.

BC

;;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) )

Join the Discussion

Have something to add? Share your thoughts — no account required.

Didn't find your answer?

Ask the community — no account required