Set PLOT AREA and PAPER SIZE using WINDOW (via VBA or...)

Set PLOT AREA and PAPER SIZE using WINDOW (via VBA or...)

Anonymous
Not applicable
2,944 Views
2 Replies
Message 1 of 3

Set PLOT AREA and PAPER SIZE using WINDOW (via VBA or...)

Anonymous
Not applicable

 

Hi

 

I want to type a command (for example 'windowplot') that asks me to set the plot area using option WINDOW.

 

The drawing will then by plotted via DWG to PDF:

1. on the correct paper size,

2. scale 1/1,

3. centered.

 

- The DWG to PDF.pc3  does have all the custom paper sizes we use, defined.

- I do not want to select the custom paper size, the command has to automatically select the right paper size.

 

So, 'windowplot' -> *select plot area* -> 'Ok' -> PDF pop's up at right paper size -> Save pdf as...

 

Any questions? Let me know!

 

Kind regards

MD

 

 

 

 

0 Likes
2,945 Views
2 Replies
Replies (2)
Message 2 of 3

Ed__Jobe
Mentor
Mentor

What code do you have so far? This question is similar to one just asked today. Have you searched this forum?

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

Message 3 of 3

Anonymous
Not applicable

Hi

 

First of all, thank you for your fast reply. I am a novice concerning VBA.

I've seen the question you're reffering to but i don't see where they define the papersize using the command 'Window'?


I've found some code that may be useful for me, but I don't know how to implement the correct paper size:

 

Sub Example_SetWindowToPlot()
    ' This example allows the user to define an area in the current layout
    ' and displays a plot preview of the defined area.
    '
    ' * Note: You have to exit the
    ' plot preview before the VBA example will stop and control will be returned

    AppActivate ThisDrawing.Application.Caption

    Dim point1 As Variant, point2 As Variant
    
    ' Get first point in window
    point1 = ThisDrawing.Utility.GetPoint(, "Click the lower-left of the window to plot.")
    ReDim Preserve point1(0 To 1)   ' Change this to a 2D array by removing the Z position
    
    ' Get second point in window
    point2 = ThisDrawing.Utility.GetPoint(, "Click the upper-right of the window to plot.")
    ReDim Preserve point2(0 To 1)   ' Change this to a 2D array by removing the Z position
    
    ' Send information about window to current layout
    ThisDrawing.ActiveLayout.SetWindowToPlot point1, point2
    
    ' Read back window information
    ThisDrawing.ActiveLayout.GetWindowToPlot point1, point2
    
    MsgBox "Press any key to plot the following window:" & vbCrLf & vbCrLf & _
           "Lower Left: " & point1(0) & ", " & point1(1) & vbCrLf & _
           "Upper Right: " & point2(0) & ", " & point2(1)
    
    ' Be sure to plot a view, not some other plot style
    ThisDrawing.ActiveLayout.PlotType = acWindow
    
    ' Send Plot To Window
    ThisDrawing.ActiveLayout.ConfigName = "DWG to PDF.pc3"
    ThisDrawing.Plot.DisplayPlotPreview acFullPreview
End Sub

 

0 Likes