[Search tip detail and code files using keywords, tip number, author name, etc ]
Extract a List of Layers
Tip# 3182 By Dawn Pearl On 12-Apr-2009
Rated By 2 users
Categories : Layer Tools
Software type : AutoCAD 2009
Rename File To : No Files to download.
Dawn Pearl sent us this tip showing how to extract a list of layers from an AutoCAD file.

"I was able to produce a quick, printable list of layer names and properties from an AutoCAD drawing by copy clipping them from the layer dialog into a Microsoft Excel worksheet. Just open the layer dialog, highlight the layers within, copy to the clipboard, then paste into an open, empty Excel worksheet. I have also been able to copy clip the layer list from AutoCAD into other applications, such as text editors and Word, but Excel seems to work best."

This was done from an AutoCAD 2007 file into an Excel 2002 worksheet.

Notes from Cadalyst Tip Patrol: This is a great tip. I have no idea how many times I have needed to get a list of the layers in a file. The best part is that this technique is very simple to do. Just open the layer manager, select the layers you want in your list (ctrl+A will select them all), copy them (ctrl+C) then paste them (ctrl+V) into the document of your choice. You can even paste the list as Mtext into AutoCAD.


Average Rating:

User comments
Comment by Tulis,Ralph
Posted on 2009-04-13 15:18:42
Excellent tip! I never thought about how to copy from the Layer dialogue box. I would use "-Layer"|?|*|, then go to the text screen and copy-clip from there. It gives you a layer list a bit more abbreviated, which sometimes can be useful, unless you want each value in its own cell (which requires an intermediate step of saving to a text file and importing into Excel). Dawn's tip captures ALL layer data AND put each value into its own cell. Works fine in AutoCAD 2009.
Posted on 2009-04-13 20:36:57
Comment by Wooten,Billy
Posted on 2009-04-14 09:10:13
This Tip is very useful. Here's an alternate: The following routine takes it a step further and creates a Layer List in spreadsheet format. It uses the same name as the drawing being accessed and places it in the same folder as said drawing. In earlier versions of AutoCAD, it automatically opens the file, but in 2009, it needs a little "tweaking," therefore the file will have to be accessed from that particular folder. I hope this helps. Billy Wooten "Member, CADalyst Tip Patrol"
Comment by Seslar,Dave
Posted on 2009-04-14 10:56:13
I currently use both the LayerHtm.lsp and the 'Copy from History' method. This 'Copy from Layer Manager' method is a valuable addition. Each of the three has advantages and disadvantages. LayerHtm.lsp displays the results as a html file in Internet Explorer (or other browser) and looks much like the display in Layer Manager without the status or description fields. Units are not displayed for the lineweights. Also, as a html file, it can not easily be modified for documentation, script files or other purposes. LayerHtm will only export layers sorted by layer name. Copy from History saves the data from the Autocad text window which then can be pasted into Notepad for cleanup and subsequent use in Excel or other programs. This method omits the status and description fields, also the plot style field. All layer states are grouped; layers are shown as on, off or frozen (but not both off and frozen); and '-L' & '-P' flags are used to show 'Locked' and 'Plot' respectively (unlocked and no-plot are blanks). Lineweight units are shown. Cleanup is necessary for further use to remove other command data, blank lines, linewraps for long layer names, etc. All layers have color numbers along with names for colors 1 through 7. There is a 400 line or so limit on the copy/paste selection which can be annoying to work around. Header labels are provided for select fields. Copy from Layer Manager copies ALL of the fields from status to description and pastes them into Excel as separate columns in the same order. Field names are not copied. Layer colors are name-only for colors 1 through 7, numbers for the rest. Layer status is noted with '2' for current layer, '1' for all others. Layer states of on, frozen, locked and plot are flagged as 'True'; off, thawed, unlocked and no-plot are flagged as 'false'. No units or decimal points for lineweights are shown. I, for one, will be largely abandoning the Copy from History method to avoid the cleanup and will be Copying from LM into a spreadsheet pre-formated with field names and T/F flag values for when I need to manipulate the data. I will still use LayerHtm for basic look-up tables.
Posted on 2009-04-14 11:00:53
I didn't know about LayerHTM, but love it! The only real issue with it for me is the "Plot/No Plot" status is only displaying as "Plot", even if my layer is se to "No Plot".

Log In