dallen2408 Posted July 31, 2012 Posted July 31, 2012 Could someone please help me; I am looking to auto Number the layout tabs from a Table of contens. I have attached a dwg that should help clarify what I am asking for. Thanks Blank Design Package.dwg Quote
BIGAL Posted July 31, 2012 Posted July 31, 2012 I would go the other way and create your table of contents from the layout tab details, you can go to each layout read the title block etc and create a list of details to put in a table or as column of text. this may help get you started ; 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") (ah:getval title) (setq dwgname item) (setq newstr4 (getstring "\nPlease enter version for all sheets <Cr> no change ")) (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) Quote
dallen2408 Posted July 31, 2012 Author Posted July 31, 2012 How do I set this up? I know where to put the Lisp file, just need to know if and what else I need to do to ensure it works the way it's intended. Thanks, Dallen Quote
BIGAL Posted August 1, 2012 Posted August 1, 2012 I probably jumped a bit ahead of an answer the code is an example of how to read information from the layout name and and change & add title block details. In your case you would go the other way and extract this information to use as details in your dwg list. Just had another look at your title block and to do what I have suggested you need to add attributes to your title block like "Project desc1" "project desc2" "drawn by" and have these filled in. Our title block has 2 parts the line work block 1 and the details block2 around 20 attributes "Proj title line1" "Proj title line1" "Drawing title line 1" "rev" and so on. So I would just add a new Block with the title details as attributes. You can do what you want also but that is probably more a create a new layout tab and fill in all the title info as I create the entry in the dwg list. I think you need to do a bit of home work which approach do you want or is it a case of both ? Quote
Recommended Posts
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.