Can you plot different layers in one Layout?

Can you plot different layers in one Layout?

Anonymous
Not applicable
431 Views
6 Replies
Message 1 of 7

Can you plot different layers in one Layout?

Anonymous
Not applicable
I have 2 paperspace viewports in one layout and I want to make different layers appear in each viewport. My real goal is to plot the result. Is this possible? I've tried many things, below is a sample. To be honest, I'm having trouble plotting from paperspace to begin with (modelsspace has alway worked fine for me though), and the desire to see different layers in different paperspace viewports is compounding the problem.

Thanks for any tips,
Tony

Private Sub plotButton_Click()
Dim PaperSize As String, Orientation As String
Dim viewPort() As AcadPViewport, j As Integer
Dim i As Integer, label As String
If landscapeOption Then Orientation = "landscape" Else Orientation = "portrait"
If letterOption Then PaperSize = "letter" Else If legalOption Then PaperSize = "legal" Else PaperSize = "ledger"
'the following sub successfully creates the needed viewports
CreateLayout viewPort(), PaperSize, Orientation, vPortsPerPage
i = 1
Do
For j = 1 To vPortsPerPage
viewPort(j).Display True
'ThisDwg.MSpace = True
viewPort(j).Layer = LayerNamesArray(i)
i = i + 1
Next j
ThisDwg.Regen True
ThisDwg.ActiveLayout.PlotType = acLayout
ThisDwg.Plot.PlotToDevice

Loop Until i >= UBound(LayerNamesArray)

End Sub
0 Likes
432 Views
6 Replies
Replies (6)
Message 2 of 7

Anonymous
Not applicable
Yes you can, but it is tricky, do a search for VpLayerOff and you will find out about xdata and the viewport.
The layer the viewport is on has nothing to do with it.
0 Likes
Message 3 of 7

Anonymous
Not applicable
Thank you for your reply. Yes, I've done a search and found the way to do what I want here:
http://www.contractcaddgroup.com/articles/vport.htm
-Tony
0 Likes
Message 4 of 7

Anonymous
Not applicable
Upon further testing I've found that while the VpLayerOff does work, it somehow makes the layout unplottable from VBA. I've been able to print the layout from the AutoCAD user interface, but when I try typical layout plotting routines, I get nothing plotted for those layouts. Other layouts, not touched by the VpLayerOff routine, plot fine via VBA. Any insights?

Thanks,
Tony
0 Likes
Message 5 of 7

Anonymous
Not applicable
I see 'ThisDwg.MSpace = True
Do you print with this set or from paperspace?
0 Likes
Message 6 of 7

Anonymous
Not applicable
I just want to plot the layouts, and must confess that I'm not completely clear about the implication of setting the .MSpace property.
When I run the code AutoCAD displays the following messages

Regenerating model.
The selected layout has an invalid media configuration.

In the code I set
layoutObj.CanonicalMediaName to a string such as "legal" and when I query this property it is set to that.

I assume that settting .MSpace is the equivalent of double clicking one of the viewports, but since doing that via the AutoCAD user interface does not affect how layouts are printed, I'm not sure why it would have an effect via VBA?

Thanks again for your help
-Tony
0 Likes
Message 7 of 7

Anonymous
Not applicable
After further testing, it seems to me that there is a conflict between the paper size I'm setting when I make the layout and the paper size in the plotter configuration file. If these two do not match, then I don't get a plot, but if they do I get the plot.
0 Likes