+ Reply to Thread
Results 1 to 2 of 2
  1. #1
    Forum Newbie
    Using
    AutoCAD LT 2012
    Join Date
    Jul 2012
    Posts
    1

    Default Linking text blocks from one layout to another

    Registered forum members do not see this ad.

    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

  2. #2
    Forum Deity
    Using
    Civil 3D 2013
    Join Date
    Dec 2005
    Location
    GEELONG AUSTRALIA
    Posts
    3,780

    Default

    Registered forum members do not see this ad.

    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

    Code:
    ; change the 410 to layout name
    ;;-------------------=={ Parse Numbers }==--------------------;;
    ;;                                                            ;;
    ;;  Parses a list of numerical values from a supplied string. ;;
    ;;------------------------------------------------------------;;
    ;;  Author: Lee Mac, Copyright © 2011 - www.lee-mac.com       ;;
    ;;------------------------------------------------------------;;
    ;;  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)
    A man who never made mistakes never made anything

Similar Threads

  1. linking to external blocks
    By oompa_l in forum Rhino
    Replies: 4
    Last Post: 29th May 2012, 08:16 pm
  2. Linking blocks between DWG's
    By gazzalp in forum AutoLISP, Visual LISP & DCL
    Replies: 4
    Last Post: 7th Jan 2009, 01:38 am
  3. Linking Blocks
    By Fire Alarm in forum AutoCAD General
    Replies: 3
    Last Post: 22nd Dec 2008, 06:33 pm
  4. Linking CAD blocks To Excel
    By ben_yewman in forum AutoCAD General
    Replies: 1
    Last Post: 1st Oct 2008, 11:51 am
  5. Linking attributes to layout name or vice versa
    By comcu in forum AutoLISP, Visual LISP & DCL
    Replies: 0
    Last Post: 6th Jul 2007, 12:16 pm

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts