home *** CD-ROM | disk | FTP | other *** search
/ DP Tool Club 8 / CDASC08.ISO / VRAC / CAD08N06.ZIP / LAY_OUT.LSP < prev    next >
Text File  |  1993-04-01  |  2KB  |  49 lines

  1. ;This routine writes out the layer name, layer color, and layer
  2. ;linetype to a file that is named using the drawing name with the
  3. ;extension ".lyr". Use this file to create a look-up table for LAY_CONV
  4. ;to set your layers to a new layer standard. You must edit the file to
  5. ;include the desired new layer names and optionally change the color and
  6. ;linetype prior to running LAY_CONV. This routine ignores XREF layers.
  7.  
  8. (prompt "\nEnter LAY_OUT at the AutoCAD command prompt to execute...")
  9.  
  10. (defun C:LAY_OUT ()
  11. ;(/ dw_nm sl_ctr ctr ch layfil lay_lst)
  12.  (setq dw_nm (getvar "dwgname"))
  13.  (setq sl_ctr 1 
  14.        ctr 1
  15.  )
  16.  (while (/= "" (setq ch (substr dw_nm ctr 1)));check for path in dw_nm and
  17.   (if (= ch "\\")                             ;parse if path included
  18.    (setq sl_ctr ctr)
  19.   )
  20.   (setq ctr (1+ ctr))
  21.  )
  22.  (if (> sl_ctr 1)
  23.   (setq dw_nm (substr dw_nm (1+ sl_ctr) (- (strlen dw_nm) sl_ctr)))
  24.  )
  25.  (setq layfil (open (strcat dw_nm ".lyr") "w"));open layer data file
  26.  (if layfil
  27.   (progn
  28.    (while (setq lay_lst (tblnext "layer"))
  29.     (setq ctr 1)
  30.     (while (/= "" (setq ch (substr (cdr (assoc 2 lay_lst)) ctr 1)))
  31.      (if (= ch "|");test for xref layer
  32.       (setq xr_tst T)
  33.      )
  34.      (setq ctr (1+ ctr))
  35.     )
  36.     (if (not xr_tst);if not xref layer write to file
  37.      (write-line (strcat (cdr (assoc 2 lay_lst)) " " 
  38.                   (itoa (cdr (assoc 62 lay_lst))) " " 
  39.                   (cdr (assoc 6 lay_lst))) layfil
  40.      )
  41.     )
  42.     (setq xr_tst nil)
  43.    )
  44.   )
  45.   (prompt "Unable to open data file for writing...")
  46.  )
  47.  (setq layfil (close layfil));close the file
  48.  (princ)
  49. )