马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?立即注册
×
本帖最后由 yufeng37 于 2017-6-29 10:31 编辑
我写了一个简单低配版的,如下:(写着当练习了,怕长时间不写忘记怎么写了)
之前收藏了一个他人写的,我试用了一下,检查时报错了
参数太少: (WCMATCH (vla-get-Name ITEM "*|*"))
看起来很牛但是没法用,本人才疏学浅看不懂prelayer函数是什么原理,如何修改,请有兴趣的大师试一试,改一改,最好能加点注释让小弟学习一下。
叩谢
(vl-load-com)(defun_prelayers (adoc / item layers prop tmp) (vlax-for item (vla-get-layers adoc) (if (not (wcmatch (vla-get-name item"*|*"))) (setq layers (cons (append (list item) (mapcar(function (lambda (prop / tmp) (setq tmp (vlax-get-property item prop)) (vl-catch-all-apply (function (lambda () (vlax-put-property item prop:vlax-false)))) (cons prop tmp) ) ;_ end of lambda ) ;_ end of function '("freeze" "lock") ) ;_end of mapcar ) ;_ end ofappend layers ) ;_ end of cons ) ;_ end of setq ) ;_ end of if ) ;_ end of vlax-for ) (defunc:remove-wipeout (/ adoc layers count err) (vla-startundomark (setq adoc(vla-get-activedocument (vlax-get-acad-object)))) (setq layers (_prelayers adoc)) (setq count 0 err 0 ) ;_ end of setq (vlax-for blk_def (vla-get-blocks adoc) (if (equal (vla-get-isxref blk_def):vlax-false) (vlax-for ent blk_def (if (wcmatch (strcase(vla-get-objectname ent)) "*WIPEOUT*") (if (vl-catch-all-error-p(vl-catch-all-apply (function (lambda () (vla-erase ent))))) (setq err (1+ err)) (setq count (1+ count)) ) ;_ end of if ) ;_ end of if ) ;_ end of vlax-for ) ;_ end of if ) ;_ end of vlax-for (foreach item layers (foreach prop (cdr item) (vl-catch-all-apply (function (lambda ()(vlax-put-property (car item) (car prop) (cdr prop))))) ) ;_ end of foreach ) ;_ end of foreach (princ (strcat "\nErased wipeout :" (itoa count) "\nError erasing : " (itoa err))) (vla-endundomark adoc) (princ) ) ;_ end of defun
|