明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 2843|回复: 4

怎样按样式打印?

[复制链接]
发表于 2006-10-18 15:44:00 | 显示全部楼层 |阅读模式

我在编写一个批量的打印的程序,在程序中样式表已指定,但是下图中"按样式打印"怎么选中?有对应的系统变量吗?不选中的话批量打印时样式表起不了作用.

(图片截自AutoCAD的打印对话框)

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?注册

x
 楼主| 发表于 2006-10-20 18:04:00 | 显示全部楼层
已解决
发表于 2006-10-20 22:15:00 | 显示全部楼层

怎么解决的?分享一下。

 楼主| 发表于 2006-10-21 12:38:00 | 显示全部楼层

呵呵,其实一点技术含量都没有,一开始没发现

ThisDrawing.ModelSpace.Layout.PlotWithPlotStyles = True

发表于 2006-10-25 14:18:00 | 显示全部楼层

最近,我也编了一个关于批处理的程序,但不知道为什么有时候可以运行,有时候就不可以!程序如下:

Private Sub cmdOk_Click()
   Dim i As Integer
   Dim ii As Integer
   Dim zz As Integer
   Dim drn As String
   Dim drn1 As String
If lstFile.ListCount = 0 Then
MsgBox "请添加所要操作的图形!"
Exit Sub
End If
frmMain.hide
For i = 0 To lstFile.ListCount - 1
drn1 = lstFile.List(i)
Application.Documents.Open drn1
    Dim ptmin(0 To 1) As Double: Dim ptmax(0 To 1) As Double
ptmin(0) = -257: ptmin(1) = -271
ptmax(0) = -1099: ptmax(1) = 324
    Dim currentPlot As AcadPlot
    Set currentPlot = ThisDrawing.Plot
    ThisDrawing.ActiveLayout.SetWindowToPlot ptmin, ptmax
    ThisDrawing.ActiveLayout.PlotType = acWindow
    If ComboBox1.Text = "ScaleToFit" Then
    ThisDrawing.ActiveLayout.StandardScale = acScaleToFit
    ThisDrawing.ActiveLayout.StyleSheet = TextBox2.Text
    Else
    ThisDrawing.ActiveLayout.StandardScale = ac1_1
    ThisDrawing.ActiveLayout.StyleSheet = TextBox2.Text
    End If
   
       currentPlot.PlotToDevice TextBox1.Text
   Application.ActiveDocument.Close True, drn1
Next i

End Sub

Private Sub cmdOpen_Click()
    On Error GoTo errHandle
   
    Dim i As Integer
    Dim Y As Integer
    Dim z As Integer
    Dim FileNames() As String
   
    With comDlg
        .CancelError = True
        .MaxFileSize = 32767
        .Flags = cdlOFNHideReadOnly Or cdlOFNAllowMultiselect Or cdlOFNExplorer Or cdlOFNNoDereferenceLinks
        .DialogTitle = "选择图形文件"
        .filter = "图形文件(*.dwg)|*.dwg|所有文件(*.*)|*.*"
        .FileName = ""
        .ShowOpen
    End With
   
    comDlg.FileName = comDlg.FileName & Chr(0)  '这些文件名是用空字符Chr(0)分隔符,而不是空格分隔符隔开
   
    z = 1
    For i = 1 To Len(comDlg.FileName)
        'InStr函数,返回 Variant (Long),指定一字符串在另一字符串中最先出现的位置。
        '语法 InStr(起点位置, string1, string2)
        i = InStr(z, comDlg.FileName, Chr(0))
        If i = 0 Then Exit For
        ReDim Preserve FileNames(Y)
        'Mid函数,返回 Variant (String),其中包含字符串中指定数量的字符。
        '语法 Mid(string, start[, length])
        FileNames(Y) = Mid(comDlg.FileName, z, i - z)
        z = i + 1
        Y = Y + 1
    Next i

    '向列表框中添加对象
    Dim count As Integer
    count = lstFile.ListCount
    If Y = 1 Then
        lstFile.AddItem FileNames(count), 0
    Else
        For i = 1 To Y - 1
            FileNames(i) = FileNames(0) & "\" & FileNames(i)
            lstFile.AddItem FileNames(i), i - 1 + count
        Next i
    End If
errHandle:
End Sub

Private Sub CommandButton1_Click()
 On Error GoTo errHandle
   
    Dim i As Integer
    Dim Y As Integer
    Dim z As Integer
    Dim FileNames() As String
   
    With comDlg
        .CancelError = True
        .MaxFileSize = 32767
        .Flags = cdlOFNHideReadOnly Or cdlOFNAllowMultiselect Or cdlOFNExplorer Or cdlOFNNoDereferenceLinks
        .DialogTitle = "选择PC3文件"
        .filter = "数据文件(*.pc3)|*.pc3|所有文件(*.*)|*.*"
        .FileName = ""
        .ShowOpen
    End With
   TextBox1.Text = comDlg.FileName
errHandle:
End Sub

Private Sub CommandButton2_Click()
On Error GoTo errHandle
   
    Dim i As Integer
    Dim Y As Integer
    Dim z As Integer
    Dim FileNames() As String
   
    With comDlg
        .CancelError = True
        .MaxFileSize = 32767
        .Flags = cdlOFNHideReadOnly Or cdlOFNAllowMultiselect Or cdlOFNExplorer Or cdlOFNNoDereferenceLinks
        .DialogTitle = "选择CTB文件"
        .filter = "数据文件(*.ctb)|*.ctb|所有文件(*.*)|*.*"
        .FileName = ""
        .ShowOpen
    End With
   TextBox2.Text = comDlg.FileName
errHandle:
End Sub

Private Sub UserForm_Initialize()
    lstFile.Clear
   ComboBox1.AddItem ("ScaleToFit")
    ComboBox1.AddItem ("1:1")
    End Sub
出错提示为:Run-time error '_2154386493(80200003)'

Invalid input

不知道为什么,请高手分析一下,谢谢!

您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|手机版|CAD论坛|CAD教程|CAD下载|联系我们|关于明经|明经通道 ( 粤ICP备05003914号 )  
©2000-2023 明经通道 版权所有 本站代码,在未取得本站及作者授权的情况下,不得用于商业用途

GMT+8, 2024-11-26 22:49 , Processed in 0.169132 second(s), 23 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表