Cool,
thanks MP
I add code then it delete layer and object in layer.
(vlax-for obj (vla-get-paperspace doc)
(print obj)
(setq lay_obj (vlax-get obj 'Layer))
(foreach name lst
(if (wcmatch lay_obj (car name))
(vla-put-layer obj (cadr name))
);if
);foreach name
);vlax-for obj
(foreach name lst
(if (ValidItem layers (car name))
(vla-delete (vla-item layers (car name)))
)
)
;Code found Doug Broad
(defun ValidItem (collection item / res)
(vl-catch-all-apply
'(lambda ()
(setq res (vla-item collection item))
)
)
res
)
Your code have error trap. It still not delete layer if object in paperspace not change another layer. So i used your code in lisp.
One more question: how to put layer all object in paperspace if dwg have >1 layout ?