cabltv1 Posted November 10, 2009 Share Posted November 10, 2009 Hello all, I am looking for a Lisp routine that will save a Drawing with the name from an attribute value. The block name is "MAP_NUM". The TAG name is "MAP". Example: Drawing name is 25-25. TAG value is "500-500". Save Drawing 25-25 as 500-500. Any help would be greatly appreciated. Quote Link to comment Share on other sites More sharing options...
SteveK Posted November 11, 2009 Share Posted November 11, 2009 See how this goes. Will save the file to the current folder (because it is unspecified) and if there is more than one block will only look in the first one found: (defun c:savePerAtt (/ blkname attTag ss txtStr subEn) (vl-load-com) ; Get Text String (setq blkname "PLD Border 07");"MAP_NUM") (setq attTag "TITLE1");"MAP") (if (setq ss (ssget "_X" (list '(0 . "INSERT") (cons 2 blkname)))) (progn (setq subEn (ssname ss 0)) (while (AND (not txtStr) (setq subEn (entnext subEn)) (eq (cdr (assoc 0 (entget subEn))) "ATTRIB")) (If (eq (cdr (assoc 2 (entget subEn))) attTag) (setq txtStr (cdr (assoc 1 (entget subEn)))) ) ) ) ) ; Save Drawing (If txtStr (vla-saveas (vla-get-activedocument (vlax-get-acad-object)) txtStr) (princ "\nAttribute Not Found.") ) (princ) ) Quote Link to comment Share on other sites More sharing options...
cabltv1 Posted November 11, 2009 Author Share Posted November 11, 2009 Perfect! Thank you very much. This routine will save me a lot of time. Quote Link to comment Share on other sites More sharing options...
SteveK Posted November 11, 2009 Share Posted November 11, 2009 No worries 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.