Jump to content

Need a way to enter text information and have it replicate to multiple blocks.


yrnomad

Recommended Posts

I'm looking for a way to replicate inputted info across multiple blocks.

 

This would be project info that would go onto the main titleblock, i.e. Project Name, Address, Designed by; Approved by; Drawn By; Date; Work Order Number... (you get the idea). But these inputs need to replicate to multiple blocks, as we work in modelspace for them, and have multiple sized titleblocks within the one drawing. So we'd typically have 1-2 D size sheets, as well as multiple 'A' size to show calcs, and generic details/notes to go with the issue.

 

Any ideas?

 

Thanks

Link to comment
Share on other sites

Have you looked into fields? You can define the value of a field in one place and have the value propagate across several instances.

Link to comment
Share on other sites

I would suggest look into using layouts makes life so much easier.

 

Any of the block attribute lisps editing will give you what you want, I have posted an example below, lots here by people like Lee-mac. Basicaly 2 ways you look at a block and get the attribute Tag names and using these change the values of the attribute, the second way is to use block attribute creation order ie change att1 att2 etc.

 

this uses layout tabs but changes multiple attributes

; update a specific dwg job title block info
; 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)
                     (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 ( /  LEN ss1 lay plotabs tabname sheetnum )
(defun ah:sheetupdate1 ()

(SETVAR "REGENMODE" 0)

(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 dwgname "2010026")
(setq bname "DA1DRTXT")

(setq plotabs (vl-remove "Model" plotabs))
(setq plotabs (vl-remove "PlotPreview" plotabs))

(setq oldtag1 "SHT_NO") ;attribute tag name

(setq oldtag2 "DRG_NO") ;attribute tag name

(setq oldtag3 "PROJ_NO") ;attribute tag name
(setq newstr3 "2010026")

(setq oldtag4 "REV_NO") ;attribute tag name
(setq newstr4 "PA")

(setq oldtag5 "PROJECT_DESCRIPTION") ;attribute tag name
(setq newstr5 "SEALING OF ROADS")

(setq oldtag6 "PROJECT_TITLE") ;attribute tag name
(setq newstr6 "NORTH EAST ")

(setq oldtag7 "DIRECTORY") ;attribute tag name
(setq newstr7 "MELWAYS")

(setq oldtag8 "MAP_REF") ;attribute tag name
(setq newstr8 "444&445")

(setq oldtag14 "SHEETS") ;attribute tag name
(SETQ NEWSTR14 (rtos (length plotabs) 2 0)) 

(setq oldtag15 "STREET") ;attribute tag name
(setq newstr15 "NORTH EAST ")

(setq oldtag16 "SUBURB") ;attribute tag name
(setq newstr16 "ROAD SEALING")

(setq oldtag18 "DESIGNER") ;attribute tag name
(setq newstr18 "BIGAL")

(setq oldtag19 "DRAFTER") ;attribute tag name
(setq newstr19 "BIGAL")

(setq oldtag20 "SHT_SIZE") ;attribute tag name
(setq newstr20 "A1")

(foreach tabname plotabs 
     ; no need to regen each sheet
     ;(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 newstr1 sheetnum)

   ; 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 (= oldtag4 (strcase (vla-get-tagstring att)))
       (vla-put-textstring att newstr4) 
       ) ; end if
       (if (= oldtag5 (strcase (vla-get-tagstring att)))
       (vla-put-textstring att newstr5) 
       ) ; end if
       (if (= oldtag6 (strcase (vla-get-tagstring att)))
       (vla-put-textstring att newstr6) 
       ) ; end if
       (if (= oldtag7 (strcase (vla-get-tagstring att)))
       (vla-put-textstring att newstr7) 
       ) ; end if
       (if (= oldtag8 (strcase (vla-get-tagstring att)))
       (vla-put-textstring att newstr8) 
       ) ; end if
       (if (= oldtag14 (strcase (vla-get-tagstring att)))
       (vla-put-textstring att newstr14)
       )
       (if (= oldtag15 (strcase (vla-get-tagstring att)))
       (vla-put-textstring att newstr15)
       )
       (if (= oldtag16 (strcase (vla-get-tagstring att)))
       (vla-put-textstring att newstr16) 
       )
       (if (= oldtag18 (strcase (vla-get-tagstring att)))
       (vla-put-textstring att newstr18) 
       )
       (if (= oldtag19 (strcase (vla-get-tagstring att)))
       (vla-put-textstring att newstr19) 
       )
       (if (= oldtag20 (strcase (vla-get-tagstring att)))
       (vla-put-textstring att newstr20) 
       )
      
    (command "_.pspace")
    (COMMAND "ZOOM" "e")
(PRINC (GETVAR "CTAB"))
) ; end foreach
) ; end foreach

(SETVAR "REGENMODE" 1)

) ; end defun ah

(setq curtab (getvar "Ctab"))

(vl-load-com)
(ah:sheetupdate1)


(setvar "ctab" curtab)
(princ)

 

Just a side note it is possible to plot all title blocks from model space via lisp post if you want further info.

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...