vivekgrs Posted July 17, 2006 Posted July 17, 2006 hi, how to lock/freeze the layer through lisp regards m.arunachalam Quote
rkmcswain Posted July 17, 2006 Posted July 17, 2006 Here are a couple of ways. (command "._LAYER" "_LO" "0" "") (vla-put-lock (vla-item (vla-get-layers (vla-get-activedocument (vlax-get-acad-object)) ) "0" ) :vlax-true ) Quote
CAB Posted July 19, 2006 Posted July 19, 2006 Here is another play toy. ;; layerSet.lsp by CAB 07/19/2006 ;; Set layer state ;; ;; Arguments - <layer name> <state to set> ;; States supported ;; On ;; Off ;; Freeze ;; Thaw ;; Lock ;; Unlock ;; Plot ;; Noplot (defun layerset (lname state / sym mode) (if (and (setq obj (tblobjname "layer" lname)) (setq obj (vlax-ename->vla-object obj))) (progn (cond ((= "ON" (setq state (strcase state))) (setq sym 'vla-put-layeron mode :vlax-true)) ((= "OFF" state) (setq sym 'vla-put-layeron mode :vlax-false)) ((= "FREEZE" state) (setq sym 'vla-put-freeze mode :vlax-true)) ((= "THAW" state) (setq sym 'vla-put-freeze mode :vlax-false)) ((= "LOCK" state) (setq sym 'vla-put-lock mode :vlax-true)) ((= "UNLOCK" state) (setq sym 'vla-put-lock mode :vlax-false)) ((= "PLOT" state) (setq sym 'vla-put-plottable mode :vlax-true)) ((= "NOPLOT" state) (setq sym 'vla-put-plottable mode :vlax-false)) ) (if mode (not (vl-catch-all-error-p (vl-catch-all-apply sym (list obj mode)))) ) ) ) ) (defun c:test(/ ent ln) (and (setq ent (car(entsel "\nSelect an object to turn layer off"))) (or (layerset (setq ln (cdr (assoc 8 (entget ent)))) "") (not (prompt (strcat "\nLayer " ln " was turnes OFF.")))) (prompt (strcat "\nCould not turn layer " ln " OFF.")) ) ) Quote
bstegemann7788 Posted July 22, 2008 Posted July 22, 2008 i need a program that will allow you to pick the objects from the screen and then ask the user to give a name for the new layer state. Quote
godofcad Posted March 3, 2010 Posted March 3, 2010 hi, how to lock/freeze the layer through lisp regards m.arunachalam (defun c:lock () (setvar "cmdecho" 0) (setq data (enget (car (entsel))))) (setq laynme assoc 8 data)) (setq lay (cdr laynme)) (command "layer" "lock" lay "") (princ)) Quote
godofcad Posted March 3, 2010 Posted March 3, 2010 type "frz" to run lisp ((defun c:frz () (setvar "cmdecho" 0) (setq data (enget (car (entsel))))) (setq laynme assoc 8 data)) (setq lay (cdr laynme)) (command "layer" "freeze" lay "") (princ)) 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.