ghostware Posted December 5, 2009 Posted December 5, 2009 I want to change block color layer and ltype (1000 pst.) Block entity 1: Layer 1 to 0 Color bylayer to byblock Ltype bylayer to byblock Block entity 2: Layer 1 to 0 Color 2 to 1 Ltype Dashdot (do not change) Thanks for any help. Pascal Quote
ghostware Posted December 5, 2009 Author Posted December 5, 2009 No blockreplace I want to change de color, layer and ltype of the block. Quote
fixo Posted December 5, 2009 Posted December 5, 2009 I want to change block color layer and ltype (1000 pst.) Block entity 1: Layer 1 to 0 Color bylayer to byblock Ltype bylayer to byblock Block entity 2: Layer 1 to 0 Color 2 to 1 Ltype Dashdot (do not change) Thanks for any help. Pascal I havent't time to test just try yourself (defun C:CBC (/ blockobj bname en ent obj);change block (setq ent (entsel "\nSelect block: ")) (setq en (car ent) obj (vlax-ename->vla-object en) bname (vla-get-effectivename obj) blockobj (vla-item (vla-get-blocks (vla-get-activedocument (vlax-get-acad-object))) bname) ) (vla-put-layer obj "0") (vlax-for item blockobj (if (eq "1" (vla-get-layer item)) (if (and (eq "AcDbLine" (vla-get-objectname item)) (eq "DASHDOT" (strcat (vla-get-linetype item))) (eq 2 (vla-get-color item)) ) (progn (vla-put-layer item "0") (vla-put-color item 1)) (progn (vla-put-layer item "0") (vla-put-color item acByBlock) (vla-put-linetype item "BYBLOCK") ) ) ) ) (vla-regen (vla-get-activedocument (vlax-get-acad-object)) acallviewports) (princ) ) (princ "\n *** Type CBC to execute ***") (prin1) (vl-load-com) ~'J'~ Quote
ghostware Posted December 6, 2009 Author Posted December 6, 2009 Hi Fixo, CBC.lsp works great, Now I have the following problem. I want to change 3 colors (see example). Pascal Quote
fixo Posted December 6, 2009 Posted December 6, 2009 Hi Fixo, CBC.lsp works great, Now I have the following problem. I want to change 3 colors (see example). Pascal Pascal, post the sample drawing, please I use A2008 Your pic is not clearly enough for me ~'J'~ Quote
ghostware Posted December 6, 2009 Author Posted December 6, 2009 Here is my sample drawing.. Pascal, post the sample drawing, please I use A2008 Your pic is not clearly enough for me ~'J'~ Change Block.dwg Quote
fixo Posted December 6, 2009 Posted December 6, 2009 Here is my sample drawing.. Ok, I will be back in tomorrow ~'J'~ Quote
fixo Posted December 7, 2009 Posted December 7, 2009 Here is my sample drawing.. Hi, Pascal Try this again (defun C:CB2 (/ blockobj bname en ent obj) ;change block (setq ent (entsel "\nSelect block: ")) (setq en (car ent) obj (vlax-ename->vla-object en) bname (vla-get-effectivename obj) blockobj (vla-item (vla-get-blocks (vla-get-activedocument (vlax-get-acad-object))) bname) ) (vla-put-layer obj "0") (vlax-for item blockobj (if (and (eq "DASHDOT" (strcase (vla-get-linetype item))) (eq 2 (vla-get-color item)) ) (vla-put-color item 1) ) (if (and (eq "ByLayer" (vla-get-linetype item)) (eq acLnWtByLayer (vla-get-lineweight item)) (eq 2 (vla-get-color item)) ) (vla-put-color item ) (if (eq acByLayer (vla-get-color item)) (vla-put-color item acByBlock) ) (vla-put-layer item "0") ) (vla-regen (vla-get-activedocument (vlax-get-acad-object)) acallviewports) (princ) ) (princ "\n *** Type CB2 to execute ***") (prin1) (vl-load-com) ~'J'~ Quote
ghostware Posted December 7, 2009 Author Posted December 7, 2009 Thx Fixo! for your routine (CB2.LSP). Now I could do my job faster than before. Thank you very much for your time. Quote
fixo Posted December 7, 2009 Posted December 7, 2009 Thx Fixo! for your routine (CB2.LSP). Now I could do my job faster than before. Thank you very much for your time. You're welcome Cheers ~'J'~ 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.