how to switch between plot style modes?

how to switch between plot style modes?

a.kouchakzadeh
Advocate Advocate
5,296 Views
11 Replies
Message 1 of 12

how to switch between plot style modes?

a.kouchakzadeh
Advocate
Advocate

Hello world.

Im wondering how is it possible to set plot style mode to ".ctb" , or ".stb"

also, if I want to use either case, I need to have them in the AppData\Roaming\Autodesk\AutoCAD 2020\R23.1\enu\Plotters\Plot Styles directroy?
is there any way I can set a location for my ".stb" file to read the setting from there?

 

Application.SetSystemVariable("PSTYLEMODE"1);

 I tried this, but the code throws an error.

I saw this so I was thinking maybe I could set the plotstyle systemvariable like that

System.Object test = Application.GetSystemVariable("PSTYLEMODE");                 
    if (test.ToString().Equals("0"))
{
....
}

 

0 Likes
Accepted solutions (1)
5,297 Views
11 Replies
Replies (11)
Message 2 of 12

Ed__Jobe
Mentor
Mentor

There isn't a simple variable you can change. You have to change the structure of the file database to use the other plotstyle. As far as I know, the only way to do it is with the CONVERTCTB or CONVERTPSLYLES commands.

 

The PSTYLEMODE  sysvar is read-only.

Ed


Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.
How to post your code.

EESignature

0 Likes
Message 3 of 12

a.kouchakzadeh
Advocate
Advocate

Ed, when using Convertpstyles, Autocad prompts me to convert a .STB to .CTB
I dont want to convert anything.
I only want to use .STB to plot my work. right now I have to copy the content of any document into a specific template, and when I want to plot from that template I can see my .STB file.
why do I have to copy the content to that specific template? cant I just set the plotter to use .STB file instead of .CTB?
I have seen many codes in different forums that check what is the style used to plot. but how should I set it?

what do I have to change in my database structure in order to be able to set the plotting style to use a "style table" instead of "color table"?

0 Likes
Message 5 of 12

Ed__Jobe
Mentor
Mentor

@a.kouchakzadeh wrote:

Ed, when using Convertpstyles, Autocad prompts me to convert a .STB to .CTB
I dont want to convert anything.
I only want to use .STB to plot my work. right now I have to copy the content of any document into a specific template, and when I want to plot from that template I can see my .STB file.
why do I have to copy the content to that specific template? cant I just set the plotter to use .STB file instead of .CTB?
I have seen many codes in different forums that check what is the style used to plot. but how should I set it?

what do I have to change in my database structure in order to be able to set the plotting style to use a "style table" instead of "color table"?


Unfortunately, that's the way it's designed. When you copy your entities to an stb file, you are in effect converting it. To change the database structure of a ctb file, you have to use CONVERTCTB or CONVERTPSTYLES commands.

Ed


Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.
How to post your code.

EESignature

0 Likes
Message 6 of 12

Ed__Jobe
Mentor
Mentor

@fieldguy wrote:

I think you are looking for PlotStyleSheet. Check these links if you haven't already.


Hi @fieldguy plot settings are the api name for Named Page Setups in the acad Page Setup dialog. You can't arbitrarily assign an stb to a layout if the dwg is set to ctb, or vice versa. Note that in one of the samples, it first does a test, like below.

 

//find out if drawing is using ctb
System.Object test = Application.GetSystemVariable("PSTYLEMODE");

 

The PSTYLEMODE  sysvar is read-only and is changed when you use one of the commands I referred to in the previous post.

 

I haven't tested it, but I'm pretty sure it would throw an error if you tried to assign a stb to a ctb layout.

Ed


Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.
How to post your code.

EESignature

0 Likes
Message 7 of 12

a.kouchakzadeh
Advocate
Advocate

ok so as far as I have learned so far, If I used a DWG file which seeks ".CTB" files for the plotting (which Im still stock in how to set a dwg drawing to use ".CTB" or ".STB") then Im doomed to stick to the available .CTB files?

my process step by step:

 

