STEVAR Posted November 19, 2012 Posted November 19, 2012 I am trying to map values to my title block using an autolisp routine. I have entered (getenv "NEXTSHEET") & (getenv "PREVSHEET") into the descriptions fields and mapped these routines to 'NEXT_ATTRNAME' & 'PREV_ATTRNAME' attributes. When I run the title block updates no values appear on my drawing. Please note that I have included the program in my start-up suite. Please also note that when I enter 'NEXTSHEET' or 'PREVSHEET' on the command line, the routines are called and the correct values are shown on the command line. I just need these values to be visible on my drawing. I have attached the Autolisp routine that I am running. Can some please advise what I am doing wrong. Thanks in advance. Nextsheet.lsp Quote
BIGAL Posted November 20, 2012 Posted November 20, 2012 An alternative approach will locate all title blocks in dwg ; changes to issued for construction : thanks to lee mac for original code (vl-load-com) ; 1. Get current date in mm/dd/yy format. (defun ddmmyy (/ x today) (setvar "cmdecho" 0) (setq x (getvar "CDATE")) ; get current date (setq today ( rtos x 2 4)) ; convert to a string (setq date (strcat (substr today 7 2) "." (substr today 5 2) "." (substr today 3 2) )) ) (setq oldtag1 "DRAWING_STATUS") ;attribute tag name (setq newstr1 "ISSUED FOR CONSTRUCTION") (setq oldtag2 "REV_NO") ;attribute tag name (setq newstr2 "0") (setq ss1 (ssget "x" '((0 . "INSERT") (2 . "DA1DRTXT")))) (setq inc (sslength ss1)) (repeat inc (foreach att (vlax-invoke (vlax-ename->vla-object (ssname SS1 (setq inc (1- inc)) )) '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 ) ; end for ) ;end repeat (setq oldtag1 "REV-NO") (setq newstr1 "0") (ddmmyy) (setq oldtag2 "DATE") (setq newstr2 date) (setq oldtag3 "AMENDMENT") (setq newstr3 "ISSUED FOR CONSTRUCTION") (setq ss2 (ssget "x" '((0 . "INSERT") (2 . "REVTABLE")))) (setq inc (sslength ss2)) (repeat inc (foreach att (vlax-invoke (vlax-ename->vla-object (ssname ss2 (setq inc (1- inc)))) 'getattributes) (if (= oldtag1 (strcase (vla-get-tagstring att))) (vla-put-textstring att newstr1) ) (if (= oldtag2 (strcase (vla-get-tagstring att))) (vla-put-textstring att newstr2) ) (if (= oldtag3 (strcase (vla-get-tagstring att))) (vla-put-textstring att newstr3) ) ) ) (setq ss1 nil) (setq ss2 nil) (princ) Quote
STEVAR Posted November 20, 2012 Author Posted November 20, 2012 Thanks for your reply. However I am unclear on what this code is doing exactly. I am trying to set-up my template to contain attributes that detail the previous & next sheet number of the drawing set. These attributes are populated and visible when I update these fields with constants. However are not visible when I try to run the attached routine and update these attributes with variables. Please advise. Thank-you. Quote
BIGAL Posted November 21, 2012 Posted November 21, 2012 I think I am heading down a different path. 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.