fade2blackened Posted February 6, 2006 Share Posted February 6, 2006 Hi... I have this lisp, made by me, which is pretty simple: (defun C:CS () (command "change" "c" pause pause pause "p" "color" pause "") ) Well, it works "fine" if you know how to work with it... You can only open one cross window (2 mouse "clicks"). This pause behavior is not I wanted first, but that's what worked for me... :wink: Is there a way, so I can select as many objects as I want? So, I select them, then I Enter, then I choose the color's number and then Enter again. Something like that... Thanks for anyone who reads it! Quote Link to comment Share on other sites More sharing options...
rkmcswain Posted February 6, 2006 Share Posted February 6, 2006 Here is the solution to your original question: (defun c:cs ( / ss) (setq ss (ssget)) (command "._change" ss "" "_P" "_C" pause "") (princ) ) Here is a different approach. This defines a function for each color (1-255). So command 1 will change color to red, command 2 will change color to yellow, and so on. (defun chco (color / ss1) (setq ss1 (ssget)) (command "._change" ss1 "" "p" "c" color "" ) ) (setq i 1) (while (<= i 254) (eval (read (strcat "(defun c:" (itoa i) (chr 40)(chr 41) "(chco " (itoa i) "))"))) (setq i (1+ i)) ) Quote Link to comment Share on other sites More sharing options...
fade2blackened Posted February 6, 2006 Author Share Posted February 6, 2006 Hi rkmcswain, Thanks for the solution! The first lisp works perfectly! It was exactly what I was trying to do. But when I tried to use the (setq ss (ssget)), I put it in a different way and it did not worked. :wink: Thank you a lot! Quote Link to comment Share on other sites More sharing options...
CAB Posted February 9, 2006 Share Posted February 9, 2006 Try this: (defun c:cc (/ usercol ss) (while (not (setq usercol (acad_colordlg 256)))) (prompt "Select all object to change to one color.") (if (setq ss (ssget)) (command "_.ChProp" ss "" "_C" usercol "") ) (princ) ) Quote Link to comment Share on other sites More sharing options...
pravibabu Posted January 17, 2009 Share Posted January 17, 2009 :)very very very happy. thank you. So kind of you. This is what I am searching for, finally i got it after a long time. Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted January 17, 2009 Share Posted January 17, 2009 Try this: (defun c:cc (/ usercol ss) (while (not (setq usercol (acad_colordlg 256)))) (prompt "Select all object to change to one color.") (if (setq ss (ssget)) (command "_.ChProp" ss "" "_C" usercol "") ) (princ) ) Fantastic CAB - as per usual.. I had never heard of the acad_colordlg command... a very useful one indeed. Would you say that you know just about all the LISP commands available to use by now? Or do you still come across some that you don't know? Just Curious... Quote Link to comment Share on other sites More sharing options...
CAB Posted January 18, 2009 Share Posted January 18, 2009 I'm sure I have been exposed to all the LISP functions but without use they fade into deep memory which needs refreshing from time to time. I'm sure I have not seen all the visual lisp functions. The list is nearly endless. You may find some intrest in this site http://www.kxcad.net/autodesk/autocad/ but it has some advertising hooks. Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted January 18, 2009 Share Posted January 18, 2009 Nice site CAB - will come in useful, thanks. Quote Link to comment Share on other sites More sharing options...
CAB Posted January 18, 2009 Share Posted January 18, 2009 And you most likely have this already: http://www.midpointcad.com/au/docs/lakose_The_Visual_LISP_Developers_Bible.pdf Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted January 18, 2009 Share Posted January 18, 2009 Yes, Alex Smirnov (ASMI) kindly provided me with that link some time ago 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.