davesec Posted May 23, 2013 Share Posted May 23, 2013 hi, i'd like to create a macro that selects all layers and converts the VP color to black. basically i receive a ton of drawings from different sources (with different layers/layer names), and i'd like to have a quick way of changing a viewport so that everything in it is black and white, but the title block is still full color. is there an easy way to do this? also is this something i could apply to a template so that a particular viewport automatically converts everything in it to black? thanks Quote Link to comment Share on other sites More sharing options...
BIGAL Posted May 24, 2013 Share Posted May 24, 2013 If the dwg's are set to color by layer then easy just use a lisp to go through the layer table and set all to a color then reset your title block layers to colour use a CTB so it works every time, also if needed then do a set all objects to Bylayer first. Quote Link to comment Share on other sites More sharing options...
YZ Posted June 4, 2013 Share Posted June 4, 2013 This macro sets all the layers to colour 7 (substitute whatever colour you require by changing that number): -layer;Color;7;*;; You would then simply consider whether to run this macro on the dwg before you import into your title block file, or add to the macro so that it changes your title block layers back to the colours you are after. Quote Link to comment Share on other sites More sharing options...
YZ Posted June 4, 2013 Share Posted June 4, 2013 Sorry I just noticed you want the VP colours changed only. My solution won't do that for you. I'll look into it further. Quote Link to comment Share on other sites More sharing options...
YZ Posted June 4, 2013 Share Posted June 4, 2013 Okay try this: Tilemode;0;mspace;vplayer;Color;7;*;Current;; Notes: 1. I had to use tilemode to move to a layout tab as this macro would fail in the model tab. 2. I had to also use mspace command to get into the model space through a viewport. It seemed to affect the paperspace also if I selected All from the paperspace rather than Current from the model space. 3. If there were multiple layout tabs and viewports needing this macro in each dwg then you could play around with that final option, pausing to manually select a viewport, or changing all then adding into the end of the macro the commands to then change paperspace back to how you want it... Quote Link to comment Share on other sites More sharing options...
BlackBox Posted June 4, 2013 Share Posted June 4, 2013 FWIW - Simply issuing MSPACE does not determine which PViewport (if multiple) to activate prior to changing all VPLayers to 'black/white'... Since you're specifying "current" in lieu of "all" in your VPLAYER options, I'd think it prudent to first determine if a PViewport is active. Consider this adaptation: (defun c:VpLayBlack () (c:ViewportLayersBlack)) (defun c:ViewportLayersBlack (/ *error*) (princ "\rVIEWPORTLAYERSBLACK ") (defun *error* (msg) (and oldCmdecho (setvar 'cmdecho oldCmdecho)) (cond ((not msg)) ; Normal exit ((member msg '("Function cancelled" "quit / exit abort"))) ; <esc> or (quit) ((princ (strcat "\n** Error: " msg " ** "))) ; Fatal error, display it ) (princ) ) (if (= 1 (getvar 'tilemode)) (prompt "\n** Command not allowed in Model tab ** ") (if (= 1 (getvar 'cvport)) (prompt "\n** Viewport must be active ** ") (progn (setq oldCmdecho (getvar 'cmdecho)) (setvar 'cmdecho 0) (command "._vplayer" "color" 7 "*" "current" "") ) ) ) (*error* nil) ) ... And the associated macro, in kind: ^C^C^PViewportLayersBlack ^P Quote Link to comment Share on other sites More sharing options...
YZ Posted June 5, 2013 Share Posted June 5, 2013 Good pick up Black Box. I had a feeling in back of my mind that this might still fail with added complexities like multiple viewports. If the OP can use LISP then it's problem comprehensively solved. If it's LT and only macros, then perhaps a compromise is to strip back the macro and run it by activitaing each viewport required individually before clicking the macro each time. In that case the macro would be: vplayer;Color;7;*;Current;; Quote Link to comment Share on other sites More sharing options...
BlackBox Posted June 5, 2013 Share Posted June 5, 2013 Good pick up Black Box. That is kind of you to say, YZ ... I had a feeling in back of my mind that this might still fail with added complexities like multiple viewports. If the OP can use LISP then it's problem comprehensively solved. If it's LT and only macros, then perhaps a compromise is to strip back the macro and run it by activitaing each viewport required individually before clicking the macro each time. In that case the macro would be: vplayer;Color;7;*;Current;; Good point, YZ. I only have what the OP lists as their 'using' version to go off of, and that's not always up to date. In any event, if others are relegated to using LT, then obviously the LISP will not suffice... However, to the point of applying to multiple PViewports, it's actually simpler, as one simply replaces the "current" option, with "all." ^C^C^P"._vplayer" "color" 7 "*" "[color="red"]all[/color]" "" ^P 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.