VisualLISP 使用ActiveX对象关闭图层
;;关闭全部图层
(defun closeLayer()
(setq obj (vlax-get-acad-object));;
(setq doc (vlax-get-property obj 'ActiveDocument));;
(setq ls (vlax-get-property doc 'layers));;获取所有图层集合
(setq ln (vla-get-count ls));;获取所有图层数量
(setq n 0)
(repeat ln;;遍历图层
(setq lobj (vla-item ls n));;得到VLA图层对象
(vla-put-layeron lobj 0);;True打开图层 False关闭图层
(setq n (+ n 1))
)
(princ)
)