PDA

View Full Version : Plotting



spencer.67965
2004-07-09, 04:03 PM
Hi all,

Does anyone have a good example of how to Plot using VBA. Any input is welcome.

Thanks.

Spencer

AutoCAD 2005

RobertB
2004-07-09, 04:39 PM
I bet the help files do.

KevinBarnett
2004-07-12, 11:30 AM
Straight from the help files... aren't they wonderful!

This example first checks to make sure the active space is model space. The example then establishes several plot settings. Finally, the plot is sent using the PlotToDevice method.

Sub Ch9_PrintModelSpace()
' Verify that the active space is model space
If ThisDrawing.ActiveSpace = acPaperSpace Then
ThisDrawing.MSpace = True
ThisDrawing.ActiveSpace = acModelSpace
End If

' Set the extents and scale of the plot area
ThisDrawing.ModelSpace.Layout.PlotType = acExtents
ThisDrawing.ModelSpace.Layout. _
StandardScale = acScaleToFit

' Set the number of copies to one
ThisDrawing.Plot.NumberOfCopies = 1

' Initiate the plot
ThisDrawing.Plot.PlotToDevice
End Sub
The device name can be specified using the ConfigName property. This device can be overridden in the PlotToDevice method by specifying a PC3 file.


Sub Example_PlotToFile()
' This example sends a plot of the current drawing
' to a file.

' Define the output file name.
' Use "" to use the drawing name as the file name.
Dim plotFileName As String
plotFileName = "MyPlot"

Dim result As Boolean

result = ThisDrawing.Plot.PlotToFile(plotFileName)

End Sub

spencer.67965
2004-07-13, 05:46 PM
Thank you,

Spencer