chico1201 Posted April 30, 2015 Share Posted April 30, 2015 Can anyone help? This lisp can chang all items to layer 0,but color can change to "bylayer" ? Please have anyone can help me try to modification this lisp? Thanks a lot!! CHGABLA.LSP Quote Link to comment Share on other sites More sharing options...
Jef! Posted May 1, 2015 Share Posted May 1, 2015 Yes.. please try the following (defun c:chgabla (/ ss ly doc) ;; Tharwat 27.May.2014 ;; (if (and (/= (setq ly (getstring t "\n Specify Layer name :")) "") (if (not (tblsearch "LAYER" ly)) (progn (alert (strcat "Layer name < " ly " > is not found !!")) nil) t ) (princ "\n Select attributed blocks to change layer of Attributes ") (setq ss (ssget "_:L" '((0 . "INSERT") (66 . 1)))) ) (progn (vla-startUndomark (setq doc (vla-get-activedocument (vlax-get-acad-object)))) ((Lambda (i / sn e) (while (setq sn (ssname ss (setq i (1+ i)))) (setq e (tblobjname "BLOCK" (cdr (assoc 2 (entget sn))))) (while (setq e (entnext e)) (entmod (subst (cons 8 ly) (assoc 8 (entget e)) (entget e)))) (foreach x (vlax-invoke (vlax-ename->vla-object sn) 'getattributes) (vla-put-layer x ly)[color="#f4a460"](vla-put-color x 256)[/color]) ) ) -1 ) (vla-Endundomark doc) ) ) (princ) )(vl-load-com) As you can see, in the foreach loop, when reside the code for changing the layer you just had to add the code to change the color (256 is bylayer) Cheers! Quote Link to comment Share on other sites More sharing options...
chico1201 Posted May 2, 2015 Author Share Posted May 2, 2015 That's wonderful. Many thanks for your support to help me modified this program. Quote Link to comment Share on other sites More sharing options...
Jef! Posted May 4, 2015 Share Posted May 4, 2015 You are very welcome, and i'm glad i could help! Cheers! Jef! 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.