Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Extract Layers...

7 REPLIES 7
Reply
Message 1 of 8
engr_mondo
1027 Views, 7 Replies

Extract Layers...

How can I extract all layers in an open drawing to a notepad or txt file? TIA
Regards,

Mondo
7 REPLIES 7
Message 2 of 8
gjrcmb
in reply to: engr_mondo

Thanks to Lynn Allen on her recent video posting on a reminder on how to "Print a List of Your Layers" at http://www.cadalyst.com/video

Open Layer Manager, select All Layers (Ctrl-A), Copy all layers with Ctrl-C.  Open Notepad or actually Excel is better and Paste.

OR

Enter -Layer at the command prompt, type ?, then *, and copy layer listing from Text Screen.

Message 3 of 8
Kent1Cooper
in reply to: engr_mondo


@engr_mondo wrote:
How can I extract all layers in an open drawing to a notepad or txt file? TIA

If you just want the Layer names written out to a file, here's one way:

 

(defun C:LLTF (/ lay); = Layer List To File
  (setq LLF (open "X:/Your/File/Path/And/Filename.txt" "w"))
  (while (setq lay (tblnext "layer" (not lay)))
    (write-line (cdr (assoc 2 lay)) LLF)
  ); while
  (close LLF)
); defun

Kent Cooper, AIA
Message 4 of 8
gjrcmb
in reply to: engr_mondo

Oh, you want a lisp routine.  My oversight.  Smiley Embarassed

Message 5 of 8
engr_mondo
in reply to: gjrcmb

Copy-Paste thing doesn't work in 2011... Thanks to all!
Regards,

Mondo
Message 6 of 8
Hallex
in reply to: engr_mondo

Mondo,

Try this lisp from my code library

Change to display properties as you need

 

~'J'~

_____________________________________
C6309D9E0751D165D0934D0621DFF27919
Message 7 of 8
Kent1Cooper
in reply to: Kent1Cooper


Kent1Cooper wrote:

....

If you just want the Layer names written out to a file, here's one way:

....


You can have it include more information about the Layer, if you want.  For example, to put the values for:

 

LayerName ColorNumber Linetype

 

on each Layer's line in the resulting text file, do this:

 

(defun C:LLTF (/ LLF lay); = Layer List To File
  (setq LLF (open "X:/Your/File/Path/And/Filename.txt" "w"))
  (while (setq lay (tblnext "layer" (not lay)))
    (write-line
      (strcat
        (cdr (assoc 2 lay)) " " ; name
        (itoa (cdr (assoc 62 lay))) " " ; color
        (cdr (assoc 6 lay)); linetype
      ); strcat
      LLF
    ); write-line
  ); while
  (close LLF)
); defun

Kent Cooper, AIA
Message 8 of 8
engr_mondo
in reply to: Kent1Cooper

How to import back the exported file to AutoCAD and read modified items? TIA
Regards,

Mondo

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost