源码,分享两个清理程序
本帖最后由 lucas_3333 于 2014-3-28 08:04 编辑http://i1.hoopchina.com.cn/user/700/15694700/AlbumImg139204070521270_400*225.gif
哈哈,不多说了,上附件了
我这有个更简单的。
(defun c:11()
(dictremove(namedobjdict)"ACAD_DGNLINESTYLECOMP")
(vl-cmdf "-SCALELISTEDIT" "R" "Y" "E"
"_audit" "Y"
"_purge" "A" "" "N"
)
(princ)) 感觉这个更好用些
;;清理图层 www.xdcad.net
(defun c:PU(/ thisdrawing ss lyrlst olderr myerr)
(setvar"clayer""0") ;; 当前层为0层
(defun myerr (msg)
(if (/= msg "取消")
(princ "\*取消*")
)
(vla-endundomark thisdrawing)
(setq *error* olderr
myerr nil
)
(princ)
)
(setvar "cmdecho" 0)
(setq thisdrawing
(vlax-get-property
(vlax-get-acad-object)
'activedocument
)
)
(vla-startundomark thisdrawing)
(setq olderr *error*
*error* myerr
)
(vlax-map-collection
(vlax-get-property thisdrawing 'layers)
'(lambda (lyr / name s tf)
(setq name (vla-get-name lyr))
(if (or (setq tf (= (vla-get-freeze lyr) :vlax-true))
(= (vla-get-layeron lyr) :vlax-false)
)
(progn
(if (= (vla-get-lock lyr) :vlax-true)
(vla-put-lock lyr :vlax-false)
)
(if tf
(setq lyrlst (cons name lyrlst))
)
(vla-put-freeze lyr :vlax-false)
(if (setq s (ssget "X" (list (cons 8 name))))
(vl-cmdf ".erase" s "")
)
)
)
)
)
;|(if lyrlst
(vlax-map-collection
(vlax-get-property thisdrawing 'blocks)
'(lambda (b / bn)
(setq bn (vla-get-name b))
(if (and (/= bn "*MODEL_SPACE")
(/= bn "*PAPER_SPACE")
(not (wcmatch bn "`*PAPER_SPACE?"))
)
(vlax-map-collection
b
'(lambda (x)
(if (vl-position (vla-get-layer x) lyrlst)
(vla-delete x)
)
)
)
)
)
)
)|;
(if (setq ss (ssget "x" '((2 . "*网易*,*土木在线*,*园林站图块*"))))
(vl-cmdf ".erase" ss "")
)
(vla-purgeall thisdrawing)
(vla-purgeall thisdrawing)
(vla-purgeall thisdrawing)
;(vla-zoomextents (vla-get-application thisdrawing))
(vla-save thisdrawing)
(vla-endundomark thisdrawing)
(setq *error* olderr
myerr nil
)
;删除空组及数量为1的组定义 狂刀lxx 2011-5-10 2005.10 http://bbs.mjtd.com/thread-86821-1-1.html
(vlax-for obj (vla-get-groups (vla-get-activedocument(vlax-get-acad-object)))
(if (< (vla-get-count obj)2)(vla-delete obj)))
;删除匿名组
(vlax-for obj (vla-get-groups (vla-get-activedocument(vlax-get-acad-object)))
(if (wcmatch (vla-get-name obj)"'**")(vla-delete obj)))
(princ)) 清理什么啊?? 无法下载,不知能清理什么啊 本帖最后由 自贡黄明儒 于 2014-3-26 08:28 编辑
第一个要安装ET,调用了overkill
LZ你应该整理一下 LZ你应该整理一下,亲水? 好用不,能清理什么呢,楼主最好说明哈
再上一个 回帖是一种美德!感谢楼主的无私分享 谢谢 都很好用,学习了