laurell Posted July 19, 2012 Posted July 19, 2012 Hello, I'm an AutoLISP newbie and I need to iterate through a folder of .DWG files, running a lisp on each file one at a time with no prompts to the user. Can this be done in AutoLISP? Here is the lisp that will be run on each file: ;delete_layers_except (vl-load-com) ;(defun c:demo (/ aDoc name) (setvar 'Clayer "0") (repeat 4 (vla-purgeall (setq aDoc (vla-get-ActiveDocument (vlax-get-acad-object))))) (vlax-for itm (vla-get-layers aDoc) (if (and (not (wcmatch (setq name (vla-get-name itm)) "*|*")) (not (eq name "0")) (not (member name '("Fixture-Shapes" "CHECKLANE" ;"Arch-Wall-Interior (Construction)" ;"Arch-Wall-Interior" ;"Arch-Wall-Exterior" )))) (progn (vla-put-lock itm :vlax-false) (vl-cmdf "_.-laydel" "_N" name "" "_Y")) ) ) (repeat 4 (vla-purgeall aDoc)) (princ) ; ) ;explode_all ;(defun c:explodeall () (setvar "draworderctl" 0) (setvar "qaflags" 1) (command "._explode" (ssget "X" )"") (setvar "qaflags" 0) ; ) ;erase_hatch ;(defun c:nohatch () ;(if (or (ssget '((0 . "HATCH"))) (ssget "_X" '((0 . "HATCH")))) (setq ss1 (ssget "X" '((0 . "HATCH")))) (command "_.erase" ss1 "") ; ) ;plot ;(defun c:pp () (command "-plot" "no" "Layout1" "previous plot" "DWG to PDF" "" "" "") (princ) ; ) Thank you!! Quote
Lee Mac Posted July 19, 2012 Posted July 19, 2012 Use a Script to: Open drawing. Load LISP program. Run LISP program. Save drawing. Close drawing. 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.