@ВeekeeCZ wrote:
Try to squeeze CHPROP command prior to the overkill.... to both its lines...
(command "_.CHPROP" "_all" "" "_C" "BYBLOCK" "" "_.OVERKILL" "_all" "")
WOW, you good! Thanks man!
Any chance to merge all layers into a specific one? I've been trying to do this but it's harder than I thought it'd be...
I'd like to either select a layer or or type its name, and after that, everything in the dwg (like ssget "_X") would merge into the layer I've chosen. Do you think you can help me with that task?
(vl-load-com)
;;;OVERKILL INNER BLOCKS;;;
(defun c:ovb ( / *error* adoc lst next)
(command "-LAYDEL" "_N" "Hide for GA" "" "_Y")
(defun *error* (errmsg)
(if (not (wcmatch errmsg "Function cancelled,quit / exit abort,console break,end"))
(princ (strcat "\nError: " errmsg)))
(vla-endundomark adoc)
(princ))
(vla-startundomark (setq adoc (vla-get-activedocument (vlax-get-acad-object))))
(vlax-for blk (vla-get-blocks adoc)
(if (and (= 0 (vlax-get blk 'islayout))
(= 0 (vlax-get blk 'isdynamicblock))
(= 0 (vlax-get blk 'isxref))
(vlax-write-enabled-p blk)
(not (wcmatch (vla-get-Name blk) "`*@*"))
)
(setq lst (cons (vla-get-Name blk) lst))))
(foreach n lst
(command "_.-BEDIT" n)
(if (not next)
(command "_.CHPROP" "_all" "" "_C" "BYBLOCK" "" "_.OVERKILL" "_all" "")
(command "_.CHPROP" "_all" "" "_C" "BYBLOCK" "" "_.-OVERKILL" "_all" "" "_Done"))
(command "_.BCLOSE")
(while (> (getvar 'CMDACTIVE) 0)
(command "_save"))
(setq next T))
(if lst (princ (strcat "\n" (itoa (length lst)) " blocks cleaned.")))
(setq ss(ssget "_X"))
(command "_.change" ss "" "_P" "_LA" pause "")
(command "_.audit" "_Y")
(command "-purge" "_R" "" "_N")
(command "-purge" "_A" "" "_N")
(*error* "end")
)