国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 學院 > 開發設計 > 正文

在VBA中調用AUTOCAD打印文件

2019-11-17 05:25:31
字體:
來源:轉載
供稿:網友
花了一下午完成了一個初步的示范的例子,看來解決圖紙統一治理有了解決的辦法了.下一步用jacob封裝在java中調用,在服務器上控制打印治理.做個記號再慢慢完善.'取得當前文檔對象(vba中的方法,假如是在VB中時需要從頂層對象開始引用取得)
Dim currentDoc As AcadDocument
Set currentDoc = ThisDrawing'文檔的模型空間
Dim sp As AcadModelSpace
Set sp = currentDoc.modelspace'取得模型空間中的塊屬性
Dim index As Integer
For index = 0 To sp.Count - 1
    Dim name As String
    name = sp.Item(index).ObjectName
   
    '判定模型空間中的項目是否是一個塊引用
    If name Like "*Ac*" Then
       
        Dim blockRef As AcadBlockReference
        Set blockRef = sp.Item(index)
       
        '塊引用的插入點
        Dim insertPoint As Variant
        insertPoint = blockRef.InsertionPoint
       
        '放大比例
        Dim xScale, yScale As Integer
        xScale = blockRef.XScaleFactor
        yScale = blockRef.YScaleFactor
       
       
        '寬高基數
        Dim width, height As Double
        width = 297
        height = 210
       
        '打印區域
        Dim UpperRight(0 To 1) As Double, LowerLeft(0 To 1) As Double
        UpperRight(0) = insertPoint(0)
        UpperRight(1) = insertPoint(1)
        LowerLeft(0) = insertPoint(0) + width * xScale
        LowerLeft(1) = insertPoint(1) - height * yScale
               
        list.AddItem "inserPoint:X=" & UpperRight(0) & " Y:" & UpperRight(1)
        list.AddItem "lowerLeft :X=" & LowerLeft(0) & " Y:" & LowerLeft(1)
       
       
        Dim plotConfs As AcadPlotConfigurations
        Set plotConfs = ThisDrawing.PlotConfigurations
        list.AddItem plotConfs.Count
       
   
        Dim plotconf As AcadPlotConfiguration
        Set plotconf = plotConfs.Add("plot")
        'list.AddItem plotconf.GetPlotDeviceNames(5)
       
        'Set plotConf = ThisDrawing.PlotConfigurations.Add
       
       
        '設置定義要打印的布局范圍的坐標
        ThisDrawing.ActiveLayout.SetWindowToPlot LowerLeft, UpperRight
        '指定布局或打印配置的類型
        ThisDrawing.ActiveLayout.PlotType = acWindow
        '按局部或完整視圖預覽方式顯示打印預覽對話框
        ThisDrawing.Plot.DisplayPlotPReview acFullPreview
        '打印布局到設備
        ThisDrawing.Plot.PlotToDevice
       
    End If
 
   
Next index


發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 黔西| 牙克石市| 乡宁县| 诸城市| 楚雄市| 封丘县| 托克逊县| 周宁县| 资兴市| 康保县| 连平县| 三穗县| 富民县| 房产| 黄浦区| 辰溪县| 武宣县| 阿瓦提县| 绿春县| 谷城县| 溆浦县| 个旧市| 萍乡市| 东莞市| 纳雍县| 乾安县| 秭归县| 都匀市| 玉溪市| 汾西县| 乌审旗| 大埔区| 天气| 焉耆| 泾川县| 隆子县| 滁州市| 岳阳市| 雷山县| 延安市| 绥阳县|