bograd Posted July 1, 2010 Share Posted July 1, 2010 Awesome!. Thank you for your help. Quote Link to comment Share on other sites More sharing options...
bono05 Posted September 29, 2010 Share Posted September 29, 2010 Hi everybody, I'ts possible to have the command lisp Colorx ...without he's calling a dialog box? Many thanks! Quote Link to comment Share on other sites More sharing options...
Least Posted September 29, 2010 Share Posted September 29, 2010 VVA colorx is great, I also need to give the xref one a go. Not sure what the other variants do, I kind of got lost with alll the different requests. Sometimes I need to change the colour of all the objects in a drawing just like colourx already does, but sometimes I need to do the opposite. The drawing may be recieved completly one colour and I need to restore all the layer colours as they are in the layer property manager. Any chance of a modification to enable this restore feature? I can select all and set to bylayer, but it doesn't work with any attributes. Many thanks Pads edit: ah silly me, of course I can just select 'bylayer' in the select colour pop up. cheers! Quote Link to comment Share on other sites More sharing options...
VVA Posted September 29, 2010 Share Posted September 29, 2010 Hi everybody, I'ts possible to have the command lisp Colorx ...without he's calling a dialog box? Many thanks! Replace COLORX command in your lisp file or add as new command (defun C:COLORX (/ doc col) (vl-load-com) (setq doc (vla-get-activedocument (vlax-get-acad-object))) (vla-startundomark doc) (mip:layer-status-save) [color="red"](initget 4)[/color] (if ([color="red"]setq col (getint "\nEnter color index: "))[/color] (ChangeAllObjectsColor doc col) ;_ col — color number ) ;_ end of if (mip:layer-status-restore) (vla-endundomark doc) (princ) ) ;_ end of defun Quote Link to comment Share on other sites More sharing options...
bono05 Posted September 30, 2010 Share Posted September 30, 2010 Many thanks VVA!! Now i can use it with SuperAutoScript... Quote Link to comment Share on other sites More sharing options...
PORT80 Posted December 30, 2010 Share Posted December 30, 2010 Hello VVA, Awesome lisp routine! I was wondering how to make the color bylayer change thru the Layer Properties Manager instead of forcing the color? I noticed the lisp forces the color properties to the desired color of choice. Here is an example of the process I am trying to use. First I open the Layer Properties Manager - select all layers - unlock all layers - change all colors to 253 Next I go to modify - change to bylayer - select all - Y- Y and process complete. I have used your ColorX lisp and it works like a champ however it is difficult to manage the colors once they are forced to the color of choice. I am fairly new to writing lisp but do know many of the functions and features of AutoCad. I am now expanding my AutoCad knowledge to VBA, Lisp and automation. Any help would be greatly appreciated. Thank you for your time and efforts. Sincerely, Micahel Quote Link to comment Share on other sites More sharing options...
VVA Posted January 3, 2011 Share Posted January 3, 2011 I do not quite understand what the problem is? To change the color to "bylayer" You can call ColorX and select the appropriate button. Beginning with the 2008 version of AutoCAD command is added _setbylayer. Quote Link to comment Share on other sites More sharing options...
elleHCSC Posted January 11, 2011 Share Posted January 11, 2011 Hello VVA, myfile: http://www.mediafire.com/?jx011z72z4py6jh I have some blocks in my dwg. I just only want to change color of some block (not all) like this examble file by lisp. Can you help me ? sorry for my bad english. Thank you for your time and efforts. Quote Link to comment Share on other sites More sharing options...
VVA Posted January 11, 2011 Share Posted January 11, 2011 I have some blocks in my dwg. I just only want to change color of some block (not all) like this examble file by lisp. Can you help me ? Yes BLCC - Changes color of the chosen blocks ENCC - Changes color of the chosen objects (may be element of the block) Or ColorA - Changes in the color of selected items in the area Quote Link to comment Share on other sites More sharing options...
elleHCSC Posted January 11, 2011 Share Posted January 11, 2011 Tks VVA, i know BLCC, ENCC, ColorX lisp but i mean that in my dwg when i select 1 block then only this block to be change color. Quote Link to comment Share on other sites More sharing options...
VVA Posted January 11, 2011 Share Posted January 11, 2011 In the Block Editors set for all entities layer - 0 color - byblock Or load norm-blocks.lsp and type in command line Command: (norm-blocks 9) Quote Link to comment Share on other sites More sharing options...
elleHCSC Posted January 12, 2011 Share Posted January 12, 2011 tks VVA and forum, that great. Quote Link to comment Share on other sites More sharing options...
Cadikimmo Posted December 6, 2011 Share Posted December 6, 2011 Thanks for great lisp, but if yo don't want use lisp, so can you do same thing just entering commands? Quote Link to comment Share on other sites More sharing options...
saunambon654 Posted April 6, 2013 Share Posted April 6, 2013 What perfect! But can you create each layer for each color and put all objects same color in same layer? Quote Link to comment Share on other sites More sharing options...
VVA Posted April 15, 2013 Share Posted April 15, 2013 What perfect! But can you create each layer for each color and put all objects same color in same layer? Try it (defun C:C2L (/ tmp txt count TrueColor layFilter lay) ;;;http://forum.dwg.ru/showthread.php?p=1069183 ;;;http://www.cadtutor.net/forum/showthread.php?533-Lisp-colour-change-for-all-layers-and-blocks/page10 ;;; Color To Layer ;;; layFilter - Layer List ;;;If the colors are not in the list of layers, the layer will be called Color_Number. ;;;For example, for 123 colors -> Layer name "Color _123" ;;;color R = 12 G = 32 B = 65 -> Layer name "Color _12_32_65" (setq layFilter (list '((143 134 112) "MyLay1") ;_entity with color R = 143 G = 134 B = 112 is transferred to the layer "MyLay1" '((110 87 168) "MyLay2") ;_entity with color R = 110 G = 87 B = 168 is transferred to the layer "MyLay2" '((1) "Red") ;_entity with color ACI = 1 is transferred to the layer "Red" '((2) "Yellow") ;_entity with color ACI = 2 is transferred to the layer "Yellow" '((3) "Green") ;_entity with color ACI = 3 is transferred to the layer "Green" ) ;_ end of list ) ;_ end of setq (vl-load-com) (vlax-for Blk (vla-get-blocks (vla-get-activedocument (vlax-get-acad-object)) ) ;_ end of vla-get-Blocks (if (eq (vla-get-isxref Blk) :vlax-false) (progn (setq count 0 txt (strcat "Changed " (vla-get-name Blk)) ) ;_ end of setq (grtext -1 txt) (vlax-for Obj Blk (setq count (1+ count)) (if (zerop (rem count 10)) (grtext -1 (strcat txt " : " (itoa count))) ) ;_ end of if (if (and (vlax-write-enabled-p Obj) (vlax-property-available-p Obj 'Color) ) ;_ end of and (setq tmp (if (= (vla-get-colormethod (setq TrueColor (vla-get-truecolor Obj)) ) ;_ end of vla-get-ColorMethod accolormethodbyrgb ) ;_ end of = (list (vla-get-red TrueColor) (vla-get-green TrueColor) (vla-get-blue TrueColor) ) ;_ end of list (cond ((eq (vla-get-color obj) acbyblock) nil ) ((eq (vla-get-color obj) acbylayer) nil ) (t (list (vla-get-color obj))) ) ;_ end of cond ) ;_ end of if ) ;_ end of setq (setq tmp nil) ) ;_ end of if (or (setq lay (cadr (assoc tmp layFilter))) (setq lay (strcat "Color" (apply 'strcat (mapcar '(lambda (x) (strcat "_" (itoa x))) tmp) ) ;_ end of apply ) ;_ end of strcat ) ;_ end of setq ) ;_ end of or (if (and tmp (listp tmp) (vlax-write-enabled-p Obj)) (entmod (subst (cons 8 lay ) ;_ end of cons (assoc 8 (entget (vlax-vla-object->ename obj))) (entget (vlax-vla-object->ename obj)) ) ;_ end of subst ) ;_ end of entmod ) ;_ end of if ) ;_ end of vlax-for ) ;_ end of progn ) ;_ end of if ) ;_ end of vlax-for (vl-cmdf "_regenall") (princ) ) ;_ end of defun Quote Link to comment Share on other sites More sharing options...
saunambon654 Posted April 16, 2013 Share Posted April 16, 2013 Thank you! It's good, but no work for "bylayer" color. Quote Link to comment Share on other sites More sharing options...
VVA Posted April 18, 2013 Share Posted April 18, 2013 found (cond ((eq (vla-get-color obj) acbyblock) nil ) ((eq (vla-get-color obj) acbylayer) nil ) and change (cond ((eq (vla-get-color obj) acbyblock) (list 888) ;_byblock ) ((eq (vla-get-color obj) acbylayer) (list 999) ;_Bylayer ) Quote Link to comment Share on other sites More sharing options...
saunambon654 Posted April 22, 2013 Share Posted April 22, 2013 nice! thanks so much! Quote Link to comment Share on other sites More sharing options...
brianmcguire Posted May 6, 2013 Share Posted May 6, 2013 I am sure you hear this all the time. this is awesome. I am new to Codingand lisp but this is perfect. I am trying to figure out how to do this as ascript on multiple drawings. The only thing stopping me in the ACI colordialogue box pop up. Is there a way to tell it to input "8" thenenter so it will run as a script. You may have covered this already. Eitherway, you are a coding genus so thank you very much. Quote Link to comment Share on other sites More sharing options...
VVA Posted May 8, 2013 Share Posted May 8, 2013 brianmcguire see post #84 or use your function (defun mycolorXfunc ( col / doc) ;col — color number (vl-load-com) (setq doc (vla-get-activedocument (vlax-get-acad-object))) (vla-startundomark doc) (mip:layer-status-save) (ChangeAllObjectsColor doc col) ;_ col — color number (mip:layer-status-restore) (vla-endundomark doc) (princ) ) ;_ end of defun Use (mycolorXfunc 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.