如何删除所有关闭的图层
RT, 请教大家, 如何删除所有处于关闭状态的图层本帖最后由 wide 于 2024-1-29 17:55 编辑
先判断是否关闭,然后删除。 新建 dwg图纸,全选复制粘贴到 新dwg图纸 (defun c:bb(/ en)
(tblnext "LAYER" t )
(while
(setq en (tblnext "LAYER"))
(if
(=(cdr(assoc 62 en ))-7)
(command "laydel"
"n"
(cdr(assoc 2 en ))
""
"Y"
)
)
)
) (defun delOffLayer (/ lay)
(command "_.undo" "be")
(command "_.color" "")
(vlax-for lay
(vla-get-layers
(vla-get-activedocument
(vlax-get-acad-object)
)
)
(if (and (= (vla-get-LayerOn lay) :vlax-false) (/= "0" (vla-get-Name lay)))
(command "laydel" "n" (vla-get-Name lay) "" "y")
)
)
(command "-purge" "a" "" "n")
(command "_.undo" "e")
)自己拼凑了一段代码, 缺点应该是不能处理有参照的图层 感谢各位大神分享 借花献佛:
panliang9 发表于 2024-1-31 11:37
借花献佛:
大佬把关闭和冻结的图层同时删除怎么改?保留0,Defpoints层 关闭和冻结的图层同时删除,保留0,Defpoints层
页:
[1]