ttray33y Posted November 12, 2014 Share Posted November 12, 2014 We were using this routine to update/redefine blocks inside a drawings in a directory (ei. 200 drawings) without user input upon invoking the "red" command" The routine reads the dd_list.txt created from a batch file. dir /b *.dwg > dd_list.txt then R&W the list with Open, qSave, close command and loops thru the list until its done & creates the final script to execute. AttDia 0 AttReq 0 -insert "blockname=block path\drawing name.dwg" 0,0,0 1 1 0 (entdel(entlast)) AttReq 1 AttDia 1 ; please do suggest a better way or the fastest to achive the same routine. cheers (defun c:red ( / ddlist red o_red d1 d2 dn) (setq ddlist (findfile "dd_list.txt")) (setq o_red (open "red.scr" "w")) (setq red (findfile "red.scr")) (setq d1 (open ddlist "r")) (setq d2 (open red "a")) (setq dn (read-line d1)) (while (/= dn nil) (princ "open" d2) (princ "\n" d2) (write-line dn d2) (princ "qsave" d2) (princ "\n" d2) (princ "close" d2) (princ "\n" d2) (setq dn (read-line d1)) ) (close d1) (close d2) (close o_red) (command "script" "red") ) Quote Link to comment Share on other sites More sharing options...
BIGAL Posted November 14, 2014 Share Posted November 14, 2014 A bit simpler autoload the change part as a lisp then its just a simple script open dwg1 (load "chges") close Y open dwg2 (load "chges") close Y ; chges.lsp (setvar "AttDia" 0) (setvar "AttReq" 0) (command "-insert" "blockname=block path\drawing name.dwg" 0,0,0 1 1 0) (entdel(entlast)) (setvar "AttReq" 1) (setvar "AttDia" 1) 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.