Jump to content

Recommended Posts

Posted (edited)

I have a few title blocks. one for each size of paper that I can print on. I will start working on a drawing and add another page. I will start out with lets say 5 pages and then realize that I need to add another page. at first I would go into each block and change the attribute to reflect the number of pages that I have now. after awhile it got to be a bit much having to go into 15 title blocks to change the title block from saying 15 to 16. then if I added another page I would have to do it all over again.

what I came up with is I would just leave that number as a number and edit the block to change that number so it would reflect on every page that the total number of pages is now 16.

like I said it is working but I hate having to go into a title block to change it.

I have made other corrections and then the title block that I start with is different then the one I made changes too and I can't remember which drawing file has the most current title block in it.

attached is a title block sample.

 

 

Is there anything you can suggest that would make this change easier. something that is connected to the total number of drawing tabs that I have in the drawing file or something along those lines?

C-SIZE TITLE.dwg

Edited by squareknees
Posted

See THIS THREAD.

 

I fixed your titleblock to work with that LISP.

 

I won't be back on here until Monday. If you need help getting it to work, maybe someone will pop in over the weekend.

C-SIZE TITLE.dwg

Posted

I will post in a couple of days its a version at work it uses the layout order and the total number of layouts and updates two attributes in the title block. The code posted now is an example of just modifying title block attributes.

 

; 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 getline1-2 ()
 (if (= tabname (nth 0 plotabs))
   (progn
     (foreach att (vlax-invoke (vlax-ename->vla-object (ssname SS1 0 )) 'getattributes)
       (if (= oldtag6 (strcase (vla-get-tagstring att)))
       (setq newstr6 (vla-get-textstring att)) 
       )
     )
   
     (foreach att (vlax-invoke (vlax-ename->vla-object (ssname SS1 0 )) 'getattributes)
       (if (= oldtag7 (strcase (vla-get-tagstring att)))
       (setq newstr7 (vla-get-textstring att)) 
       )
     )
   )
 )
)

(defun ah:sheetupdate1 ( / ss1 lay 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 plotabs (vl-sort plotabs '<))
(setq len (length plotabs))
(getline1-2) ; gets line 1&2 if not needed

(if (not AH:getval) (load "getval"))
(setq title "Please enter dwg number")
(setq width "   edit_width = 15;")
(setq limit "     edit_limit = 12;")

(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)

(setq TITLE "Do you want to use line 1 on all sheets OK no change any key for y")
(setq width "   edit_width = 6;")
(setq limit "     edit_limit = 3;")
(ah:getval title width limit)
(if (= item nil)
(setq NEWSTR6 nil)
(setq NEWSTR6yn "y")
)

(setq TITLE "Do you want to use line 2 on all sheets OK no change any key for y")
(setq width "   edit_width = 6;")
(setq limit "     edit_limit = 3;")

(ah:getval title width limit)
(if (= item nil)
(setq NEWSTR7 nil)
(setq NEWSTR7yn "y")
)


(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 oldtag6 "PROJECT_TITLE")
     (setq oldtag7 "PROJECT_DESCRIPTION")

     (getline1-2) ; gets line 1&2 if not needed


; 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 (/= newstr6yn "Y") (= oldtag6 (strcase (vla-get-tagstring att))) )
       (vla-put-textstring att newstr6) 
       ) ; end if 

       (if (and (/= newstr7yn "Y") (= oldtag7 (strcase (vla-get-tagstring att))) )
       (vla-put-textstring att newstr7) 
       ) ; end if 

      ) ; end foreach
   ) ; end progn
) ; end if


(setq x (+ x 1))
) ; end repeat
) ; end defun ah
(ah:sheetupdate1)



(princ)

Posted

tried to load the lisp routine and I got an error.

'Command:

Command: (LOAD "C:/Users/nannette/Desktop/ParseNumbers.LSP") ; error: LOAD failed: "getval"

Command: PARSENUMBERS Unknown command "PARSENUMBERS". Press F1 for help.'

I love the tab control to change the page number!! I just need the way to change the total number of pages easily. there are times that I have pages that I do not add to the total number pages to the set. and now I am wondering if I need to just keep doing what I am doing to list total number of pages?

there are times that I have a few 11x17 details that have to go to a metal fabricator or a stone top company. I create a tab for each one of these drawings yet they are not included in the set when counting total number of pages.