Im willing to print my job. obviously the drawing is set to use ".ctb" files.

akouchakzadeh_4-1681228088130.png

 

now I use  "CONVERTPSTYLE" :

akouchakzadeh_0-1681227057032.png

this command converts a "Color dependent plot style" drawing to use  "Named plot styles".

but why cant I just simply pick the ".stb" file that I already have and I want to use?

but anyways, I press "OK"

it takes me to this:

 

akouchakzadeh_2-1681227661725.png


its showing me ".stb" files? didnt the previous message say "you should convert your color dependent plot styles...."

so why it is showing me  ".stb" files? if I have to convert ".ctb" then its suppose to show me the ".ctb" files not the ".stb" ones.

 

but anyways, I pick it and then I get this:

 

akouchakzadeh_3-1681227877189.png


can you please tell me what am I missing? it shouldn't be this complicated. 
isnt a drawing plot style suppose to be like a radio button. I know in reality its not like that but isnt it like: either ".ctb" or ".stb"

 

where can I simply tell AutoCAD "I want to use my own ".stb" without converting any thing to anything else. just let me pick my own ".stb"?

 

0 Likes
Message 8 of 12

a.kouchakzadeh
Advocate
Advocate

thanks for the reply @fieldguy 
I already saw those links before starting this thread

0 Likes
Message 9 of 12

Ed__Jobe
Mentor
Mentor

@a.kouchakzadeh wrote:

can you please tell me what am I missing? it shouldn't be this complicated. 
isnt a drawing plot style suppose to be like a radio button. I know in reality its not like that but isnt it like: either ".ctb" or ".stb"


I hear what you are saying, but you have to do it the way Autodesk set it up. It's helpful if you study the structure of an stb and a ctb and see what differences there are. A ctb takes a color and maps that to plotter info, such as plot color and line weight. An stb simply assigns a Style Name to each group of settings. The CONVERTCTB command takes a ctb file as input and creates named styles for each of the colors. If you use such an stp that has been mapped this way, then this tells the CONVERTPSTYLES command how to map each of the colors in your drawing and assign a named plot style for each color that you used.

 

@a.kouchakzadeh wrote:

where can I simply tell AutoCAD "I want to use my own ".stb" without converting any thing to anything else. just let me pick my own ".stb"?


You can't.

Ed


Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.
How to post your code.

EESignature

0 Likes
Message 10 of 12

a.kouchakzadeh
Advocate
Advocate

Ed, I Just found out that entity class has PlotStyleName property.

will this help me get my job done?
but I assume this doesnt have to do any thing with the plotting process right?

 

in your reply, you mentioned "An stb simply assigns a Style Name to each group of settings." what kind of group of settings ?

 

thanks for the help sir.

0 Likes
Message 11 of 12

Ed__Jobe
Mentor
Mentor
Accepted solution

That works sort of like how you can assign colors ByLayer or by object. Typically, that property would be set to ByLayer and you assign the plot style to the layer. Note that its a property of the Entity. So no, it doesn't allow you to change the plot style of the dwg. In the image below, the red box shows the group of properties that are managed by a style. The style can either be controlled by the entity's color or assigned by name. A color controlled dwg has a minimum of 256 colors. The ctb will have at least 256 styles. The named stb can have as few as 2 styles, Normal and one other.

acad plot style tables.png

When you use the CONVERTCTB command to create a new stb from a ctb, it does the following. This allows the CONVERTPLOTSYLES command to map a color styles settings to a named style with the same settings.

From Help:


https://help.autodesk.com/view/ACD/2023/ENU/?guid=GUID-4386F6C6-CE6D-4C62-8EC3-E68B8738E537 wrote:
CONVERTCTB creates one named plot style for each color that has unique plot properties, one named plot style for each group of colors that are assigned the same plot properties, and a default named plot style called NORMAL.

 

Ed


Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.
How to post your code.

EESignature

0 Likes
Message 12 of 12

a.kouchakzadeh
Advocate
Advocate

thank you for the explanation sir!

0 Likes