AutoLISP移动图元到指定图层,代码如下。
(defun c:test (/ ss)
(vl-load-com)
(setq entlay (entsel "\n选择目标图层:"))
(setq objlay (vla-get-layer (vlax-ename->vla-object (car entlay))))
(prompt "\n选择要移动的图元: ")
(setq ss (ssget))
(setq n 0)
(while (< n (sslength ss))
(vla-put-layer (vlax-ename->vla-object (ssname ss n)) objlay)
(setq n (1+ n))
)
)
代码完。
其实没有比选中图元,修改图层更方便。