AutoCAD – Drawings

Merging layers in AutoCAD: 180 layers down to 20, nothing lost

Merging layers in AutoCAD with LAYMRG, measured on AutoCAD 2027: 5 objects before and 5 after, the source layer gone, only the colour following the target.

  • TS. Đỗ Quốc Hoàng
  • 8 min read
Merging IIC-A into IIC-B: 5 objects before, 5 after, and the source layer gone Photo: Diagram by the Institute of Information Technology in Civil Engineering

A drawing arrives holding TUONG, TUONG-1, TUONG_MOI, A-WALL and Layer1 — five names for one job, left by five people at five different times. Delete them and geometry goes with them; leave them and the layer list is unreadable. Merging layers in AutoCAD is the way out, and there is a command built for it.

This article measures that command on AutoCAD 2027: count the objects before, count them after, and check whether any went missing. For the whole discipline of organising a drawing, the Institute runs an AutoCAD course for construction.

Merging or moving: two jobs that look the same

This distinction has to be clear before typing anything, because picking the wrong one leaves the layer list exactly as crowded as before.

JobCommandWhere objects goThe old layer
Move objects to another layerLAYMCHto the target layerstays
Merge one layer into anotherLAYMRGto the target layeris removed from the drawing

On screen the two look identical: the objects change colour and share a layer. The difference shows up only in the layer list.

Which is why merging layers in AutoCAD is worth doing properly rather than by hand. A drawing set is read by whoever opens it next, and a list of eleven meaningful names is a different document from a list of a hundred and eighty accidental ones. The list also drives everything built on top of layers: what is frozen in which viewport, which layer states can be saved and recalled, what gets plotted and at what lineweight. None of that is usable while five names mean the same thing.

The laymrg command, step by step

The command asks exactly two questions: which layer to merge, and where to merge it. The prompts, copied verbatim from the 2027 release.

Command: LAYMRG
Select object on layer to merge or [Name]:
Selected layers: IIC-A.
Select object on layer to merge or [Name/Undo]:
Select object on target layer or [Name]:
******** WARNING ********
You are about to merge layer "IIC-A" into layer "IIC-B".
Do you wish to continue? [Yes No] <No>:

Three details there are worth remembering.

Point at an object, not at a name. Both questions accept a click on geometry in the drawing. The command works out which layer that object belongs to and prints the name back for you to check, as the Selected layers: IIC-A. line shows. That is the safest route, because you can see what you are about to merge.

Several layers go at once. The first question repeats until you press Enter. Click five objects on five different layers and all five merge into one target in a single run.

The default is <No>. Pressing Enter to hurry through the last question does nothing at all. Merging requires typing Y.

The Name option on either question opens a dialog listing layers by name, useful when the layer you want has nothing visible on screen. Autodesk describes it as "Displays the Merge Layers dialog box, where you can select the name of a layer whose objects will be moved" on the LAYMRG page. People searching in English usually type autocad merge layers, which leads to the same command.

What happens to the geometry and to the colour

The test drawing holds two layers: IIC-A in colour 1 with 3 objects, IIC-B in colour 3 with 2. Merge IIC-A into IIC-B, then count again.

MeasuredBeforeAfter
Objects in model space55
Number of layers32
Objects on IIC-B25
Objects on IIC-A3the layer is gone

The first row is the one that matters: nothing is lost. That is the whole difference between this command and LAYDEL, which removes the objects along with the layer. Which layers accept deletion and which refuse is covered in our article on deleting a layer in AutoCAD.

Merging layers loses no geometry Photo: Merging IIC-A into IIC-B: 5 objects before, 5 after, and the source layer gone

Exactly one thing changes visibly, and it startles people. All 5 objects have their colour set to ByLayer, which reads back as 256, meaning they take the colour of their layer. IIC-A is colour 1 and IIC-B is colour 3, so after the merge those 3 objects change from colour 1 to colour 3.

