你好
我是一个AutoLISP新手,需要遍历的文件夹。DWG文件,对每个文件一次运行一个lisp,无需向用户提示。这可以在AutoLISP中完成吗?以下是将在每个文件上运行的lisp:
- ;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)
- ; )
非常感谢。 |