Lee Mac Posted September 4, 2013 Posted September 4, 2013 for example , a specific layer without extracting it out of its collection Since all Layer objects are stored within the Layers Collection, you would inexorably need to retrieve the Layer object from the Collection in order to operate on it, for example, to lock Layer "0": Using Visual LISP: (if (not (vl-catch-all-error-p (setq lay (vl-catch-all-apply 'vla-item (list (vla-get-layers (vla-get-activedocument (vlax-get-acad-object) ) ) "0" ) ) ) ) ) (vla-put-lock lay :vlax-true) ) Using Vanilla AutoLISP: (if (setq lay (tblobjname "layer" "0")) (progn (setq lay (entget lay) bit (assoc 70 lay) ) (entmod (subst (cons 70 (logior 4 (cdr bit))) bit lay)) ) ) Using a combination of Vanilla / Visual: (if (setq lay (tblobjname "layer" "0")) (vla-put-lock (vlax-ename->vla-object lay) :vlax-true) ) Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.