Plot stuff

Plot stuff

Anonymous
Not applicable
380 Views
7 Replies
Message 1 of 8

Plot stuff

Anonymous
Not applicable
This is driving me crazy, On old drawings I open them, run convertpstyles to
change them to Named plot styles, and then try to run the following but it says
Key Not found

If I open the layer dialog, and open the plot style dialog for a layer I have
Style_1 (missing)..... a few others and then Style 1. If I set one layer to
Style 1 and then rerun the script it works fine. What do I need to do to have
it run without manually setting one layers plot style?

Public Sub setLayers()
Dim objLay As AcadLayer
Dim MSspace As Object
Dim ssheet As String

If ThisDrawing.ActiveSpace = acModelSpace Then
Set MSspace = ThisDrawing.ModelSpace
Else
Set MSspace = ThisDrawing.PaperSpace
End If
MSspace.Layout.PlotWithPlotStyles = True
MSspace.Layout.RefreshPlotDeviceInfo
ssheet = "Strobe.stb"
MSspace.Layout.StyleSheet = ssheet
For Each objLay In ThisDrawing.Layers
If objLay.Name = "AM_VIS" Then
objLay.Lineweight = acLnWt025
ElseIf objLay.Name = "AM_HID" Then
objLay.Lineweight = acLnWt000
Else
objLay.Lineweight = acLnWt009
End If

If objLay.Name = "AM_HID" Then
objLay.Linetype = "HIDDEN"
End If
objLay.PlotStyleName = "Style 1"
Next
End Sub

--
Kent Keller
Strobe Data Inc.
www.strobedata.com
It's true. French kissing can reduce plaque above the gum-line.
0 Likes
381 Views
7 Replies
Replies (7)
Message 2 of 8

Anonymous
Not applicable
Hi Kent,

I've had the missing style message before and had to include something like
the following to cure the problem. I think the default plot style was set to
"None" on the older drawings.

ThisDrawing.Application.Preferences.Output.DefaultPlotStyleTable =
"MyStyle.stb"

Hope it works.

Gary
0 Likes
Message 3 of 8

Anonymous
Not applicable
Gary

Thanks a million, that did it.

BTW really nice job on the Assembly Tree program.

--
Kent Keller
Strobe Data Inc.
www.strobedata.com
Hard work brings more of it smart work brings less of it.

"Gary McMaster" wrote in message
news:[email protected]...
> Hi Kent,
>
> I've had the missing style message before and had to include something like
> the following to cure the problem. I think the default plot style was set to
> "None" on the older drawings.
>
> ThisDrawing.Application.Preferences.Output.DefaultPlotStyleTable =
> "MyStyle.stb"
>
> Hope it works.
>
> Gary
>
0 Likes
Message 4 of 8

Anonymous
Not applicable
Thanks Kent. Lets hope its error free. Even if it is there is certainly
plently of room for improvement.

Gary
0 Likes
Message 5 of 8

Anonymous
Not applicable
"Kent Keller" wrote in message
news:[email protected]...
> Gary
>
> Thanks a million, that did it.
>

Looks like I spoke to soon, still the same problem.... the first couple of
drawing I tried might have had one layer changed already.

On the same note, is it possible to convert plot styles from color to named in
VBA without running convertpstyles?

--
Kent Keller
Strobe Data Inc.
www.strobedata.com
Hard work brings more of it smart work brings less of it.
0 Likes
Message 6 of 8

Anonymous
Not applicable
Kent,

The Key Not Found doesn't mean anything to me. How about
.RefreshPlotDeviceInfo right after you changed the plotstyle name. I see a
refresh in your code, but I remember this plot stuff being really stubborn.

I have no clue as how to implement that plotstyle converter. I hope someone
else does.

Gary
0 Likes
Message 7 of 8

Anonymous
Not applicable
No go on that either. The really odd thing is if I open the layer dialog, set
one of the layers to Style 1, then change it right back to what it was, then the
program runs fine.

I tried going at it this way but no difference
Me.Layers.Item(1).PlotStyleName = "Style 1"

I suppose it is not a big deal to open the dialog and set one, but it is
annoying that I have to, and at that point I could almost as easily just select
all and change them. Then the only thing the program would be good for is the
lineweights, and linestyles.

--
Kent Keller
Strobe Data Inc.
www.strobedata.com
Hard work brings more of it smart work brings less of it.

"Gary McMaster" wrote in message
news:[email protected]...
> Kent,
>
>How about
> .RefreshPlotDeviceInfo right after you changed the plotstyle name. I see a
> refresh in your code, but I remember this plot stuff being really stubborn.
0 Likes
Message 8 of 8

Anonymous
Not applicable
I got it to work by using this, but it sure seems like there has to be a better
way

ThisDrawing.SendCommand "-layer" & vbCr & "PS" & vbCr & "Style 1" & vbCr & vbCr
& vbCr

--
Kent Keller
Strobe Data Inc.
www.strobedata.com
Hard work brings more of it smart work brings less of it.

"Kent Keller" wrote in message
news:[email protected]...
> No go on that either. The really odd thing is if I open the layer dialog, set
> one of the layers to Style 1, then change it right back to what it was, then
the
> program runs fine.
0 Likes