選択できるレイアウトの用紙サイズは、出力に設定されているプロッタまたはデバイスによって異なります。各プロッタまたはデバイスには、使用可能な出力サイズの標準リストがあり、PlotSettingsValidator オブジェクトの GetCanonicalMediaNameList メソッドを使用して取得することができます。PlotSettingsValidator オブジェクトの GetLocaleMediaName メソッドを使用して、[印刷]または[ページ設定]ダイアログ ボックスに表示される出力サイズを返すことができます。レイアウトに割り当てられている用紙サイズは、CanonicalMediaName プロパティでクエリーすることができます。
また、PlotPaperUnits プロパティを使用してレイアウトの単位のクエリーを行うこともできます。このプロパティは、PlotPaperUnit 列挙型で定義されている 3 つの値(Inches、Millimeters、Pixels)のいずれかを返します。プロッタがラスター出力用に設定されている場合は、出力サイズはピクセル単位で返されます。
この例では、DWF6 ePlot.pc3 出力デバイスの用紙サイズが一覧表示されます。
Imports Autodesk.AutoCAD.Runtime
Imports Autodesk.AutoCAD.ApplicationServices
Imports Autodesk.AutoCAD.DatabaseServices
Imports Autodesk.AutoCAD.PlottingServices
' Lists the available local media names for a specified plot configuration (PC3) file
<CommandMethod("PlotterLocalMediaNameList")> _
Public Shared Sub PlotterLocalMediaNameList()
' Get the current document and database, and start a transaction
Dim acDoc As Document = Application.DocumentManager.MdiActiveDocument
Using plSet As PlotSettings = New PlotSettings(True)
Dim acPlSetVdr As PlotSettingsValidator = PlotSettingsValidator.Current
' Set the Plotter and page size
acPlSetVdr.SetPlotConfigurationName(plSet, "DWF6 ePlot.pc3", _
"ANSI_A_(8.50_x_11.00_Inches)")
acDoc.Editor.WriteMessage(vbLf & "Canonical and Local media names: ")
Dim cnt As Integer = 0
For Each mediaName As String In acPlSetVdr.GetCanonicalMediaNameList(plSet)
' Output the names of the available media for the specified device
acDoc.Editor.WriteMessage(vbLf & " " & mediaName & " | " & _
acPlSetVdr.GetLocaleMediaName(plSet, cnt))
cnt = cnt + 1
Next
End Using
End Sub
using Autodesk.AutoCAD.Runtime;
using Autodesk.AutoCAD.ApplicationServices;
using Autodesk.AutoCAD.DatabaseServices;
using Autodesk.AutoCAD.PlottingServices;
// Lists the available local media names for a specified plot configuration (PC3) file
[CommandMethod("PlotterLocalMediaNameList")]
public static void PlotterLocalMediaNameList()
{
// Get the current document and database, and start a transaction
Document acDoc = Application.DocumentManager.MdiActiveDocument;
using(PlotSettings plSet = new PlotSettings(true))
{
PlotSettingsValidator acPlSetVdr = PlotSettingsValidator.Current;
// Set the Plotter and page size
acPlSetVdr.SetPlotConfigurationName(plSet, "DWF6 ePlot.pc3",
"ANSI_A_(8.50_x_11.00_Inches)");
acDoc.Editor.WriteMessage("\nCanonical and Local media names: ");
int cnt = 0;
foreach (string mediaName in acPlSetVdr.GetCanonicalMediaNameList(plSet))
{
// Output the names of the available media for the specified device
acDoc.Editor.WriteMessage("\n " + mediaName + " | " +
acPlSetVdr.GetLocaleMediaName(plSet, cnt));
cnt = cnt + 1;
}
}
}