惜惜2
发表于 2024-9-2 14:53:38
(defun C:C0(/ dxl km)
(if (= (getvar "cmdactive") 1) (ssget "x" ) (sssetfirst nil (ssget "x" )))
(and
(setq dxl (car(l-vldxl(ssget "_:S:L" '((0 . "INSERT"))))))
(setq km (vla-get-blocks (vla-get-activedocument (vlax-get-acad-object))))
(l-c0 dxl km)
(not(vla-Update dxl))
(vlax-release-object km)
)
(princ)
)
;
(defun l-c0(dxl km)
(vla-put-layer dxl "0")
(vla-put-color dxl acbylayer)
(if (= "AcDbBlockReference" (vlax-get-property dxl "objectname"))
(progn
(vlax-for x (vla-item km (vla-get-name dxl))
(l-c0 x km)
)
(if(=(vla-get-HasAttributes dxl):vlax-true)
(vl-cmdf "AttSync" "n" (vla-get-name dxl))
)
)
)T
)
;
(defun l-vldxl(dx / dxl i)
(if (null dx)
(setq dxl nil)
(progn
(setq i 0 dxl nil)
(sssetfirst nil nil)
(repeat (sslength dx)
(setq dxl (cons (vlax-ename->vla-object (ssname dx i)) dxl) i (1+ i))
)
)
)
dxl
)
大佬,其余选中的图元也能归置0层吗?这个需要怎么修改