autolisp Posted July 8, 2010 Posted July 8, 2010 dear all, i need advance layer off on freez thaw lock unlock i'm using this one please help me advance layer off & on freez (defun c:LTT () (command "layer" "th" "*" "")) (defun c:LFF () (command "layer" "f" "*" "")) (defun c:Lon () (command "layer" "on" "*" "")) (defun c:LoF () (command "layer" "off" "*" "" "")) Quote
Tharwat Posted July 8, 2010 Posted July 8, 2010 Here it goes, (defun c:LTT () (command "_.-layer" "_thaw" "[color="Red"]Name of Layer[/color]" "") (princ) ) So the rest shall be as well ..... Try them. Tharwat Quote
autolisp Posted July 9, 2010 Author Posted July 9, 2010 Here it goes, (defun c:LTT () (command "_.-layer" "_thaw" "[color=red]Name of Layer[/color]" "") (princ) ) So the rest shall be as well ..... Try them. Tharwat What 'advancements' are you wanting to make? dear sir thx for reply yes making new lsp Quote
autolisp Posted July 9, 2010 Author Posted July 9, 2010 (defun c:lOF () (setq ss (entsel "\n Select Entity Layer To Off :")) (setq el (entget (car ss))) (setq la (cdr (assoc 8 el))) (command "layer" "off" la "") (PRINC) ) Quote
Lee Mac Posted July 9, 2010 Posted July 9, 2010 A few considerations: 1. (entget nil) will error, so better to check that the user has selected something using an IF statement perhaps. 2. Use (command "_.-layer"... To allow for language variations and to force non-dialog menu. 3. Localise your variables. Quote
Lee Mac Posted July 9, 2010 Posted July 9, 2010 Another way to approach it, just as an academic exercise: (defun c:lOff ( / ent def ) ;; © Lee Mac 2010 (if (setq ent (car (entsel))) (progn (setq def (entget (tblobjname "LAYER" (cdr (assoc 8 (entget ent) ) ) ) ) ) (entmod (subst (cons 62 (- (cdr (assoc 62 def) ) ) ) (assoc 62 def) def ) ) ) ) (princ) ) Quote
Lt Dan's legs Posted July 9, 2010 Posted July 9, 2010 Seems like this is a pretty similar thread... http://www.cadtutor.net/forum/showthread.php?t=45943 Quote
Tharwat Posted July 9, 2010 Posted July 9, 2010 There are some corrections to avoid the Layer dlg to appear which will break down your action .... (defun c:lOF () (setq ss (entsel "\n Select Entity Layer To Off :")) (setq el (entget (car ss))) (setq la (cdr (assoc 8 el))) (command "[color=Red]_.-[/color]layer" "[color=Red]_[/color]off" la "") (PRINC) ) Regards. Tharwat Quote
lpseifert Posted July 9, 2010 Posted July 9, 2010 Tharwat- (command "-layer"... (command "layer"... makes no difference Quote
Lt Dan's legs Posted July 9, 2010 Posted July 9, 2010 Tharwat- (command "-layer"... (command "layer"... makes no difference I believe it's just good practice to do (command "-layer"... try this (defun c:test (/) (initdia)(command "layer" "off" "0" nil)) vs (defun c:test (/) (initdia)(command "-layer" "off" "0" nil)) 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.