AfraLisp Blog

The AutoLisp/Visual Lisp/VBA Resource Website

AfraLisp Blog

Home Newsletter Utter Rubbish Coding Tips AutoCAD Tips Contact Downloads WAUN

Is there any way to check the status of a LAYER. ei. is it frozen, off, locked etc...

First create the layer STEEL then type the following :

(setq t (tblsearch "LAYER" "STEEL"))

The entity list of the layer STEEL should be returned :

((0 . "LAYER") (2 . "STEEL") (70 . 64) (62 . 7) (6 . "CONTINOUS"))

The first part of the entity list is '0', indicating Associative 0.
In this case it's an entry in the "LAYER" Table.
Associative 2 indicates the name of the layer. STEEL in our case.
Associative 70 is the state of the entity. 1 is Frozen, 2 is Frozen on new paper space view ports and 4 is locked. These numbers are added to 64. In this case the layer is neither frozen nor locked.
Associative 62 is the colour of the layer. Ours is white which is colour number 7. If the colour number is a negative number then the layer is off.
Associative 6 is the linetype of the layer, in this case, "CONTINUOUS".

If the (tblsearch) had not found the layer then it would have returned 'nil' and you would know that the layer did not exist.

Therefore, all you have to do is test for the relevant associative code value to determine the status of your layer.

The AutoLisp/Visual Lisp/VBA Resource Website

Copyright 1999-Perpetuity by AfraLisp

All rights reserved.
Information in this document is subject to change without notice.
Site created and maintained by Kenny Ramage

The AutoLisp/Visual Lisp/VBA Resource Website