Jump to content

Automatic pagination in sheet set


Tad_Thurston

Recommended Posts

I beleive this qualifies as a general acad question, I am using Civil 3D. We have a sheet set that is 237 sheets, all in one discipline. The individual sheet numbers are in a field in the title block. These numbers are pulled in from the page number in the sheet properties which is manually entered. However when a sheet is added or removed, this requires a large amount of work renumbering all the sheet properties so that the sheet numbers are up-to-date. Isn't there a way that acad will automatically revise the sheet numbers so they are up-to-date without having to renumber all the sheets?

Link to comment
Share on other sites

In order to automate Sheet Set Manager tasks, one must use the COM API... Consider the Sheet Set Objects Reference from the online Developer Documentation.

 

While according to the documentation, you can use either the VBA, or .NET API to access the applicable COM Objects, I'd highly suggest you use .NET... Especially as more and more of the Civil 3D APIs are only being exposed to .NET (i.e., C#,F#,VB, etc.), or ObjectARX (C++ for AutoCAD).

 

If you're new to the .NET API, you may find this thread helpful.

 

HTH

Link to comment
Share on other sites

Using a ordinary title block with attributes its pretty easy to update using lisp the layout sheet details 23 of 237 etc You can do this in two ways just numbered as per the stored list or as the order they appear, these are two different lists. Here is an example using layout name. Pretty sure it was one of the brilliant guys that posted the code for layout list in order of apperance. I am sure they will post. Will try to find.

 

; 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)
                     (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 ah:sheetupdate1 ()
(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")
(setq width "   edit_width = 12;")
(setq limit "     edit_limit = 9;")
(ah:getval title width limit)
(setq dwgname item)
(setq title "Please enter version for all sheets <Cr> no change")
(setq width "   edit_width = 8;")
(setq limit "     edit_limit = 5;")
(ah:getval title width limit)  
(setq newstr4 item)
(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)
     (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
; 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 
      ) ; end foreach
   ) ; end progn
) ; end if
(setq x (+ x 1))
) ; end repeat
(setq ss1 nil)  
) ; end defun ah

(ah:sheetupdate1)
(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...