想在龙龙仔的批量改图层颜色里加一行将某图层关闭怎么搞?
查了些资料,一知半解,想将每个文件名为SUB的图层关闭,加了一行(vla-put-layeron (vla-item WW "sub") :vlax-False)
好像通不过,大概是语法没理解,能否请高手帮忙看看
;;一个VLISP的批量处理范例
;;从这个范例可以了解VLISP如何批量处理图档
;;虽然速度慢了点,但非常实用
;;By LUCAS(龙龙仔)
;;批量修改图层颜色
;;
;;虽配合Expresstools__(acetutil.arx)
;;为加速程序执行,程序将设定系统变量ACADLSPASDOC
;;即<只载入 acad.lsp 至 AutoCAD 执行期所开启的第一个图面>
;;当然程序结束后,会还原系统变量ACADLSPASDOC
;;
;;For AutoCad 2000+
;;Usage: (CH_LAY_COLOR (acad_colordlg 115))
;;Usage: (cor 115)
(arxload "acetutil.arx" NIL)
(vl-load-com)
(defun cor (COL / HOLDECHO APP DWGNAME
PREFIX_DWG NN QQ HOLDLSP
WW ENT_LAY
)
(setq HOLDECHO (getvar "cmdecho"))
(setvar "cmdecho" 0)
(setq PREFIX_DWG
(strcat
(vl-string-right-trim
"\\"
(strcase (acet-ui-pickdir
"选择目录"
(vl-string-right-trim "\\" (getvar "dwgprefix"))
"移除未使用之具名参考"
)
)
)
"\\"
)
)
(setq HOLDLSP (getvar "ACADLSPASDOC"))
(setvar "acadlspasdoc" 0)
(setq QQ (vl-directory-files PREFIX_DWG "*.DWG"))
(setq NN 0)
(if (/= QQ NIL)
(progn
(setq APP (vlax-get-acad-object))
(repeat (length QQ)
(setq DWGNAME (strcase (strcat PREFIX_DWG (nth NN QQ))))
(setq WW (vla-open (vla-get-documents APP) DWGNAME))
(vlax-for ENT_LAY (vla-get-layers WW)
(vla-put-color ENT_LAY COL)
(vla-put-layeron (vla-item WW "sub") :vlax-False)
)
(vla-save WW)
(prompt (strcat "\n" DWGNAME " <修改图层颜色完成>!!!"))
(vla-close WW :vlax-false)
(setq NN (1+ NN))
)
(vlax-release-object WW)
(vlax-release-object APP)
)
(prompt "\n所选目录中未有任何图档!!!")
)
(setvar "acadlspasdoc" HOLDLSP)
(setvar "cmdecho" HOLDECHO)
(princ)
)
(princ)
页:
[1]