SurveyCAD85 Posted November 22, 2016 Share Posted November 22, 2016 I am hoping for some help We work with 2-5 layouts per DWG. The attributes on these layouts remain the same for approx 90%, with the other 10% including sheet numbering and dates etc. Is there a way we can enter this information in once to Layout 1, and it globally change the remaining 2-5 layouts Quote Link to comment Share on other sites More sharing options...
BIGAL Posted November 23, 2016 Share Posted November 23, 2016 Here is some example title block stuff for lisp alternative is to use a Xref Two code examples of using attribute tags to change the correct parameter in a title block. ; changes to issued for construction ; by Alan H : thanks to lee mac for original code (vl-load-com) ; 1. Get current date in mm/dd/yy format. (defun ddmmyy (/ x today) (setvar "cmdecho" 0) (setq x (getvar "CDATE")) ; get current date (setq today ( rtos x 2 4)) ; convert to a string (setq newdate (strcat (substr today 7 2) "." (substr today 5 2) "." (substr today 3 2) )) ) (ddmmyy) (setq oldtag1 "DRAWING_STATUS") ;attribute tag name (setq newstr1 "ISSUED FOR CONSTRUCTION") (setq oldtag2 "REV_NO") ;attribute tag name (setq newstr2 "0") (setq oldtag3 "DRDATE") ;attribute tag name (setq newstr3 newdate) (setq ss1 (ssget "x" '((0 . "INSERT") (2 . "DA1DRTXT")))) (setq inc (sslength ss1)) (repeat inc (foreach att (vlax-invoke (vlax-ename->vla-object (ssname SS1 (setq inc (1- inc)) )) 'getattributes) (if (= oldtag1 (strcase (vla-get-tagstring att))) (vla-put-textstring att newstr1) ) ; end if (if (= oldtag2 (strcase (vla-get-tagstring att))) (vla-put-textstring att newstr2) ) ; end if (if (= oldtag3 (strcase (vla-get-tagstring att))) (vla-put-textstring att newstr3) ) ; end if ) ; end for ) ;end repeat (setq oldtag1 "REV-NO") (setq newstr1 "0") (setq oldtag2 "DATE") (setq newstr2 newdate) (setq oldtag3 "AMENDMENT") (setq newstr3 "ISSUED FOR CONSTRUCTION") (setq ss2 (ssget "x" '((0 . "INSERT") (2 . "REVTABLE")))) (setq inc (sslength ss2)) (repeat inc (foreach att (vlax-invoke (vlax-ename->vla-object (ssname ss2 (setq inc (1- inc)))) 'getattributes) (if (= oldtag1 (strcase (vla-get-tagstring att))) (vla-put-textstring att newstr1) ) (if (= oldtag2 (strcase (vla-get-tagstring att))) (vla-put-textstring att newstr2) ) (if (= oldtag3 (strcase (vla-get-tagstring att))) (vla-put-textstring att newstr3) ) ) ) (setq ss1 nil) ; (setq ss2 nil) (princ) ; update the title blocks in a dwg ; by Alan H ; parse numbers by Lee-mac ;;-------------------=={ Parse Numbers }==--------------------;; ;; ;; ;; Parses a list of numerical values from a supplied string. ;; ;;------------------------------------------------------------;; ;; Author: Lee Mac, Copyright © 2011 - [url="http://www.lee-mac.com"]www.lee-mac.com[/url] ;; ;;------------------------------------------------------------;; ;; Arguments: ;; ;; s - String to process ;; ;;------------------------------------------------------------;; ;; Returns: List of numerical values found in string. ;; ;;------------------------------------------------------------;; (defun LM:ParseNumbers ( s ) ( (lambda ( l ) (read (strcat "(" (vl-list->string (mapcar (function (lambda ( a b c ) (if (or (< 47 b 58) (and (= 45 b) (< 47 c 58) (not (< 47 a 58))) (and (= 46 b) (< 47 a 58) (< 47 c 58)) ) b 32 ) ) ) (cons nil l) l (append (cdr l) (list nil)) ) ) ")" ) ) ) (vl-string->list s) ) ) (defun ah:sheetupdate1 ( / ss1 len lay plotabs tabname dwgname oldtag1 oldtag2 oldtag3 oldtag4 oldtag5) (setq doc (vla-get-activedocument (vlax-get-acad-object))) (vlax-for lay (vla-get-Layouts doc) (setq plotabs (cons (vla-get-name lay) plotabs)) ) (IF (NOT AH:getval3)(LOAD "GETVALS")) (AH:getval3 "Please enter dwg number" 12 9 "Please enter version for all sheets <Cr> no change" 8 5 "Please enter line1 details " 40 38 ) (setq dwgname VAL1) (setq newstr4 VAL2) (SETQ NEWSTR6 VAL3) (princ "0") (setq len (length plotabs)) (setq x 0) (setq bname "DA1DRTXT") (repeat len (setq tabname (nth x plotabs)) (if (/= tabname "Model") (progn (setvar "ctab" tabname) (command "pspace") (setq ss1 (ssget "x" (list (cons 0 "INSERT") (cons 2 bname)(cons 410 tabname)))) (setq dwgnum (Lm:parsenumbers tabname)) (setq sheetnum (car dwgnum)) (setq oldtag1 "SHT_NO") ;attribute tag name (setq newstr1 (rtos sheetnum 2 0)) (setq oldtag2 "DRG_NO") ;attribute tag name (setq oldtag3 "PROJ_NO") ;attribute tag name (setq newstr3 dwgname) (setq oldtag4 "REV_NO") ;attribute tag name (setq oldtag5 "SHEETS") ;attribute tag name (setq oldtag6 "STREET") ;attribute tag name ; if less than 10 (if (< (car dwgnum) 10.0) (setq newstr2 (strcat dwgname "-D0" (rtos sheetnum 2 0))) (setq newstr2 (strcat dwgname "-D" (rtos sheetnum 2 0))) ) (foreach att (vlax-invoke (vlax-ename->vla-object (ssname SS1 0 )) 'getattributes) (if (= oldtag1 (strcase (vla-get-tagstring att))) (vla-put-textstring att newstr1) ) ; end if (if (= oldtag2 (strcase (vla-get-tagstring att))) (vla-put-textstring att newstr2) ) ; end if (if (= oldtag3 (strcase (vla-get-tagstring att))) (vla-put-textstring att newstr3) ) ; end if (if (and (/= newstr4 nil) (= oldtag4 (strcase (vla-get-tagstring att))) ) (vla-put-textstring att newstr4) ) ; end if (if (= oldtag5 (strcase (vla-get-tagstring att))) (vla-put-textstring att (rtos (- len 1) 2 0)) ) ; end if (if (= oldtag6 (strcase (vla-get-tagstring att))) (vla-put-textstring att newstr6) ) ; end if ) ; end foreach ) ; end progn ) ; end if (setq x (+ x 1)) ) ; end repeat (setq ss1 nil) ) ; end defun ah (ah:sheetupdate1) (princ) Quote Link to comment Share on other sites More sharing options...
RobDraw Posted November 23, 2016 Share Posted November 23, 2016 I use XREFs for the information that is the same on every sheet. Edit one file and done. Quote Link to comment Share on other sites More sharing options...
Dana W Posted November 23, 2016 Share Posted November 23, 2016 Xref or a block, either is good. Wait, actually an xref-ed layout border and title info should also be an attributed block in its own dwg file. My layout border and title info is saved in a block with attributes. Attributes are for things you want different on each page. Simple mtext items will work for things that remain the same on every page. Using attributes for non-variable text is counterproductive. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.