caxtin Posted May 9, 2013 Share Posted May 9, 2013 Surprisingly, I cannot find a LISP to automatically changeall colors in a selected viewport to one color. It’s either I see question where they are directed tosomething not related to the question, or two codes that were never finalizedby the helper. My goal is to select a viewport (or viewports) and have allthe colors inside the viewport(s) change to color 254 – all entities includingblocks and xrefs. Traditionally I haveto go inside the viewport and change the colors in the Viewport Color column inthe Layer Manager. So, I would like toachieve this with a LISP code for viewport(s) in Papar Space. Thanks in advance! Quote Link to comment Share on other sites More sharing options...
Tharwat Posted May 9, 2013 Share Posted May 9, 2013 In the title of the thread you wanted the color to be equal to 253 and in the thread you wanted to 254 , so you can change the number of the color to the one you want . Just double click to activate the VIEWPORT that you want to change the colors to , and the code should get you out of it when its done . NOTE : the function vla-put-activeviewport did not work in Cad 2013 and either 2014 . (defun c:Test (/ *error*) (defun *error* (x)(vla-endUndomark doc) (setvar 'cmdecho 1) (princ "\n*Cancel*")) (or doc (setq doc (vla-get-activedocument (vlax-get-acad-object)))) (setvar 'cmdecho 0) (vla-StartUndomark doc) (command "_.vplayer" "_color" 254 "*" "_current" "") (vla-put-mspace doc :vlax-false) (setvar 'cmdecho 1) (vla-endUndomark doc) (princ) ) (vl-load-com) Quote Link to comment Share on other sites More sharing options...
caxtin Posted May 9, 2013 Author Share Posted May 9, 2013 Sorry about the confusion about the color mixup, but that was no big deal. As you mentioned, I just changed to the color I need. I thought I just have to click on the viewport, if I have to just double-click into the viewport to get what I need, just great. That's fine too and much better and much esasier than what I have been doing. I currently use 2014, loaded the code, and it worked like a charm. I sure really appreciate your help/time in writing the code. Thank you soooooo much! I did a test and it worked like a charm. Thanks again! Quote Link to comment Share on other sites More sharing options...
Tharwat Posted May 9, 2013 Share Posted May 9, 2013 Sorry about the confusion about the color mixup, but that was no big deal. As you mentioned, I just changed to the color I need. I thought I just have to click on the viewport, if I have to just double-click into the viewport to get what I need, just great. That's fine too and much better and much esasier than what I have been doing. I currently use 2014, loaded the code, and it worked like a charm. I sure really appreciate your help/time in writing the code. Thank you soooooo much! I did a test and it worked like a charm. Thanks again! Excellent , You're welcome . Quote Link to comment Share on other sites More sharing options...
alanjt Posted May 9, 2013 Share Posted May 9, 2013 Tharwat, never assume system variables. Always store and reset. While you may leave CMDECHO at 1 by default, someone else may set it to 0 in their startup. Quote Link to comment Share on other sites More sharing options...
Tharwat Posted May 9, 2013 Share Posted May 9, 2013 Tharwat, never assume system variables. Always store and reset.While you may leave CMDECHO at 1 by default, someone else may set it to 0 in their startup. Agreed , Thank you . Quote Link to comment Share on other sites More sharing options...
nod684 Posted June 17, 2014 Share Posted June 17, 2014 (edited) sorry to bump in to this thread.. if i want the color dialog to pop up and select a color is it possible? Edited June 18, 2014 by nod684 Quote Link to comment Share on other sites More sharing options...
Tharwat Posted June 17, 2014 Share Posted June 17, 2014 sorry to bump in to this thread..if i want the color to dialog to pop up and select a color is it possible? Yes it is . Have a play with this . (setq color (acad_colordlg 256)) Quote Link to comment Share on other sites More sharing options...
nod684 Posted June 18, 2014 Share Posted June 18, 2014 Yes it is . Have a play with this . (setq color (acad_colordlg 256)) thanks tharwat. it worked. Quote Link to comment Share on other sites More sharing options...
Tharwat Posted June 18, 2014 Share Posted June 18, 2014 thanks tharwat. it worked. You're welcome anytime . Quote Link to comment Share on other sites More sharing options...
CAD_Noob Posted January 25, 2018 Share Posted January 25, 2018 Sorry to bump this one, is it possible to filter the xref that will not be change? Example : i don't want the xref containing arch, elec to be changed. The rest will be overridden with color 8 Quote Link to comment Share on other sites More sharing options...
BIGAL Posted January 25, 2018 Share Posted January 25, 2018 You need to make a list of what you dont want changed as it would be easier to do a global change then change a few back. (vla-StartUndomark doc) -> a defun ask layer and save current colour (command "_.vplayer" "_color" 254 "*" "_current" "") -> change the layer parameters back for the few Cad_noob How do you propose entering the layers to undo ? A dcl list, type name etc. Hence in my code answer -> a defun 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.