badogblue Posted November 11, 2013 Author Share Posted November 11, 2013 (edited) Here is a quick cut and paste change the yourblockname ; changes to issued for construction (vl-load-com) (setq oldtag1 "BDR_JOBTITLE1") ;attribute tag name (setq newstr1 "Job title 1") (setq oldtag2 "BDR_JOBTITLE1") ;attribute tag name (setq newstr2 "Job title 2") (setq x 1) ; sheet 1 (setq ss1 (ssget "x" '((0 . "INSERT") (2 . "Yourblockname")))) (setq inc (sslength ss1)) ; this is the total number of sheets +1 (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 (if (= oldtag3 (strcase (vla-get-tagstring att))) (vla-put-textstring att x) ) ; end if ) ; end for (setq x (+ x 1)) ) ;end repeat (setq ss1 nil) ; (setq ss2 nil) (princ) Thanks again BIGAL, updated the above lisp as follows. ; changes to issued for construction (vl-load-com) (setq oldtag1 "BDR_DWGTITLE2") ;attribute tag name (setq newstr1 "Sheet x of 181") (setq oldtag2 "BDR_DWGNO") ;attribute tag name (setq newstr2 "100_00x") (setq x 1) ; sheet 1 (setq ss1 (ssget "x" '((0 . "INSERT") (2 . "Text_r2010")))) (setq inc (sslength ss1)) ; this is the total number of sheets +1 (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 (if (= oldtag3 (strcase (vla-get-tagstring att))) (vla-put-textstring att x) ) ; end if ) ; end for (setq x (+ x 1)) ) ;end repeat (setq ss1 nil) ; (setq ss2 nil) (princ) The above lisp changes the "drawing no" and "sheet no" to what is in the quotes, but the iterative process does nothing. Any advice, do i need to change something else? Also, forgot to say that each drawing is a seperate .dwg with only 1 layout. Thanks. Edited November 11, 2013 by badogblue Quote Link to comment Share on other sites More sharing options...
SLW210 Posted November 11, 2013 Share Posted November 11, 2013 badogblue, Please read the Code posting guidelines and use Code Tags for your Code not Quote Tags. Quote Link to comment Share on other sites More sharing options...
BIGAL Posted November 12, 2013 Share Posted November 12, 2013 You will need to run a script that opens each dwg runs the lisp and then closes again something like open dwg1 (setq sheetnum "1")(load "myblockupdate") close Y open dwg2 (setq sheetnum "2")(load "myblockupdate") close Y open dwg3 (setq sheetnum "3")(load "myblockupdate") close Y Quote Link to comment Share on other sites More sharing options...
SLW210 Posted November 12, 2013 Share Posted November 12, 2013 I moved your thread to the AutoLISP, Visual LISP & DCL forum. Quote Link to comment Share on other sites More sharing options...
mostafa badran Posted November 12, 2013 Share Posted November 12, 2013 I suggest you this lisp http://lee-mac.com/bfind.html just find & replace the word you want. Regards. Quote Link to comment Share on other sites More sharing options...
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.