That is not a fault, it is what ByLayer means. Where objects carry a hard-coded colour instead, they keep it through the merge, and the layer list ends up tidy while the drawing still looks like a patchwork. Setting colour by layer is covered in our article on layers in AutoCAD.

Two layers that never merge

Autodesk's page says nothing about this, so it has to be tested directly. There are exactly two refusals, and each has its own message.

Point at an object sitting on the layer that is currently active:

Select object on layer to merge or [Name]:
Cannot merge current layer.

Make a different layer current, then point at an object on layer 0:

Select object on layer to merge or [Name]:
Cannot merge layer "0".

The two say different things. The first is temporary: make another layer current and the merge goes through. The second is permanent, because layer 0 belongs to the software and every drawing has to have it.

Which leads to a habit worth adopting: never draw on layer 0. Anything that lands there cannot be merged away; the only route is to select the objects and move them by hand, after which layer 0 is still sitting in the list. It is also why every standard layer set leaves 0 empty and reserves it for the contents of blocks.

A control: moving objects to another layer leaves it behind

A measurement is only worth having if something could have disproved it. If moving objects also removed the layer, the table above would prove nothing.

The test: add a layer IIC-C with 3 objects, use LAYMCH to move them to IIC-B, then erase the last one so IIC-C is completely empty.

MeasuredResult
Layers before moving3
Layers after moving3
IIC-C once fully emptystill in the list

So moving objects to another layer does not remove the layer, even after it is empty. Getting rid of it takes either a merge or a PURGE.

Tidying a drawing that came from somewhere else

On a real drawing this is never one pair but dozens. This order costs the least effort.

StepWhat to doWhy
1Run PU and choose Layers firstClears empty layers so they need no merging
2Decide the target layers and name them properlyYou cannot merge without somewhere to merge to
3Run LAYMRG, clicking several objects in one passThe whole group goes in one command
4Check colours and lineweights afterwardsCatches objects carrying hard-coded colour
5Run PU once moreClears whatever just lost its last reference

Step one is usually skipped and clears a surprising amount. An empty layer needs no merge, only a purge.

Step four is what people in a hurry forget. The layer list comes out tidy, but if the old objects carried hard-coded colours the plotted sheet is still a patchwork. Select everything on the target layer and set its colour back to ByLayer.

One note on undo: a merge in the wrong direction is recovered with U like any other command. Once the drawing has been saved and closed there is no way back, so merge before saving rather than reviewing afterwards.

Three things often repeated that are not true

Often repeatedWhat was measured on the 2027 release
Merging layers loses some geometry5 objects before, 5 after, none missing
Move everything off and the layer disappearsIIC-C was completely empty and still listed
After a merge the drawing looks unchangedObjects set to ByLayer take the target layer's colour

Frequently asked questions

Is merging layers in AutoCAD safe on a live drawing set?

Yes, in the sense that no geometry is lost. What does change is the colour and lineweight of anything set to ByLayer, so check the plotted result before issuing the sheets.

Which command merges layers?

Type LAYMRG, click an object on the layer to be merged, press Enter, then click an object on the target layer and answer Y.

Can several layers be merged at once?

Yes. The first question repeats until you press Enter, so click an object on each layer in turn.

The layer I want has nothing visible on screen.

Use the Name option to open the dialog and pick it by name instead of hunting for an object.

The objects changed colour after merging — is that a fault?

No. They were set to ByLayer, so they take the colour of the target layer. Give them a hard-coded colour beforehand if that matters.

I merged the wrong way round. Can I undo it?

Type U straight away. The command undoes like any other, as long as the drawing has not been saved and closed.

How is this different from changing the layer in the Properties palette?

That only moves the objects; the old layer stays in the list. LAYMRG moves them and removes the old layer from the drawing.

About the author

TS. Đỗ Quốc Hoàng — Vice Director of the Institute of Information Technology in Civil Engineering, Hanoi University of Civil Engineering, and a specialist in software development for construction