AfraLisp Blog

The AutoLisp/Visual Lisp/VBA Resource Website

AfraLisp Blog

Home Newsletter Utter Rubbish Coding Tips AutoCAD Tips Contact Downloads WAUN

Want to create a layer using Visual Lisp?

;;;CODING STARTS HERE
;;;Returns a layer object or nil
;;;on creation failure
(defun mLayer (LayerName)
(vl-load-com)
(setq LayerName
(vl-catch-all-apply
'vla-add
(list
(vla-get-layers
(vla-get-activedocument
(vlax-get-acad-object)
)
)
Layername
)
)
)
(if (vl-catch-all-error-p LayerName)
nil
LayerName
)
)
;;;CODING ENDS HERE

Bobby C. Jones
http://www.acadx.com

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