AfraLisp Blog

The AutoLisp/Visual Lisp/VBA Resource Website

AfraLisp Blog

Home Newsletter Utter Rubbish Coding Tips AutoCAD Tips Contact Downloads WAUN

Is there a way to make a Layer current just by picking an object from the drawing?

;CODING STARTS HERE
(defun C:MLay ( / entity name layername)
(setq entity (car (entsel)))
(setq name (entget entity))
(setq layername (cdr (assoc 8 name)))
(setvar "clayer" layername)
(princ)
);defun
(princ)
;CODING ENDS HERE

Save this as MLay.lsp

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