Author Topic: Get list of plot style names from .stb file?  (Read 3665 times)

0 Members and 1 Guest are viewing this topic.

jmaeding

  • Bull Frog
  • Posts: 304
  • I'm just here for the Shelties.
Get list of plot style names from .stb file?
« on: August 22, 2008, 07:03:17 PM »
I researched this and did not find an answer.
I am making a .net prog to allow you to assign a layer a plot style.
Of course, I want to offer the styles in the .stb attached to the given space.
Any way to do that without having to use a special tool to decompile the stb ahead of time?

Again, I am not looking for the styles already used in the drawing, but the entire list from an stb file.
thanks
James Maeding

sinc

  • Guest
Re: Get list of plot style names from .stb file?
« Reply #1 on: August 23, 2008, 07:50:22 AM »
Have you looked at the Autodesk.Autocad.Windows.PlotStyleDialog class?

jmaeding

  • Bull Frog
  • Posts: 304
  • I'm just here for the Shelties.
Re: Get list of plot style names from .stb file?
« Reply #2 on: August 25, 2008, 12:31:24 PM »
hey, now that is a great idea.  Use their dialog instead of re-creating it.
I need to do that for colors too since the lisp getcolor dialog is limited to ACI colors.
As Luis would say, Gracias
James Maeding

Spike Wilbury

  • Guest
Re: Get list of plot style names from .stb file?
« Reply #3 on: August 25, 2008, 12:37:25 PM »
As Luis would say, Gracias

I guess, you are talking about this Luis.... me


Saludos Jaime !
(James)

jmaeding

  • Bull Frog
  • Posts: 304
  • I'm just here for the Shelties.
Re: Get list of plot style names from .stb file?
« Reply #4 on: August 25, 2008, 06:40:03 PM »
Saludos Tambien!

Sill me, here I am doing all my lisp dialogs in OpenDcl, and am looking to .net for an answer.
I forgot about the "special" modes you can use for a combobox in ODCL.
One of them is Linetype, one is plot style, one is lineweight.
That covers all three that I needed.
Glad Chad and Owen are doing my job for me  :-)
James Maeding

jmaeding

  • Bull Frog
  • Posts: 304
  • I'm just here for the Shelties.
Re: Get list of plot style names from .stb file?
« Reply #5 on: August 25, 2008, 06:41:00 PM »
darn IE, cutting me off.

That was silly me, not sill me...
James Maeding

jmaeding

  • Bull Frog
  • Posts: 304
  • I'm just here for the Shelties.
Re: Get list of plot style names from .stb file?
« Reply #6 on: August 28, 2008, 04:46:20 PM »
Looks like the ODCL only displays plot styles used, not all of them.
Even if I use the .net dialog, it only returns a name.
All that is fine, the user can select a name and I get my hands on it.

My question now is: Is there a way to "bring in" the plot style chosen, if its never been used in the drawing?

In lisp, I am using (setvar "cplotstyle" <name chosen>), then (setvar "cplotstyle" "Bylayer") to set back.
Seems junky but works.  Isn't there another way to pull in plot styles, assuming the stb table is available?

thanks
James Maeding

sinc

  • Guest
Re: Get list of plot style names from .stb file?
« Reply #7 on: August 28, 2008, 11:43:17 PM »
What I did was use the dialog box mentioned earlier.  As you say, it returns the plots style name.   But I think it also loads the plot style into the current drawing.

However, it seems to be tricky using it.  What I had to do was take the name returned by the dialog box, then get its ObjectId by looking it up in the PlotStyleNameDictionary (retrieved using database.PlotStyleNameDictionaryId).  Then I would use that ObjectId to set the layerTableRecord.PlotStyleNameId.  Note that you should probably also check to see if the active drawing is color-dependent (i.e., if PSTYLEMODE is 1), because attempting to set the plot style in a CTB drawing will throw an exception.

If there's an easier way, I failed to find it.

jmaeding

  • Bull Frog
  • Posts: 304
  • I'm just here for the Shelties.
Re: Get list of plot style names from .stb file?
« Reply #8 on: September 02, 2008, 08:11:16 PM »
hmm, it did not bring in the style for me.  I'll play more.
James Maeding

sinc

  • Guest
Re: Get list of plot style names from .stb file?
« Reply #9 on: September 03, 2008, 02:29:18 PM »
The method I used is in the source code posted here, in the AcadUtilities subproject.  Look for the SelectPlotStyleControl and PlotStyleCommandParameter classes.