Jump to content

Linking text blocks from one layout to another


geotechdustin

Recommended Posts

I have a little knowledge of AutoCAD and I do alot of reports using only AutoCAD, each sheet has a border on it with the project info, no., etc. Is there a way we can link the text blocks in page 1/layout 1 to the other pages/layouts so I dont have to go to each layout and edit the text block individually? Also, i did not draw the template so as to how it was constructed i do not know. Thank you for the help!

 

Dustin

Link to comment
Share on other sites

This is one I did but you need autocad not LT it reads layout name for sheet number maybe useful to others as a starting point to do some of what you want.

 

Thanks to Lee-mac for parse code

 

; change the 410 to layout name
;;-------------------=={ 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)
                     ;put back for negative numbers (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 lay plotabs tabname dwgname)
(defun sheetupdate1 (/ len plotabs tabname dwgname)
(setq doc (vla-get-activedocument (vlax-get-acad-object)))
(vlax-for lay (vla-get-Layouts doc)
 (setq plotabs (cons (vla-get-name lay) plotabs))
)
(setq title "Please enter dwg number")
(ah:getval title)
(setq dwgname item)
(setq title "Please enter version for all sheets OK no change")
(ah:getval title)
(setq NEWSTR4 item)
(if  (= item nil)(Setq version nil)(setq version "ok")) 
(setq len (length plotabs))
(setq x 0)
(setq title (strcat "There was " (rtos (- len 1) 2 0) " sheets counted Ok or new num"))
(ah:getval title)
(if (= item nil)
(setq NEWSTR5 (rtos (- len 1)2 0 ))
(setq newstr5 item)
)

(setq bname "DA1DRTXT")
(repeat len
 (setq tabname (nth x plotabs))
 (if (/= tabname "Model")
   (progn
     (setvar "ctab" tabname)
     (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
; 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 (/= version nil) (= oldtag4 (strcase (vla-get-tagstring att))) )
       (vla-put-textstring att newstr4) 
       ) ; end if 
       (if (and (/= newstr5 nil)(= oldtag5 (strcase (vla-get-tagstring att))) )
       (vla-put-textstring att newstr5) 
       ) ; end if 

      ) ; end foreach
   ) ; end progn
) ; end if
(setq x (+ x 1))
) ; end repeat
(setq ss1 nil)  
) ; end defun ah

(sheetupdate1)
(setq plotabs nil)
(princ)

Link to comment
Share on other sites

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...