Script merging layers

Script merging layers

Anonymous
Not applicable
558 Views
3 Replies
Message 1 of 4

Script merging layers

Anonymous
Not applicable

Hi all,

 

I have a lot of AutoCAD drawings with certain layer names. All these drawings already have the "new" layers inserted.

Now the contents of the "old" layers need to be merged into the "new" layers

so for instance layer "01 Dimensions" needs to be merged into "04-DIMENSION"

layer "05 Center" needs to be inserted into "12-EQUIP-CEN"

layer "02 Project dimensions notes" needs to be inserted into "05-TXT&SYM" and so on

It could be that some "old" layers are already purged out.....

I made a script but keep getting errors.....

"

; Merge Multiple Layers
;
; EX. LAYER NAME NEW LAYER NAME
-LAYMRG
N 01 Dimensions N 04-DIMENSION Y
N 05 Center N 12-EQUIP-CEN Y
N 13 Border N 01-OUTLINE Y
N 02 Project dimensions notes N 05-TXT&SYM Y
N 03 Load N 0 Y
N 05 Center N 12-EQUIP-CEN Y
N 06b Equipment N 0 Y
N 06c ALE Equipment R N 0 Y
N 06d ALE Equipment G N 0 Y
N 07a Equipment hidden N 11-EQUIP-HID Y
N 07b Equipment hidden N 11-EQUIP-HID Y
N 14 Hidden N 16-SCHEME Y
N 15 Viewport N 06-VIEWPORT Y

"

help...

Thanks for your support

0 Likes
559 Views
3 Replies
Replies (3)
Message 2 of 4

Kent1Cooper
Consultant
Consultant

Since you can merge more than one Layer into another, you need to have an Enter [the blank lines] to tell it you're done selecting Layers to merge.  And saying Yes to the merging ends the command, so [unlike in the LAYER command, where you can go on to another option within one command] you need to recall it for the next one.  And enclose Layer names that contain spaces in quotation marks:

 

....

-LAYMRG
N "01 Dimensions"

 

N 04-DIMENSION Y
-LAYMRG
N "05 Center"

 

N 12-EQUIP-CEN Y

....

 

Kent Cooper, AIA
Message 3 of 4

Anonymous
Not applicable

Hi

Thanks for your quick reply

I keep getting errors saying:

"

Command: -LAYMRG
Select object on layer to merge or [Name]: N
Enter layer name or [?]: "01 Dimensions"
Invalid Layer name.

"

do you have a hint?

0 Likes
Message 4 of 4

Kent1Cooper
Consultant
Consultant

@Anonymous wrote:

....

I keep getting errors saying:

"

Command: -LAYMRG
Select object on layer to merge or [Name]: N
Enter layer name or [?]: "01 Dimensions"
Invalid Layer name.

"

do you have a hint?


If the issue isn't non-existence of the Layer, I confess I was assuming [without testing] that without the quotation marks, the Named Layers to merge would be taken as just 01 or 05.  They would be in certain situations, but here maybe you can do without them, as long as the end of the name is defined by Enter rather than a space.  But you will probably need to do the same with the Name to merge into, since those would also be allowed to contain spaces:

 

....

-LAYMRG
N 01 Dimensions

 

N 04-DIMENSION

Y
-LAYMRG
N 05 Center

 

N 12-EQUIP-CEN

Y

....

 

Kent Cooper, AIA
0 Likes