What's the trick to plotting Window?

What's the trick to plotting Window?

Anonymous
Not applicable
515 Views
10 Replies
Message 1 of 11

What's the trick to plotting Window?

Anonymous
Not applicable
I've tried all sorts of variations in settings and can't get anything to
plot when specifying a window.

Sub dummyplot()
Dim all(1) As Double, aur(1) As Double, vLay(0) As String
ThisDrawing.Regen acAllViewports
all(0) = 1227277.3545: all(1) = 502975.9081
aur(0) = 1234688.0587: aur(1) = 518242.9138
With ThisDrawing.ActiveLayout
.RefreshPlotDeviceInfo
.PlotType = acWindow
.SetWindowToPlot all, aur
.SetCustomScale 1, 15
End With
ThisDrawing.Plot.DisplayPlotPreview acFullPreview
End Sub


If I do this 'manually', via the plot dialog, it works as expected.
Using this piece of code, I get a blank page.

Any thoughts?
(I searched back through google, but didn't find anything that helped.)
0 Likes
516 Views
10 Replies
Replies (10)
Message 2 of 11

Anonymous
Not applicable
Tom,

Add this line after the .RefreshPlotDeviceInfo line

.SetWindowToPlot all, aur

Joe
--
0 Likes
Message 3 of 11

RonnieWilkins
Advocate
Advocate
Make sure you are not in a User Coordinate System instead of the World Coordinate System...Have had a few calls on this one.
Ronnie Wilkins, Jr.
0 Likes
Message 4 of 11

Anonymous
Not applicable
joesu wrote:
> Tom,
>
> Add this line after the .RefreshPlotDeviceInfo line
>
> .SetWindowToPlot all, aur

No luck with this:

With ThisDrawing.ActiveLayout
.RefreshPlotDeviceInfo
.SetWindowToPlot all, aur
.PlotType = acWindow
'.SetWindowToPlot all, aur
.SetCustomScale 1, 15
End With

Thanks........any other ideas? (No UCS's in the drawing.)
0 Likes
Message 5 of 11

Anonymous
Not applicable
rwilkins wrote:
> Make sure you are not in a User Coordinate System instead of the World
> Coordinate System...Have had a few calls on this one.

No UCS's present. Thanx.
0 Likes
Message 6 of 11

Anonymous
Not applicable
Tom,

I changed your code example [add the line I mentioned above] and all is well. Are you perhaps asking about how to get it out to a plot device?

Joe
--
0 Likes
Message 7 of 11

Anonymous
Not applicable
joesu wrote:
> Tom,
>
> I changed your code example [add the line I mentioned above] and all is
> well. Are you perhaps asking about how to get it out to a plot device?

It didn't have any effect for me.

I ended up getting around it by using SendCommand to pass "-Plot" and
all of the required vcCrLf's and coordinates. Not very elegant, but
functional.

In case there's something else in the code that's causing the trouble,
here is the entire Sub, modified to use SendCommand via the CommPlot Sub:
(I'm not expecting you to debug this or anything, Joe, just posting for
anyone that may be curious......comments certainly welcome.)

Sub PlotAllSix()
Dim sNamSuf As String, saList(5) As String

sNamSuf = ThisDrawing.Utility.GetString(1, vbLf & "Map Layer Name: ")
saList(0) = "NW": saList(1) = "NC": saList(2) = "NE"
saList(3) = "SW": saList(4) = "SC": saList(5) = "SE"

Dim vXs(11) As Variant, vYs(11) As Variant, iTmp As Integer
vXs(0) = 1227277.3545: vYs(0) = 502975.9081
vXs(1) = 1234688.0587: vYs(1) = 518242.9138
vXs(2) = 1238285.4929: vYs(2) = 506789.4878
vXs(3) = 1245696.1971: vYs(3) = 522056.4935
vXs(4) = 1249293.6312: vYs(4) = 510603.0675
vXs(5) = 1256704.3354: vYs(5) = 525870.0732
vXs(6) = 1231074.2396: vYs(6) = 492015.9599
vXs(7) = 1238484.9438: vYs(7) = 507282.9656
vXs(8) = 1242082.3779: vYs(8) = 495829.5396
vXs(9) = 1249493.0821: vYs(9) = 511096.5453
vXs(10) = 1253090.5163: vYs(10) = 499643.1193
vXs(11) = 1260501.2205: vYs(11) = 514910.125

Dim all(1) As Double, aur(1) As Double, sFileName As String
If sNamSuf <> "" Then
ThisDrawing.ActiveLayout = ThisDrawing.Layouts("Model")
For iTmp = 0 To 5
With ThisDrawing.ActiveLayout
all(0) = vXs(iTmp * 2): all(1) = vYs(iTmp * 2)
aur(0) = vXs(iTmp * 2 + 1): aur(1) = vYs(iTmp * 2 + 1)
sFileName = "d:/temp/" & saList(iTmp) & "-" & sNamSuf & ".tif"
CommPlot all, aur, sFileName
End With
Next
End If
ThisDrawing.Utility.Prompt vbCrLf & "Plotting completed"
End Sub

Well, if you've read this far, you may want to see my test Sub which
resulted in a blank file, modified per Joe's suggestion:

Sub dummyplot()
Dim all(1) As Double, aur(1) As Double, vLay(0) As String
ThisDrawing.Regen acAllViewports
all(0) = 1227277.3545: all(1) = 502975.9081
aur(0) = 1234688.0587: aur(1) = 518242.9138
With ThisDrawing.ActiveLayout
.RefreshPlotDeviceInfo
.SetWindowToPlot all, aur
.PlotType = acWindow
'.SetWindowToPlot all, aur
.SetCustomScale 1, 15
End With
ThisDrawing.Plot.DisplayPlotPreview acFullPreview
End Sub
0 Likes
Message 8 of 11

Anonymous
Not applicable
joesu wrote:
> Tom,
>
> I changed your code example [add the line I mentioned above] and all is
> well. Are you perhaps asking about how to get it out to a plot device?

I also should have mentioned version.......2000i.

Are you testing with 2002, by chance?
0 Likes
Message 9 of 11

Anonymous
Not applicable
Tom,

This is gonna hurt a little. The "trick" to plotting a window can be found on page 308 of my book.

Joe
--

Public Sub PlotWindow()
Dim varLowerLeftCorner As Variant
Dim varUpperRightCorner As Variant
Dim dblLowerLeftCorner(1) As Double
Dim dblUpperRightCorner(1) As Double
Dim intCount As Integer
Dim strFilename As String

'set the plot type
varLowerLeftCorner = ThisDrawing.Utility.GetPoint(, "Select lower-left corner of window: ")
varUpperRightCorner = ThisDrawing.Utility.GetCorner(varLowerLeftCorner, "Select upper-right corner of window: ")

For intCount = 0 To 1
dblLowerLeftCorner(intCount) = CDbl(varLowerLeftCorner(intCount))
dblUpperRightCorner(intCount) = CDbl(varUpperRightCorner(intCount))
Next intCount

ThisDrawing.ActiveLayout.SetWindowToPlot dblLowerLeftCorner, dblUpperRightCorner

ThisDrawing.ActiveLayout.PlotType = acWindow

'initiate the plot
ThisDrawing.Plot.PlotToDevice
End Sub
0 Likes
Message 10 of 11

Anonymous
Not applicable
Is there a trick to doing this using Acad 2000 VBA? I keep getting a very odd offset in the plot window preview.
0 Likes
Message 11 of 11

Anonymous
Not applicable
I believe offset is always metric.

 

   Dim pt1(1) As Double, pt2(1) As
Double
   Dim cadLayout As AcadLayout
   Set
cadLayout = cadDoc.ActiveLayout
   With
cadLayout
      .RefreshPlotDeviceInfo
      .ConfigName
= "Xerox DocuTech 6135 PS3 C5" 'not a pc3
file
      .CanonicalMediaName =
"Ledger"
      .PlotWithPlotStyles =
True
      .StyleSheet =
"custom.ctb"
      .PlotRotation =
ac0degrees
      .CenterPlot =
False
      'plot origin in
millimeters
      pt1(0) = 36.5761: pt1(1) =
3.175
      .PlotOrigin =
pt1
      .StandardScale =
ac1_1
      'window size in drawing units and
sized to clip off revision notes
      pt1(0) =
0#: pt1(1) = 0#: pt2(0) = 15.06: pt2(1) =
10.5
      .SetWindowToPlot pt1,
pt2
      .PlotType =
acWindow
      .RefreshPlotDeviceInfo
   End
With
   cadDoc.Plot.PlotToFile strPath & strName &
".ps"

 



style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">Is
there a trick to doing this using Acad 2000 VBA? I keep getting a very odd
offset in the plot window preview.
0 Likes