Jump to content

Change All Layers' Plot Style Setting


parkerdepriest

Recommended Posts

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!

Link to comment
Share on other sites

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...

Link to comment
Share on other sites

  • 2 months later...

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.

Link to comment
Share on other sites

  • 6 years later...

We are experiencing this same problem on objects. We must physically change the plotstyle property from ByLayer to something else and back to ByLayer ...

Link to comment
Share on other sites

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...