What’s the command line layer merge

Rank: 5Rank: 5

AlanCullen

Rookie

posts: 1

Registered: 2012-7-11

Message 1 of 2

  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?
0 Kudos

Rank: 5Rank: 5

MKKCAD

Rookie

posts: 7

Registered: 2012-7-11

Message 2 of 2

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")
)
TOP 0 Kudos