samifox Posted May 18, 2015 Share Posted May 18, 2015 Hi Using acad 10. when you want to hide a layer in the xref, ull use Freeze and select the object. in the same way i want to changh the color of the layer in the xref. is that built-in acad function? Thanks S Quote Link to comment Share on other sites More sharing options...
BMXerScott Posted May 18, 2015 Share Posted May 18, 2015 You can do that through your layer manager. Quote Link to comment Share on other sites More sharing options...
BlackBox Posted May 18, 2015 Share Posted May 18, 2015 (vl-load-com) (defun c:CLCN () (c:ChangeLayerColorNested)) (defun c:ChangeLayerColorNested (/ *error* entity layer layers color acDoc oLayers) (princ "\rCHANGELAYERCOLORNESTED ") (defun *error* (msg) (if acDoc (progn (vla-endundomark acDoc) (vla-regen acDoc acAllViewports) ) ) (cond ((not msg)) ; Normal exit ((member msg '("Function cancelled" "quit / exit abort"))) ; <esc> or (quit) ((princ (strcat " ** Error: " msg " ** "))) ) ; Fatal error, display it (princ) ) (while (/= nil (setq entity (nentsel "\nSelect nested entity to change layer color: " ) ) ) (if (not (vl-position (setq layer (if (= "0" (setq layer (cdr (assoc 8 (entget (car entity)))))) (cdr (assoc 8 (entget (car (last entity))))) layer ) ) layers ) ) (print (reverse (setq layers (cons layer layers)))) ) ) (if (and layers (setq color (if (= 1 (length layers)) (cdr (assoc 62 (tblsearch "layer" (car layers)))) 1 ) ) (princ "\nSelect replacement layer color: ") (setq color (acad_colordlg color nil)) ) (progn (vla-startundomark (setq acDoc (vla-get-activedocument (vlax-get-acad-object))) ) (setq oLayers (vla-get-layers acDoc)) (foreach layer layers (vla-put-color (vla-item oLayers layer) color) ) ) ) (*error* nil) ) Quote Link to comment Share on other sites More sharing options...
samifox Posted May 18, 2015 Author Share Posted May 18, 2015 (vl-load-com) (defun c:CLCN () (c:ChangeLayerColorNested)) (defun c:ChangeLayerColorNested (/ *error* entity layer layers color acDoc oLayers) (princ "\rCHANGELAYERCOLORNESTED ") (defun *error* (msg) (if acDoc (progn (vla-endundomark acDoc) (vla-regen acDoc acAllViewports) ) ) (cond ((not msg)) ; Normal exit ((member msg '("Function cancelled" "quit / exit abort"))) ; <esc> or (quit) ((princ (strcat " ** Error: " msg " ** "))) ) ; Fatal error, display it (princ) ) (while (/= nil (setq entity (nentsel "\nSelect nested entity to change layer color: " ) ) ) (if (not (vl-position (setq layer (if (= "0" (setq layer (cdr (assoc 8 (entget (car entity)))))) (cdr (assoc 8 (entget (car (last entity))))) layer ) ) layers ) ) (print (reverse (setq layers (cons layer layers)))) ) ) (if (and layers (setq color (if (= 1 (length layers)) (cdr (assoc 62 (tblsearch "layer" (car layers)))) 1 ) ) (princ "\nSelect replacement layer color: ") (setq color (acad_colordlg color nil)) ) (progn (vla-startundomark (setq acDoc (vla-get-activedocument (vlax-get-acad-object))) ) (setq oLayers (vla-get-layers acDoc)) (foreach layer layers (vla-put-color (vla-item oLayers layer) color) ) ) ) (*error* nil) ) Thanks Blackbox Quote Link to comment Share on other sites More sharing options...
BlackBox Posted May 19, 2015 Share Posted May 19, 2015 Thanks Blackbox You're welcome, samifox; I'm happy to help. Quote Link to comment Share on other sites More sharing options...
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.