parkerdepriest Posted January 28, 2013 Posted January 28, 2013 Hi everyone, I'm trying to write a code that will 1) set the current plot style to "BCR Plot Style.stb" 2) change all layer properties to plot style "Grayscale" I had this working at one point, but can't get it to work when I reopen, so it may just be a problem with how I'm loading the routine. I've added it to LISP files under CUI and to my APPLOAD startup suite. (defun c:grayscale () (vl-load-com) (vla-put-StyleSheet (vla-get-ActiveLayout (vla-get-ActiveDocument (vlax-get-acad-object)) ) "BCR Plot Style.stb" ) (setq layers (vla-get-layers (vla-get-ActiveDocument (vlax-get-acad-object)) ) ) (vlax-for l layers (progn (vla-put-plotstylename l "Grayscale") ) ) ) Help is greatly appreciated! Quote
parkerdepriest Posted January 28, 2013 Author Posted January 28, 2013 Just found out something interesting - This routine works after I go into the layer properties manager, highlight all layers, change the plot style to "Grayscale" and then back to "Normal". It's like it hasn't recognized "Grayscale" as a valid option until it has been manually set. If there's something I can add to make AutoCAD "recognize" Grayscale as a valid option... Quote
MKearney028 Posted April 8, 2013 Posted April 8, 2013 I know this is a relatively old post, but I was just searching around for a similar issue and found that this has also happened to other people. In case anyone else comes across this post, or if you still need an answer, but just add a line to set a (any) layer to the plot style that you're looking for. The line (command "-layer" "PS" "Grayscale" "" "") will set the current layer plot style to Grayscale. Just add that to the beginning of your code and you should be all set. Hope this helps. Quote
Donald Broussard Posted January 16, 2020 Posted January 16, 2020 We are experiencing this same problem on objects. We must physically change the plotstyle property from ByLayer to something else and back to ByLayer ... 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.