CAD开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

ObjectARX 开发指南

相关分类

纸张大小和单位 (.NET)

2023-1-1 09:53| 发布者: admin| 查看: 328| 评论: 0|来自: AutoCAD

布局的图纸尺寸选择取决于为输出配置的绘图仪或设备。每个绘图仪或设备都有一个可用的输出大小的标准列表,可以使用对象的方法获得。对象的方法可用于返回“打印”或“页面设置”对话框中显示的输出大小。分配给布局的纸张大小可以使用属性进行查询。GetCanonicalMediaNameListPlotSettingsValidatorGetLocaleMediaNamePlotSettingsValidatorCanonicalMediaName

您还可以使用属性查询布局的单位。此属性返回由 enum:,or 定义的三个值之一。如果将绘图仪配置为栅格输出,则输出大小将以像素为单位返回。PlotPaperUnitsPlotPaperUnitInchesMillimetersPixels

列出输出设备的可用纸张大小

本示例列出DWF6 ePlot.pc3输出设备的纸张大小。

VB.NET

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

C#

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;
        }
    }
}

路过

雷人

握手

鲜花

鸡蛋

最新评论

QQ|Archiver|CAD开发者社区 ( 苏ICP备2022047690号-1 )

GMT+8, 2024-5-19 14:35

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

返回顶部