ZWSOFT User Community > software discussion forum > Essential Posts for ZWCAD/ZW3D > What’s the command line layer merge
What’s the command line layer merge
11-07-2012 05:32 . pm | View his/her posts only
I am looking for a script solution to merge all layers to layer 0.
First I unlock all layers and switch to layer 0.
My srcipt looks like this:
(defun c:lm0 ()
(command "._LAYER" "_UNLOCK" "*" "")
(command "._LAYER" "_THAW" "*" "")
(command "._LAYER" "_ON" "*" "")
(command "._LAYER" "_ON" "0" "_UNLOCK" "0" "_THAW" "0" "S" "0" "")
(command "._LAYMRG" "N" "*" "" "N" "0")
(princ)
)
Problem is that -laymrg will not accept * to select all layers.
How can you do that?
First I unlock all layers and switch to layer 0.
My srcipt looks like this:
(defun c:lm0 ()
(command "._LAYER" "_UNLOCK" "*" "")
(command "._LAYER" "_THAW" "*" "")
(command "._LAYER" "_ON" "*" "")
(command "._LAYER" "_ON" "0" "_UNLOCK" "0" "_THAW" "0" "S" "0" "")
(command "._LAYMRG" "N" "*" "" "N" "0")
(princ)
)
Problem is that -laymrg will not accept * to select all layers.
How can you do that?
What’s the command line layer merge
11-07-2012 05:48 . pm | View his/her posts only
You may have to do something like this, where you iterate the layer collection, feeding each layer name into the LAYMRG command.
Code:
(vlax-for
x
(vla-get-Layers (vla-get-ActiveDocument (vlax-get-acad-object)))
(command "._laymrg" "_N" (vla-get-Name x) "" "_N" "0" "_Y")
)
Code:
(vlax-for
x
(vla-get-Layers (vla-get-ActiveDocument (vlax-get-acad-object)))
(command "._laymrg" "_N" (vla-get-Name x) "" "_N" "0" "_Y")
)




