gS7 Posted May 29, 2012 Posted May 29, 2012 Hi Guys .... Have a Good day i need to find the selected object is on locked Layer or not what is the DXF code for Locked layer ... Please Help Quote
MSasu Posted May 29, 2012 Posted May 29, 2012 The lock state of the layer is stored on DXF code 70 as bit 2 (value = 4). Quote
gS7 Posted May 29, 2012 Author Posted May 29, 2012 o need a program that find to layer is locked or not can do it for me please Quote
MSasu Posted May 29, 2012 Posted May 29, 2012 When you select the said object the lock/un-lock status of his layer is visible in layers pop-up list; not sure what a dedicated routine will do better than this built-in feature. Quote
gS7 Posted May 29, 2012 Author Posted May 29, 2012 When you select the said object the lock/un-lock status of his layer is visible in layers pop-up list; not sure what a dedicated routine will do better than this built-in feature. I Created a small Lisp that Works for change selected object color ....... if i select a locked objects my lisp is not working its showing error ..... so i want to filter only unlocked layer objects dxf code 72 is showing 0 valuse (72. 0) .......please help Quote
BlackBox Posted May 29, 2012 Posted May 29, 2012 I Created a small Lisp that Works for change selected object color ....... if i select a locked objects my lisp is not working its showing error ..... so i want to filter only unlocked layer objects dxf code 72 is showing 0 valuse (72. 0) .......please help Please post your code. Quote
hemuni Posted May 29, 2012 Posted May 29, 2012 maybe you can use this: (setq L (tblnext "layer" T)) (while L (if (/= 4 (logand 4 (cdr (assoc 70 L)))) (progn ;;; your stuff here ;;; ) ) (setq L (tblnext "layer")) ) Quote
BlackBox Posted May 29, 2012 Posted May 29, 2012 maybe you can use this: (setq L (tblnext "layer" T)) (while L (if (/= 4 (logand 4 (cdr (assoc 70 L)))) (progn ;;; your stuff here ;;; ) ) (setq L (tblnext "layer")) ) Look, we're trying to help you... The code you posted does not do any this: I Created a small Lisp that Works for change selected object color ....... if i select a locked objects my lisp is not working its showing error ..... so i want to filter only unlocked layer objects dxf code 72 is showing 0 valuse (72. 0) .......please help ... So, maybe you can post the code you're having trouble with instead? Quote
hemuni Posted May 29, 2012 Posted May 29, 2012 Look, we're trying to help you... The code you posted does not do any this: ... So, maybe you can post the code you're having trouble with instead? eeh, I'm trying to help the OP?? Quote
gS7 Posted May 29, 2012 Author Posted May 29, 2012 (defun c:ccl () (prompt "\nSelect Object(s) To Change Color") (if (setq sset (ssget)) (progn (if (setq nwcol (getint "\nEnter New Color:")) (progn (setq cntr 0) (repeat (setq len (sslength sset)) (setq ssnm (ssname sset cntr)) (setq ent (entget ssnm)) (if (= (cdr (assoc 62 ent)) nil) (command "chprop" sset "" "c" nwcol "") (progn (entmod (subst (cons 62 nwcol) (assoc 62 ent) ent)) (princ) (setq cntr (1+ cntr))(princ) ) ) ) ) ) ) )(princ) ) Quote
BlackBox Posted May 29, 2012 Posted May 29, 2012 eeh, I'm trying to help the OP?? My mistake... I posted too quickly. Sorry for MY confusion. Quote
gS7 Posted May 29, 2012 Author Posted May 29, 2012 Command: ccl Select Object(s) To Change Color Select objects: Specify opposite corner: 1 found Select objects: Enter New Color:2 Unknown command "C". Press F1 for help. 2 Unknown command "CCL". Press F1 for help. Quote
hemuni Posted May 29, 2012 Posted May 29, 2012 This will do the trick: (defun c:ccl () (prompt "\nSelect Object(s) To Change Color") (if (setq sset (ssget)) (progn (if (setq nwcol (getint "\nEnter New Color:")) (progn (setq cntr 0) (repeat (setq len (sslength sset)) (setq ssnm (ssname sset cntr)) (setq ent (entget ssnm)) (and (/= 4 (logand 4 (cdr (assoc 70 (tblsearch "LAYER" (cdr (assoc 8 ent))))))) (= (cdr (assoc 62 ent)) nil) (progn (command "chprop" sset "" "c" nwcol "") (entmod (subst (cons 62 nwcol) (assoc 62 ent) ent)) (princ) (setq cntr (1+ cntr))(princ) ) ) ) ) ) ) ) (princ) ) Quote
BlackBox Posted May 29, 2012 Posted May 29, 2012 (defun c:CCL () (c:ChangeColor)) (defun c:ChangeColor (/ *error*) (vl-load-com) (princ "\rCHANGECOLOR ") (defun *error* (msg) (and oldNomutt (setvar 'nomutt oldNomutt)) (if acDoc (vla-endundomark acDoc)) (cond ((not msg)) ; Normal exit ((member msg '("Function cancelled" "quit / exit abort"))) ; <esc> or (quit) ((princ (strcat "\n** Error: " msg " ** ")))) ; Fatal error, display it (princ)) ((lambda (acDoc oldNomutt / ss color) (vla-startundomark acDoc) (if (and (princ "\nSelect Object(s) To Change Color: ") (setvar 'nomutt 1) (setq ss (ssget [color=red]"_:L"[/color])) (princ "\nSpecify a new object color: ") (setq color (acad_colordlg (cond ((= "BYLAYER" (setq color (getvar 'cecolor))) 1) ((atoi color))) nil))) (progn (vlax-for x (setq ss (vla-get-activeselectionset acDoc)) (vla-put-color x color)) (vla-delete ss) (*error* nil)) (cond (ss (*error* "No color selected")) ((*error* "Nothing selected"))))) (vla-get-activedocument (vlax-get-acad-object)) (getvar 'nomutt))) Quote
gS7 Posted May 29, 2012 Author Posted May 29, 2012 wow !!! its working perfectly ...than you and hugs hemuni is there any option to show which layer is locked ...hmmmm Quote
gS7 Posted May 29, 2012 Author Posted May 29, 2012 (defun c:CCL () (c:ChangeColor)) (defun c:ChangeColor (/ *error*) (vl-load-com) (princ "\rCHANGECOLOR ") (defun *error* (msg) (and oldNomutt (setvar 'nomutt oldNomutt)) (if acDoc (vla-endundomark acDoc)) (cond ((not msg)) ; Normal exit ((member msg '("Function cancelled" "quit / exit abort"))) ; <esc> or (quit) ((princ (strcat "\n** Error: " msg " ** ")))) ; Fatal error, display it (princ)) ((lambda (acDoc oldNomutt / ss color) (vla-startundomark acDoc) (if (and (princ "\nSelect Object(s) To Change Color: ") (setvar 'nomutt 1) (setq ss (ssget "_:L")) (princ "\nSpecify a new object color: ") (setq color (acad_colordlg (cond ((= "BYLAYER" (setq color (getvar 'cecolor))) 1) ((atoi color))) nil))) (progn (vlax-for x (setq ss (vla-get-activeselectionset acDoc)) (vla-put-color x color)) (vla-delete ss) (*error* nil)) (cond (ss (*error* "No color selected")) ((*error* "Nothing selected"))))) (vla-get-activedocument (vlax-get-acad-object)) (getvar 'nomutt))) Renderman that was awesome code editing by you ......... now i got what i exactly need ...its filtering only unlocked layer objects :D:D:D Quote
BlackBox Posted May 29, 2012 Posted May 29, 2012 Renderman that was awesome code editing by you ......... now i got what i exactly need ...its filtering only unlocked layer objects :D:D:D That is kind of you to say; happy to help. Quote
MSasu Posted May 29, 2012 Posted May 29, 2012 So, finally you were looking for a way to filter out items in locked layers from your selection - may be useful for you to check this post for more information on SSGET filters. 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.