Thanks

Posted

Is there any real value to having that information on every sheet?

 

You've already got sheet number and sheet name on the individual sheets and hopefully a drawing list on the cover sheet.

 

I've seen sheet # of sheet total many times throughout the years and it was usually not correct but again I saw it as redundant information.

Posted

I am an architectural drafter but I am currently working in a cabinetry company. Because of that, I do not have a cover sheet. The pages go to the shop for the cabinets to be built. The shop foreman wants the total number of pages to be on the title block so he knows that all of the pages are accounted for. The pages themselves never stay together since multiple people are working on the cabinets. There have been times where a page will go missing and if they do not know how many pages there should be, they don't know when something is missing.

Posted

How about making an XREF of just the text indicating the total number of sheets?

 

Insert that XREF into each title layout. When a sheet is added or removed, change the text to the appropriate number and it will change in every title block the next time the drawings are opened. One edit and done.

Posted

I'm just afraid one of my coworkers will open the drawing and delete the xref because he is not use to working with them. that is why I am opening the title block in the block editor and the # of pages is just text so I change it to what the total # of pages are and it changes all of the pages. the best part about that is my coworker does not know how to edit blocks, so the number is safe. if he has to make a change to anything in a drawing that I created and the change involves a block (even a dynamic block) he just explodes it.

Posted

That's got to be very frustrating having someone undo your hard work. I'd be kickin' and screamin'.

Posted

Ok here is x of y

 

You need GETVALS.lsp to run code above my fault http://www.cadtutor.net/forum/showthread.php?93002-1-line-2-line-3line-dcl-auto-generator-plus-more-if-required&p=636641&viewfull=1#post636641

 

(defun renumlayouts ( / alllayouts lay num newnum ss)
(setq alllayouts (vla-get-Layouts (vla-get-activedocument (vlax-get-acad-object))))
(setq total (- (vla-get-count alllayouts) 1)
(vlax-for lay alllayouts
 (if (/= 0  (setq num (vla-get-taborder lay)))
 (progn      
 (if ( > num 9)  
     (setq newnum (strcat "D" (rtos num 2 0)))
     (setq newnum (strcat "D0" (rtos num 2 0)))
     )
     (vla-put-name lay newnum)

 ( setvar "ctab" newnum) ; ok
 (setq ss (ssget "x" (list (cons 0 "Insert")(cons 2 "yourtitlename")(cons 410 newnum))))
; get attributes put by order created
 (foreach att (vlax-invoke (vlax-ename->vla-object (ssname ss 0 )) 'getattributes)
       (if (= "SHEET_NO" (strcase (vla-get-tagstring att))) ; tag name is SHEET_NO
       (vla-put-textstring att (rtos num 2 0)) 
       ) ; end if
       (if (= "SHEETS" (strcase (vla-get-tagstring att))) ; tag name is SHEETS
       (vla-put-textstring att (rtos total 2 0)) 
       ) ; end if
 ) ; foreach
 (setq obj nil)
 ) ; progn
 ) ; if
); vlaxfor
)
(renumlayouts)

Posted
I'm just afraid one of my coworkers will open the drawing and delete the xref because he is not use to working with them.

 

my coworker does not know how to edit blocks . . . . he just explodes it.

 

Sounds like your co-worker is in serious need of some formal training. :roll:

Posted

Did you look at the thread I linked you to in post #2?

Posted

I have got to be missing something. I copied the text and saved it to .lsp, I loaded the lisp routines and it tells me that there are errors.

I do not know how to read lisp code so I am not sure where the issues are? I went to the link you posted http://www.cadtutor.net/forum/showthread.php?93002-1-line-2-line-3line-dcl-auto-generator-plus-more-if-required&p=636641&viewfull=1#post636641 then copied and pasted the text on the first page. I also copied and pasted the text in your last reply. Command: ; error: malformed list on input is what I keep getting.

Thanks for any help

Posted

What is wrong with the lisp in the thread I linked in Post #2?

Posted

I missed the post. :oops: when I went back to look at all the posts again I saw the thread link. :facepalm: I will try that when I get a chance too. Really busy in the office right now.

 

 

 

 

You know fixing blocks :reallymad: and crying :cry: at all my hard work destroyed!

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