I came accross this routine from Cadence Web site. When I do a test run;
it seems that all the Layers are set to *ON* and "THAWED AND UNLOCKED"
in the print out even when some of the layers are OFF and in different
state in the Drawing. The Color and Linetype Seems to print out
correctly. Could someone please help me find out what the problem is.
Thanks in advance for all your assistant.
Sincerely,
Van
pha...@yahoo.com
;; AutoCad AutoLisp routine to print directory name,
;; file name, and conditions of layers of current drawing.
;; A text file "layers.txt" is generated
;; Copyright June 1997 Jesse Casanova
(defun c:lcond(/ filein tname lname lcolor lstate lcol frz lcond)
;; Establish file for layer names
(setq filein (open "c:\\temp\\layers.txt" "w"))
(write-line (strcat "Drawing Name = " (getvar "dwgname")) filein)
(write-line "STATUS OF LAYERS" filein)
(write-line "LAYER NAME: ON/OFF, THAWED/FROZEN, COLOR NUMBER, LINETYPE"
filein)
(write-line " " filein)
(close filein)
;; Layer names
(setq tname (tblnext "layer" T)
lname (cdr (assoc 2 tname)) ;; layer name
lcolor (cdr (assoc 62 tname)) ;; color (- means off)
lstate (cdr (assoc 70 tname)) ;; on (65 means frozen)
ltyp (cdr (assoc 6 tname)) ;; line type
colo (itoa (abs lcolor)) ;; color number
)
(if (> lcolor 0)
(setq lcol "ON")
(setq lcol "OFF")
)
(if (= lstate 64) (setq frz "THAWED AND UNLOCKED")) ;; Various
(if (= lstate 65) (setq frz "FROZEN AND UNLOCKED")) ;; Combinations
(if (= lstate 68) (setq frz "THAWED AND LOCKED")) ;; of FREEZE/THAW
(if (= lstate 69) (setq frz "FROZEN AND LOCKED")) ;; and
LOCK/UNLOCK
(if (= lstate 0) (setq frz "THAWED AND UNLOCKED"))
(setq lcond (strcase (strcat "layer " lname ": " lcol ", " frz ", " colo
", " ltyp)))
(setq filein (open "c:\\temp\\layers.txt" "a"))
(write-line lcond filein)
(close filein)
(while
(setq tname (tblnext "layer"))
(setq lname (cdr (assoc 2 tname))
lcolor (cdr (assoc 62 tname))
lstate (cdr (assoc 70 tname))
ltyp (cdr (assoc 6 tname))
colo (itoa (abs lcolor))
)
(if (> lcolor 0)
(setq lcol "ON")
(setq lcol "OFF")
)
(if (= lstate 64) (setq frz "THAWED AND UNLOCKED"))
(if (= lstate 65) (setq frz "FROZEN AND UNLOCKED"))
(if (= lstate 68) (setq frz "THAWED AND LOCKED"))
(if (= lstate 69) (setq frz "FROZEN AND LOCKED"))
(if (= lstate 0) (setq frz "THAWED AND UNLOCKED"))
(setq lcond (strcase (strcat "layer " lname ": " lcol ", " frz ", "
colo ", " ltyp)))
(setq filein (open "c:\\temp\\layers.txt" "a"))
(write-line lcond filein)
(close filein)
) ;; end while
(princ)
)
>>>> Print out sample
Plan.dwg.DWG
STATUS OF LAYERS
LAYER NAME: ON/OFF, THAWED/FROZEN, COLOR NUMBER, LINETYPE
LAYER 0: ON, THAWED AND UNLOCKED, 7, CONTINUOUS
LAYER PATTERN_CLASS: ON, THAWED AND UNLOCKED, 7, CONTINUOUS
LAYER 25: ON, THAWED AND UNLOCKED, 7, CONTINUOUS
LAYER 20: ON, THAWED AND UNLOCKED, 7, CONTINUOUS
LAYER 1: ON, THAWED AND UNLOCKED, 7, CONTINUOUS
LAYER 23: ON, THAWED AND UNLOCKED, 7, CONTINUOUS
LAYER 16: ON, THAWED AND UNLOCKED, 7, CONTINUOUS
LAYER 58: ON, THAWED AND UNLOCKED, 7, CONTINUOUS
LAYER 14: ON, THAWED AND UNLOCKED, 7, CONTINUOUS
LAYER EXT-BLDG: ON, THAWED AND UNLOCKED, 7, CONTINUOUS
LAYER AN-ROAD: ON, THAWED AND UNLOCKED, 4, CONTINUOUS
LAYER AN-WALL: ON, THAWED AND UNLOCKED, 6, CONTINUOUS
LAYER TEXT: ON, THAWED AND UNLOCKED, 4, CONTINUOUS
LAYER PARKING3: ON, THAWED AND UNLOCKED, 7, CONTINUOUS
LAYER FILL: ON, THAWED AND UNLOCKED, 11, CONTINUOUS
LAYER RFSHEET: ON, THAWED AND UNLOCKED, 3, CONTINUOUS
LAYER FILL-DARK: ON, THAWED AND UNLOCKED, 3, CONTINUOUS
<<<<< End of sample
;; AutoCad AutoLisp routine to print directory name,
;; file name, and conditions of layers of current drawing.
;; A text file "layers.txt" is generated
;; Copyright June 1997 Jesse Casanova
;; Modified 1/19/99 by Jon Fleming
(defun c:lcond (/ filein tname lname lcolor lstate lcol frz Rewind)
;; Establish file for layer names
(setq filein (open "c:\\temp\\layers.txt" "w"))
(write-line
(strcat "Drawing Name = " (getvar "dwgname"))
filein
)
(write-line "STATUS OF LAYERS" filein)
(write-line
"LAYER NAME: ON/OFF, THAWED/FROZEN, COLOR NUMBER, LINETYPE"
filein
)
(write-line " " filein)
(setq Rewind T)
(while
(setq tname (tblnext "layer" Rewind))
(setq lname (cdr (assoc 2 tname))
lcolor (cdr (assoc 62 tname))
lstate (cdr (assoc 70 tname))
ltyp (cdr (assoc 6 tname))
colo (itoa (abs lcolor))
Rewind NIL
)
(if (> lcolor 0)
(setq lcol "On")
(setq lcol "Off")
)
(if (= 1 (logand lstate 1))
(setq frz "Frozen and ")
(setq frz "Thawed and ")
)
(if (= 2 (logand lstate 2))
(setq frz (strcat frz "Frozen in new VP and "))
(setq frz (strcat frz "Thawed in new VP and "))
)
(if (= 4 (logand lstate 4))
(setq frz (strcat frz "Locked"))
(setq frz (strcat frz "Unlocked"))
)
(write-line
(strcat "layer " lname ": " lcol ", " frz ", " colo ", " ltyp)
filein
)
)
(close filein)
(princ)
)
jrf
In article <36A4CC76...@yahoo.com>, Van Phan wrote:
> Hello All,
It worked perfectly. Now I do not have to write down all the layer names
and their status anymore. I am sure someone out there could use this as
well.
I only beginning to play around with Auto Lisp but hopefuly I'll get better
so that I can contribute no matter how small to this NG like you did.
Sincerely,
Van
Jon Fleming <jo...@fleming-group.com> wrote in article
<VA.0000070...@main.fleming-group.com>...